py练习

功能类似pop

def myPop():
    l=[]
    a=raw_input('a:')
    for i in a:
        l.append(i)
    l.pop()
    print l
myPop()

输入分钟,返回小时数和分钟

def atime():
a=input('a:')
a1=a/60
b=a-a1*60
print '%s:%s'%(a1,b)

菜鸟级的游戏

import random
def s_3():
while 1:
dict1=['st','b','jd']
dict2=random.choice(dict1)
print dict2
s_31=raw_input(u'请输入指令:')
if s_31==dict2:
print u'重新来'
if s_31=='st'and dict2=='st':
print u'你胜了0'
break
if s_31=='b' and dict2=='b':
print u'你胜了1'
break
if s_31=='jd' and dict2=='jd':
print u'你胜了2'
else:
if s_31=='st'and dict2=='b':
print u'你输了0'
if s_31=='st' and dict2=='jd':
print u'你胜了3'
if s_31=='b' and dict2=='jd':
print u'你输了1'
if s_31=='b' and dict2=='st':
print u'你输了2'
if s_31=='jd' and dict2=='st':
print u'你胜了2'
if s_31=='q':
break

s_3()

上一篇:HDU - 4901 The Romantic Hero(dp)


下一篇:阿里云轻量级服务器上JDK及tomcat部署配置