Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

complete following exercises in Python Programming Language Create two variables x and y enter x = 3 and y = 3 Task1 Create nested list

complete following exercises in Python Programming Language

Create two variables

x and y

enter x = 3 and y = 3

Task1

Create nested list based on x and y

for example as mentioned above and fill them with 0

[[0,0,0],

[0,0,0]

[0,0,0]]

if I enter x = 4, y = 4

the list should be

[[0,0,0,0],

[0,0,0,0],

[0,0,0,0],

[0,0,0,0]]

Task2

Now create nested list again and this time you need to check

if

x MOD y is equal to zero then in that index fill with 1 otherwise fill with zero

Note: mod operator in python is % so you need to do X % Y also note 0 % 0 or 0 % 1 will throw exception so find solution for this hint add + 1

this List can be like this Note this is just example

[[1,0,0],

[0,1,0]

[0,0,1]]

Task 3

Traverse over these lists and if you find 1 the print index of that list

Convert X and Y into functions in the end for all 3 Tasks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions