Feb-04-2018, 09:44 AM
Hi All.
I am new to python coding.
I am trying to get 4:0:0 hours count down by just entering "4 enter" and "enter for 0" then "enter for 0" again.
Or 0:5:0 for 5 Minutes instead of Actually entering 0 5 0
What I cannot get my head round is how to stop this error from incurring when I just hit enter for 0.
What have I missed or doing wrong.
Thanks.
Traceback (most recent call last):
File "/home/david/projects/Python-Files/Power_Supply/Count_Down_Timer.py", line 17, in <module>
minz = int(input('Minutes: '))
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
Here is the code.
I am new to python coding.
I am trying to get 4:0:0 hours count down by just entering "4 enter" and "enter for 0" then "enter for 0" again.
Or 0:5:0 for 5 Minutes instead of Actually entering 0 5 0
What I cannot get my head round is how to stop this error from incurring when I just hit enter for 0.
What have I missed or doing wrong.
Thanks.
Traceback (most recent call last):
File "/home/david/projects/Python-Files/Power_Supply/Count_Down_Timer.py", line 17, in <module>
minz = int(input('Minutes: '))
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
Here is the code.
#!/usr/bin/env python3 import time import sys print(' ') print('Countdown Timer') print(' ') print(' ') print(' ') c = ':' # Get the users input hourz = int(input('Hours: ')) minz = int(input('Minutes: ')) secz = int(input('Seconds: ')) hour = int(hourz) minutes = int(minz) seconds = int(secz) while hour > -1: while minutes > -1: while seconds > 0: seconds = seconds - 1 time.sleep(1) sec1 = ('%02.f' % seconds) # format min1 = ('%02.f' % minutes) hour1 = ('%02.f' % hour) sys.stdout.write('\r' + str(hour1) + c + str(min1) + c + str(sec1)) minutes = minutes - 1 seconds = 60 hour = hour - 1 minutes = 59 print(' ') print(' ') print('Countdown Complete.') time.sleep(5)