I'm pretty much a complete beginner. I'm trying to get a 'timer' or 'clock' that pretty much just counts how long you have the window open by using a loop that adds 1 to "a" for every second, and adds 1 to "b" for every 60 seconds (while subtracting 60 from "a" to reset it to 0).
import time a = 0 b = 0 FirstRun = True while 1 == 1: a = a + 1 #Adds one second if a > 59: #Accounts for minutes b = b + 1 a = a - 60 print("The current time is" + b + ":" + a) time.sleep(1)
However, when I try to run it, I get this error:
line 12, in <module>
print("The current time is" + b + ":" + a)
TypeError: Can't convert 'int' object to str implicitly
I have no idea how to fix this. Any suggestions?
(Also, I'm using 3.1.2)