Why isn't working properly?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isn't working properly??

Taks: Write a code to print the no of seconds you have logged when you hit the enter Here's my try: import threading import time def func(): cou=0 while True: time.sleep(1) cou=cou+1 print(f"you have logged for {cou} secs") t = threading.Thread(target=func,daemon=True) t.start() p = input("Enter the enter:")

22nd Jan 2022, 5:31 PM
Ravi King
2 Answers
0
Yes show me the code
22nd Jan 2022, 7:45 PM
Ravi King
- 1
Why we need to define "cou" as global variable?
22nd Jan 2022, 7:54 PM
Ravi King