我想优化我的代码,使其在代码的某个部分能够很好地返回
我知道我可以用do-while来做,但我认为如果用很多do-while可能会很沉重
我确定我要在评论中返回的位置
你能给我一个解决问题的办法吗
#return here 0
mainMenu()
choix = input()
if choix == 1:
print "Enter your username"
username = raw_input()
print "Enter your password"
password = raw_input()
createAccount.createAccount(username,password)
#return here 1
educatorMenu()
choix = input()
if choix == 1:
print "Enter his age"
ageChild = raw_input()
print "Enter his photo"
photoChild = raw_input()
educator.createChildAccount(ageChild, photoChild)
elif choix == 2:
childrenList = educator.seeChildrenList()
#Return to where it is written "return here 0"
elif choix == 3:
childrenList = educator.seeChildrenList()
print "Associate children?"
choixEnfant = input()
educator.associateChildren(childrenList,choixEnfant-1, educator.getIdEducator(username))
#Return to where it is written "return here 1"
非常感谢
注意:我不会重新编写/优化您的代码,因为我觉得这样做应该是您的任务。此外,重写它还缺少相当多的函数和引用;您没有交付MWE
因此,您可能会发现这是一个有用的起点,并尝试调整此(非常基本结构)以满足您的需要。然而,请注意:这也远远不够有效,但它将帮助您扩展基本知识
相关问题 更多 >
编程相关推荐