0

Stuck on While Loop Project

Ok I am supposed to make the computer count down from 100 to 1 then at zero say, "Blast Off!" And not run any more code. I was trying to follow along with this guy on YouTube right here: https://www.youtube.com/watch?v=ytXfaew7bCA He is a very good teacher, I am just not able to figure out what is wrong with my code. You see his. This is mine, if anyone can assist, thanks in advance. count = 100 While count > 1: print(count) count = count - 1 count = 100 While count >= 0 if count == 0 print("Blast Off!") else: Print(count) count = count - 1

14th Jun 2018, 12:35 AM
Michelle Dobbs
Michelle Dobbs - avatar
5 Respuestas
14th Jun 2018, 1:48 AM
Manual
Manual - avatar
+ 8
Michelle Dobbs line up with print print(count) count = count - 1 if it is not aligned within the code properly you will get errors or bugs.
14th Jun 2018, 12:42 AM
Manual
Manual - avatar
+ 1
I think you shouldn't write count=100 within while loop, which will reassign count to 100 every time you run the loop and thus generates an infinite loop. Maybe you need something as Jay Matthews has suggested.
14th Jun 2018, 1:43 AM
李立威
0
Thanks for your response. Yes, you are correct it wasn't aligned properly. I went back to try and fix it and honestly, I couldn't. I am very new to this and I am not even sure how this is supposed to be aligned. Not good. I need to go and find more information on how to align this. I don't recall it being addressed in my earlier lessons. Very disheartening. But thank you for your help.
14th Jun 2018, 12:53 AM
Michelle Dobbs
Michelle Dobbs - avatar
0
Thanks guys so much for your help.
18th Jun 2018, 3:07 PM
Michelle Dobbs
Michelle Dobbs - avatar