gpt4 book ai didi

python - 如何返回到 Python 程序中的较早点?

转载 作者:太空宇宙 更新时间:2023-11-04 10:46:17 26 4
gpt4 key购买 nike

<分区>

#this is my very first python attempt

name = raw_input("What is your name?")

if len("string") > 0:
print "Hello %s, Let's be friends!" % name
else:
print "Sorry, what was that?"

print ""
print name + ","
lor = raw_input("You come to a crossroads, left or right?")

if lor == "left":
print "You went left"
elif lor == "right":
print "You went right"
else:
print "That's not a direction."

这是我的第一个代码。如果一个人写的东西不是右或左,有没有办法让他们再次选择右或左? (所以基本上把它们带回 lor 的 raw_input)?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com