so I wanted to make a program with menu and if someone choose for example first option text file from different python program will be printed. But everytime I want to run the program and I choose option one it says that name "droga" is not defined. Here is the main code:
import karydrogowe
taryfikator_menu = print("""" Wybierz opcje:
1. Taryfikator Drogowy
2. Taryfikator Srednie
3. Taryfikator Powazne
4. Pokaz wszystkie kary
5. Kalkuator kar
9. Zakoncz""")
menuin = int(input("Co wybierasz?: "))
if menuin == 1:
print(droga)
elif menuin == 2:
print('srednie.txt')
elif menuin == 3:
print('powazne.txt')
elif menuin == 4:
print("f")
elif menuin == 5:
print("d")
elif menuin == 9:
print("s")
else:
print("invalid syntax")
Here is the second python file:
droga = open('drogowe.txt', 'r')
print(droga.read())
droga.close()
Here is the error message: Traceback (most recent call last): File "D:/Taryfikator/untitled/taryfikatormain.py", line 14, in print(droga) NameError: name 'droga' is not defined
Comments
Post a Comment