+ 1
Timer on python program
i want my program to stop working after 3 tries as seen but it does not. helo https://code.sololearn.com/cmgbwQsDX2SS/?ref=app
3 Answers
+ 1
Seems like Your program has some special characters instead of spaces or tabs for indenting your code. Please replace them with spaces, then it will work
- 1
you are using a while loop to count your 3 runs.. I would switch that from
while counter in range(3)
to
for i in range(3)
Then you don't need the counter variable at all.. In any event, Ravi is correct. your spacing has Ć” instead of ' ' for some reason. I removed it all and put spaces. your code works fine.
- 2
import time
print("//////////////////////////////////")
print("welcome to the charity donation money stealer device")
counter = 0
C = ["1:","2:","3:"]
charitydinero = [0,0,0]
C[0] = "1:" + str(input("Name the 1st benefactor\n"))
C[1] = "2:" + str(input("Name the 2nd benefactor\n"))
C[2] = "3:" + str(input("Name the 3rd benefactor\n"))
Verify = "succeed"
while counter in range (3):
while Verify == "succeed":
print(C)
CC = int(input("choose a charity\n"))
sbill = int(input("how much did u pay\n"))
FOB = sbill*0.01
if CC == 1:
charitydinero[0] = charitydinero[0] + FOB
elif CC == 2:
charitydinero[1] = charitydinero[1] + FOB
elif CC == 3:
charitydinero[2] = charitydinero[2] + FOB
else:
print("This is not an option")
total = charitydinero[0] + charitydinero[1] + charitydinero[2]
print(C[0],"Ā£",charitydinero[0])
print(C[1],"Ā£",charitydinero[1])
print(C[2],"Ā£",charitydinero[2])
print("the total is: Ā£",total,"\n")
counter = counter + 1
if counter == 3:
Sec = 0
Min = 0
timeLoop = start
while timeLoop:
Sec += 1
print(str(Min) + " Mins " + str(Sec) + " Sec ")
time.sleep(1)
if Sec == 60:
Sec = 0
Min += 1
print(str(Min) + " Minute")
print("you have this much time left until you can make your next donation")
print("////////////////////////////////////////////////////////")