Question: Create two variables x and y ( User will input these numbers ) . The maximum number for x and y is 5 , i

Create two variables x and y (User will input these numbers).
The maximum number for x and y is 5, i.e. more than this we will print an error on the console. Similarly, 1 is the minimum.
x represents the number of lists
y represents the number of elements in each list
Create a nested list based on x and y, and fill with ZERO (0).
For example, sample output for x =3 and y =4: Enter Number of Lists (x) : 3
Enter Number of List Elements (y) : 4
The resulting List is : [[0,0,0,0],[0,0,0,0],[0,0,0,0]] Similarly, sample output for x=4, and y=2 should be: Enter Number of Lists (x) : 4
Enter Number of Lists Elements (y) : 2
The resulting List is : [[0,0],[0,0],[0,0],[0,0]]
Similarly,
Enter Number of Lists (4) : 4
Enter Number of List Elements (y) : 6
Error: Not allowed to create List(s) in this case
The resulting List is: []

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!