前言
先学学基础的python,万事开头难!还是好好学学开发吧!
直接上干货
#coding:utf8
s=input('请输入一个年份:')
s=int(s)
year=False
if s % 100 ==0 and % 400 ==0:
year=True
elif s % 100 !=0 and s % 4 ==0:
if year:
pirnt('闰年')
else:
print('平年')
Python运算函数
#coding:utf8
lsl=input('输入成绩')
if lsl==100:
print('好样的你是最棒的')
elif lsl > 90:
print('怎么搞的!')
elif lsl >80:
print('上课没有认真听讲吧!')
elif lsl >70:
print('该努力学习了!')
elif lsl >60:
print('将及格找打了吧?')
总结! 积累点滴!
python猜数字游戏
#coding:utf8
import random,time
secret=random randint(1,99)
guess=0
tries=0
print '一起来玩猜数字游戏吧!'
print '要猜的数字在1到100之间,我会给你10次机会'
while guess != secret and tries <10:
guess = input(“你猜它是什么”)
if guess < secret:
print '太小了'
elif guess > secret;
print '太大了'
tries = tries + 1
if guess == secret:
print '哈哈你猜对了'
time.sleep(2)
else:
print “你这个二百五,这都猜不对!正确答案是:",secret,"!"
time.sleep(2)
转载于:https://blog.51cto.com/lwm666/1979280