python第一课

#1
# if 3 > 4:
# print(777)
# else:
# print(888)
#2
# if 3 > 5:
# print(666)
# print(777)
#3
# num=input('请输入')
# if num==1:
# print('抽烟')
# elif num=='2':
# print('喝洒')
# elif num=='3':
# print('睡觉')
# else:
# print('猜对')
#4
# score = int(input("输入分数:"))
# if score >= 100:
# print("我擦,最高分才'100...")
# elif score >= 90:
# print("A")
# elif score >= 80:
# print("B")
# elif score >= 60:
# print("C")
# elif score >= 40:
# print("P")
# else:
# print("笨蛋")
#5
# print('111')
# while True:
# print('我喜欢你启丽')
# print('我爱你启丽')
# print('我想和你睡觉启丽')
# print('OK')
#6
# count=1
# flag=True
# while flag:
# print(count)
# count=count+1
# if count > 100:
# flag =False
#7
# count=1
# while count <= 100:
# print(count)
# count = count+1
#8
# count=1
# sum=0
# while count<=100:
# sum=sum+count
# count=count+1
# print(sum)
#9 break
# print('11')
# while True:
# print('222')
# print(333)
# break
# print(444)
# print('abc')

# count = 1
# while True:
# print(count)
# count=count+1
# if count > 100:
# break
# print(111)
# count = 1
# while count < 20:
# print(count)
# continue
# count = count+1

# count = 0
# while count <=100:
# count=count+1
# if count > 5 and count< 95:
# continue
# print("loop",count)
# print("-------out ol while toop-------")

 

#使用while循环输入12345678910
# count=0
# while count < 10:
# count += 1
# if count == 7:
# print('')
# else:
# print(count)
# count = 0
# while count < 10:
# count += 1
# if count == 7:
# continue
# print(count)
#求1-100所有数的和
# count=1
# sum=0
# while count <=100:
# sum=count+sum
# count+=1
# print(sum)
#输出1-100内的所有奇数
#方法一
# count=1
# while count<101:
# print(count)
# count+=2
#方法二
# count=1
# while count<101:
# if count % 2 == 1:
# print(count)
# count+=1

#求1-2+3-4+5....99所有数的和
# count=1
# sum=0
# while count <100:
# if count % 2 == 0:
# sum = sum - count
# else:
# sum=sum+count
# count+=1
# print(sum)
#用户登陆(三次机会重试)
#input心中有帐号,密码 while
# i=0
# while i < 3:
# username = input('请输入帐号:')
# password = int(input('请输入密码:'))
# if username == '咸鱼哥' and password == 123:
# print('登陆成功')
# else:
# print('登陆失败请重试')
# i +=1
 
原文地址:https://www.cnblogs.com/huangjianfeng/p/11179369.html