Create a new file named quiz_loops.py.
b. Write your name and date in a comment.
c. Write a for loop which will display this set of values
2,4,6,8,10,12,14,16.
d. Write a while which will display this set of values
16,13,10,7,4,1,-2.
e. Write a for loop which will print ‘Loops are fun’ three
times.
f. Write a while loop that will prompt you for four numbers.
Convert the number to an integer. Compute the power as power =
power ** number. (Hint: set power=1 before the loop, use power =
power ** number in the loop). Print out the product when the loop
exits.
g. Prompt the user to enter the number of gyros to purchase. As
long as the user enters a number greater than 0, continue to prompt
for the number of gyros purchased. Print out the total number of
gyros purchased once the loop exits.
(Hint: Use sentinel control and have a priming read and a loop
read.)
a. first create a file whose name should be quiz_loops.py
b. To writ eyour name and date in a comment start with #. as
# Name: Date:
c.
for i in range(1,17):
if(i%2==0):
print(i)
d.
i=16
while(i>=-2):
print(i)
i=i-3
e.
Get Answers For Free
Most questions answered within 1 hours.