How to Know if You Are Ready for a Relationship
Q&A for How to Make a Countdown Program in Python
Coming soon
Search
-
QuestionHow do I get it to print at each second rather than having it all print at once?Community AnswerUse the time.sleep(x) function. It allows for the program to pause for x seconds. After every print statement, insert time.sleep(1).
-
QuestionHow do I make the font larger in Python on a Mac?Community AnswerIn the Python shell, click Options, Configure, Idle. From there, you can change the font size.
-
QuestionWhy have the 'time' module if it is never used?Community AnswerIf you write a program for, say, a robot and have the servo controls in milliseconds, then it will use the time module to send the electrical signal for the right amount of time.
-
QuestionI keep getting the following error: "expected an indented block." What have I done wrong?Community AnswerYou need to press the "Tab" key to indent, so if you were doing an "if" loop. you would do: if a = b: print("Indentation is the space before print")
-
QuestionI want to print the time on the video screen. What should I do?Community AnswerI assume that you mean the Python Turtle Graphics window. If I`m correct, you should use the function "write()" instead of "print()". Then you would have to add "clear()" because "write()" does not change the lines automatically. Otherwise you could move the position of your Turtle. To use the function "write()", you also have to add "from turtle import *".
-
QuestionI'm using LiClipse and when loading the code, it loads, but nothing happens. Indentation is fine and the only thing I have changed is changing the variable n to a.Community AnswerCheck for syntax errors, most commonly a semi-colon at the end of all required phases, and make sure that your OS, drivers, and Python are all latest update. It may also be helpful to check the firewall and see if it's blocking the interface.
-
QuestionHow can I stop or abort the countdown?Community AnswerBy using the "break" keyword. For example, if you wanted to initiate a countdown but wanted to stop it halfway through, you could try something like this: i = 10 while i < 10: print(i) i -= 1 if i == 5 break print("done")
-
QuestionHow do I create a timer that produces a random number after a set amount of time in Python?Community AnswerFirst import random. You can then add this line after the code: random.choice(1,2,3,4,5,6,7,8,9).
-
QuestionHow do I run a background timer in a quiz?Invisible OneCommunity AnswerThis is difficult to do in Python. You should use threading to accomplish this: def laughing: while True: print("Haha") thread1 = threading(laughing) thread1.start()
-
QuestionHow can I learn Python in 30 days?BJW1661Community AnswerThere is no set amount of time to learn Python. However, it can be accomplished in that time. Don’t rush, otherwise you will risk giving up out of frustration. There are no shortcuts, you just need to take your time, learn by doing and you’ll get there.
-
QuestionIf i don't want the timer to appear every x second, how do I write the code if I want the user to type the command (eg: !timer) then it ask "How many seconds to count down? Enter an integer:" ?Simeon WatsonCommunity AnswerYou'd write it as: import time time = int(input("How many seconds to countdown? Enter an integer: ")) time.sleep(time) print("Countdown for", time, "seconds is over!")
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit