Ethan H.

asked • 03/07/21

Python while loops lab

These exercises are the same as the For Loop lab. This lab requires you to convert the for loops into while loops:

  1. Create a while loop with 100 iterations. The program determines if the index is even or odd by writing an IF statement in the body of the loop.
  2. If the index is even print(“index even”, index value value)
  3. If the index is odd print(“index odd”, index)
  4. Create a while loop that counts down from 100 to 0 by 1. For every 25 iterations(use IF statement) print a statement indicating you are 25% their, then 50%, then 75% then you are done.
  5. print(“you have reached 25% of countdown”, index value)
  6. print(“you have reached 50% of countdown”, index value)
  7. print(“you have reached 75% of countdown”, index value)
  8. print(“you have completed the countdown 100%", index value).
  9. Create a while loop that reads a list of 10 temperatures. You will create the values for the temperatures and have print statements indicating if the temperature is in spring, summer, winter or fall.
  10. Spring temps are from 61-85  then print("Spring temp", variable)
  11. Summer temps are greater than 85 then print("Summer temp", variable)
  12. Fall temperatures are from 40-60 then print("Fall temp", variable)
  13. Winter temperatures are below 40 then print("Winter temp", variable)


1 Expert Answer

By:

Patrick B. answered • 03/07/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.