Question: Appreciated! Problem 3: Python has a number of different iteration constructs. Consider this set of nested for loops that prints all fractions where the numerator
Appreciated!
Problem 3: Python has a number of different iteration constructs. Consider this set of nested for loops that prints all fractions where the numerator and denominator are between 1 and 99 inclusive (ignoring any fancy features like reducing them to lowest terms): for x in range(1,100): for y in range(1,100): print(str(x) + "/" + str(y)) (a): Rewrite this to use nested while loops instead. (b): Rewrite this to use a single while True infinite loop, with all incrementing, conditional tests, and loop exit (with break) done explicitly. In other words, your solution should look like this: # initialize some variables while True: #loop body
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
