Im having some problems with my code, take a look at the main() part, i type in choice 2 and it calls open_file. But it takes 1 as else and not IF… And when i write in 1 agin it just prints 1 on the screen, what am i doing wrong? Python Version 3.4.2.
import sys
name=input("What is your name? : ")
print ("Welcome " + name)
def main():
print ("What do you want to do")
print ("1) Open A File")
print ("2) open Web Browser")
print ("3) Exit OS")
main_choice=input()
if main_choice == 1:
open_file()
elif main_choice == 2:
web_browser()
elif main_choice == 3:
exit_os()
else:
unknown_number()
def unknown_number():
print ("The choice you made does not exist, please choose a valid option")
main
def open_file():
print ("What do you want to do?")
print ("1) Open A File TXT FILES ONLY")
print ("2) Back to main menu")
open_file_choice=input()
if open_file_choice == 1:
open_file_confirm()
elif open_file_choice == 2:
main()
else:
unknown_number()
def open_file_confirm():
file=open("","r")
print ("What is the file name? Include extension")
file=input()
main()