Question: InClass 5 exercises: for loop with range (introduction). This exercise focuses on loop (for) practice. To reduce the number of python files, you can group
InClass 5 exercises: for loop with range (introduction). This exercise focuses on loop (for) practice. To reduce the number of python files, you can group four questions into one.python program (py file) and submit all py files into Canvas when complete. 1) Print 1. A, 2. A, 3. A, 4. A, 5. A, add sep = ' , end = ', 'to the print (..) statement as the 2nd and 3rd arguments Set the appropriate range in the 'for' statement Output: 1.A, 2. A, 3. A, 4.A, S, A 2) Print the squares for the numbers from 1 to 21 (use range(..) to generate the range) output149162536496481100121144169196225256289324361400 3) Print 10A 's, then 25B 's You need two for loops Output: AAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBB 4) Print the sum of all even numbers from 2 to 20: (use range (2,22,2)) Output: The sum is 110
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
