Search code examples
pythonwait

How to get time.sleep working in PyCharm?


x = a.1
y = .5
z = input("Name:")
input("Password:")
print("Welcome " + z)
time.sleep(x)

and time.sleep is not working Error:

Name:a
Password:a
Welcomea
Traceback (most recent call last):
  File "F:/Python/PROGETTI/Test.py", line 6, in <module>
    time.sleep(x)
NameError: name 'time' is not defined

Process finished with exit code 1

Sorry if this is a stupid question but i started yesterday programming


Solution

  • Add import time to the top of your file, then read https://docs.python.org/3/reference/import.html

    import time
    
    x = a.1
    y = .5
    z = input("Name:")
    input("Password:")
    print("Welcome " + z)
    time.sleep(x)