它不完美我知道但是对于选择收件箱,发送和垃圾邮件我想做到这样它返回到菜单而不是主菜单。
请帮助并谢谢
def menu():
print("""
<<<<<<<<<<<<<<<<<<<<>>>>>>>>
1.Sign In||2.Create Account|
3.Exit || |
<<<<<<<<<<<<<<<<<<<<>>>>>>>>
""")
ans=input("What would you like to do? ")
if ans=="1":
email()
elif ans=="2":
sign()
elif ans=="3":
print("\n Goodbye")
ans = None
else:
print("\n Not Valid Choice Try again")
import re
def email():
email = input("Enter Your email: ")
match = re.search(r'[\w.-]+@[\w.-]+.\w+', email)
if match:
print ("Valid email, Your are now logged in :D "), match.group()
print("""
<<<<<<<<<<<<<<<<<<<<>>>>>>>>
1.Inbox||2.Spam |
3.Sent || |
<<<<<<<<<<<<<<<<<<<<>>>>>>>>
""")
else:
print ("Not valid,Try Again! ")
choice=input("Pick Your Choice:")
if choice=="1":
inbox()
elif choice=="2":
spam()
elif choice=="3":
sent()
choice = None
else:
print("Not valid,Try Again! ")
def sign():
user = input('Create Email: ')
password = input('Create Password: ')
print("You have now created your account, go back to the menu to sign in!")
anykey=input("Enter anything to return to the menu")
menu()
store_user = [brandonbiba@gmail.com]
store_pass = [brandon]
def inbox():
print("You have no mail, come back later.")
anykey=input("Enter anything to return to the menu")
menu()
def sent():
print(" You have sent 1 piece of mail to m.mazi@gmail.com ")
anykey=input("Enter anything to return to the menu")
menu()
import random
def spam():
random.randrange(1,1000)
print("This is how much spam you have!")
menu()
它不完美我知道但是对于选择收件箱,发送和垃圾邮件我想做到这样它返回到菜单而不是主菜单。
答案 0 :(得分:0)
您可以将控制权交还给任何调用inbox()
或sent()
的函数。使用return
语句而不是在上述2个函数中调用menu()
。像这样:
def inbox():
print("You have no mail, come back later.")
anykey=input("Enter anything to return to the menu")
return
def sent():
print(" You have sent 1 piece of mail to m.mazi@gmail.com ")
anykey=input("Enter anything to return to the menu")
return