0% found this document useful (0 votes)
79 views4 pages

Tableau Assignment 3

This document provides an assignment with two tasks. The first task involves writing a function to catch exceptions from dividing by zero, and generating sentences from lists of subjects, verbs, and objects. The second task involves writing a function to raise the elements of a vector to successive powers and put them into the columns of an output matrix, in either increasing or decreasing order. The solution should include the source code and an output screenshot.

Uploaded by

avsrao123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views4 pages

Tableau Assignment 3

This document provides an assignment with two tasks. The first task involves writing a function to catch exceptions from dividing by zero, and generating sentences from lists of subjects, verbs, and objects. The second task involves writing a function to raise the elements of a vector to successive powers and put them into the columns of an output matrix, in either increasing or decreasing order. The solution should include the source code and an output screenshot.

Uploaded by

avsrao123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Session 3

Assignment 1 Question
Session 3: Assignment 1

Table of Contents

1.​ ​Introduction

2.​ ​Problem Statement

3.​ ​Output
1.​ ​Introduction

This assignment will help you to consolidate the concepts learnt in the session.

2.​ ​Problem Statement

Task 1:

1.

Write a function to compute 5/0 and use try/except to catch the exceptions.

2.

Implement a Python program to generate all sentences where subject is in ["Americans",


"Indians"] and verb is in ["Play", "watch"] and the object is in ["Baseball","cricket"].

Hint: Subject,Verb and Object should be declared in the program as shown below.

subjects=["Americans ","Indians"]
verbs=["play","watch"]
objects=["Baseball","Cricket"]

Output should come as below:

Americans play Baseball.


Americans play Cricket.
Americans watch Baseball.
Americans watch Cricket.
Indians play Baseball.
Indians play Cricket.
Indians watch Baseball.
Indians watch Cricket.
Task 2:

1.

Write a function so that the columns of the output matrix are powers of the input vector.

The order of the powers is determined by the increasing boolean argument. Specifically, when
increasing is False, the i-th output column is the input vector raised element-wise to the power
of N - i - 1.

HINT: Such a matrix with a geometric progression in each row is named for Alexandre-
Theophile Vandermonde.

NOTE:​ ​The​ ​solution​ ​shared​ ​through​ ​Github​ ​should​ ​contain​ ​the​ ​source code​ ​used​ ​and​ ​the​
​screenshot​ ​of​ ​the​ ​output.

3.​ ​Output

N/A

You might also like