用不同级别(或案例)的Python编写程序

  • 本文关键字:Python 程序 案例 python
  • 更新时间 :
  • 英文 :


我想用python编写一个有7-8种不同情况的程序。如-病例1,姓名,病例2-出生日期,病例3-城市。。。etc

此外,我想从用户那里获得输入并存储在mysql中。

我怎么能在Python中拥有它?有什么想法吗?

我有我的代码-

请忽略缩进-

levels = 1
i= 1

while (i<=5):

if (levels==i and (re.search(r'bhellob', incoming_msg)) or re.search(r'bhib', incoming_msg)):
# incoming_msg=='hello' or incoming_msg=='hi' :
reply = ("Kindly provide your full name")

print(levels)
msg.body(reply)
return str(resp)

levels=levels +1
i+=1


if (levels==i and incoming_msg.isdigit()==False):
print(levels)
reply = ("Thank you for providing your name.nn"
"Kindly provide your DOB:n")


msg.body(reply)
return str(resp)

levels = 3

if((levels==i) and and incoming_msg.isdigit()==False):

reply =('Kindly provide your DOB.")

msg.body(reply)
return str(resp)
i =4
levels = 4


if((levels==i) and incoming_msg.isdigit()==True)):

reply =("Thanks for the info")

msg.body(reply)
return str(resp)
i = 5
levels = 5

else:
# prompt user to check his/her query
reply = "Sorry, but I didn't understand your query.  Kindly select the correct option"
msg.body(reply)
return str(resp)

这就是处理案例的方法。

case = input("what is your case? ")
if case == "nominative":
print("mensa")
elif case == "vocative":
print("mensa")
elif case == "accusative":
print("mensam")
elif case == "genitive":
print("mensae")
elif case == "dative":
print("mensae")
elif case == "ablative":
print("mensa")
else:
print("never heard of it")

最新更新