标签:实战 else 用法 for inpu atime name code you
checi=[‘T40‘,‘T298‘,‘Z158‘] dizhi=[‘cj‘,‘bj‘,‘sh‘] atime=[‘2h‘,‘1h‘,‘3h‘] c1=dict(zip(checi,dizhi)) print(c1) a1=dict(zip(checi,atime)) print(a1) print(‘checi‘,‘\t‘,‘dizhi‘,‘\t‘,‘atime‘) for i in checi: print(i,‘\t‘,c1[i],‘\t‘,a1[i])#注意\t的用法和效果 cc=input(‘you buy the checi:‘) print(‘sorry‘ if cc not in checi else ‘‘) people=input(‘your name:‘) print(‘you buy zhe‘+c1[cc]+‘,‘+people+‘ please take the ticket‘)
》》》》
{‘T40‘: ‘cj‘, ‘T298‘: ‘bj‘, ‘Z158‘: ‘sh‘}
{‘T40‘: ‘2h‘, ‘T298‘: ‘1h‘, ‘Z158‘: ‘3h‘}
checi dizhi atime
T40 cj 2h
T298 bj 1h
Z158 sh 3h
you buy the checi:T40
your name:SXJ
you buy zhecj,SXJ please take the ticket
标签:实战 else 用法 for inpu atime name code you
原文地址:https://www.cnblogs.com/python1988/p/12116082.html