Question: For this exercise, use the following 2 D list, which is already declared and initialized in your programming environment below. 3 4 3 8 5

For this exercise, use the following 2D list, which is already declared and initialized in your programming environment below.
3438504439
4236404344
2431464045
4347353126
3728203650
Your task is to determine whether each item in the list above is divisible by 5 or not. If an item is divisible by 5, then leave that value as-is in the list, but if it is not divisible by 5, then replace that value in the list with a 0. Remember that you will need to use modular division from Unit 2 to determine if a value is divisible by 5. Finally, print out the list in the format as seen in the sample run below.
Note: Be sure that your program accounts for 2D lists of any size, not just lists that are 5 x 5. Your program will be tested against lists of size n by n. It should work for any square 2D list, not just the one shown. You should also use for loops in your program, not while loops.
Sample Run
005000
004000
0004045
003500
0020050

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!