L = [365,'everyday',3.14,True]
print(L[-1])
print(L[-3])
#切片符号:相当于集合 [),半开半闭区间
print(L[0:3])
#不指定结束位,表示到最后一位结束
print(L[:3])
#不指定起始位,表示从头开始
print(L[1:])
#不指定起始和结束位,切片等于原始序列
print(L[:])
#点球游戏
#电脑为守门员,守住三个方向,左中右;人为发球员,想左中右三个方向发球,
#如果电脑方向=人发球方向,电脑+1否则人+1
from random import choice
#python3 使用input接收所有格式的输入
dircetion = input('Choose one side to shoot(L/M/R):')
print('your choose is ' + dircetion)
seq = ['L','M','R']
#choice函数随机取序列中的一个值
com = choice(seq)
print('computer\'s choice is ' + com)
computer = 0
person = 0
if dircetion == com:
#python数字自相加
computer+=1
#python中输出数字使用%s %f占位
print('wow!computer get a goal,now is %d ' %(computer))
else:
person+=1
print('wow!person get a goal,now is %d ' %(person))
print(L[-1])
print(L[-3])
#切片符号:相当于集合 [),半开半闭区间
print(L[0:3])
#不指定结束位,表示到最后一位结束
print(L[:3])
#不指定起始位,表示从头开始
print(L[1:])
#不指定起始和结束位,切片等于原始序列
print(L[:])
#点球游戏
#电脑为守门员,守住三个方向,左中右;人为发球员,想左中右三个方向发球,
#如果电脑方向=人发球方向,电脑+1否则人+1
from random import choice
#python3 使用input接收所有格式的输入
dircetion = input('Choose one side to shoot(L/M/R):')
print('your choose is ' + dircetion)
seq = ['L','M','R']
#choice函数随机取序列中的一个值
com = choice(seq)
print('computer\'s choice is ' + com)
computer = 0
person = 0
if dircetion == com:
#python数字自相加
computer+=1
#python中输出数字使用%s %f占位
print('wow!computer get a goal,now is %d ' %(computer))
else:
person+=1
print('wow!person get a goal,now is %d ' %(person))