#How to i make it work properly?

12 messages · Page 1 of 1 (latest)

timber oak
#

the code rn looks like this rn:


if user_choise == "n" or user_choise == "N" :
    print("Let's stop here")
elif user_choise == "y" or user_choise == "Y" :
    print("Move on....")
else :
    print("Chose one of the following choice: Yes(\"Y\") or No(\"N\") ")
while True :
    import test.py
    break```
#

the error i get after 2 instances is :
File "c:\Users\USER\Desktop\python github\first\homework\homework1\test.py", line 10, in <module>
import test.py
File "c:\Users\USER\Desktop\python github\first\homework\homework1\test.py", line 10, in <module>
import test.py
ModuleNotFoundError: No module named 'test.py'; 'test' is not a package

tropic adder
#

When you import a python file you don't include the .py file extension. It's be just import test

timber oak
#

oh

#

but it still fails after going trough the if and elif

tropic adder
#

Fails?

timber oak
#

i mean, the code ends and it does not go into a loop till i chose y or n

tropic adder
#

Your loop must go around the if's if you want that to happen

timber oak
#

so how do i make it that way? i tried to integrate it into a while true loop

#

like this

#
while True :
    if user_choise == "n" or user_choise == "N" :
        print("Let's stop here")
    elif user_choise == "y" or user_choise == "Y" :
        print("Move on....")
    else :
        print("Chose one of the following choice: Yes(\"Y\") or No(\"N\") ")

    import test
    break```
#

btw, now learning how to code that's why dono how to do what u tell me to do