i am struggling to get a switch case program in python,when i run the script i want to display three options
Enter your choice :
1.Insert Records
2.Update Records
3.Display Records
and after seeing these,the user should be able to enter his choice.Since am new to python i googled and found that there is no switch case in python.
def main():
print("Enter your choice : ")
print("1.Insert Records \n2.Update Records \n3.Display Records")
choice = sys.argv[1]
if(choice == 1):
print 1
if(choice == 2):
print 2
if(choice == 3):
print 3
else:
print("You entered a wrong choice")
if __name__ == "__main__":
main()
This is what i tried but its of no use, because it needs to enter choice at the time of running the script(eg. python abc.py 1
)