标签:list else input ... bre break 循环 count print
# user = "123"
# possword = "111"
# count = 0
#
# while count < 3:
# user_name = input("姓名:")
# possword1 = input("密码:")
# if user_name == user and possword1 == possword:
# print("登陆成功!")
# break
# else:
# print("登陆失败!")
# count += 1
# else:
# print("输入已达上限!")
# a = list(range(0,100,2))
# print(a)
#1、使用while循环输入1234568910
# count = 0
# while count < 10:
# count += 1
# if count == 7:
# pass
# else:
# print ("logon:",count)
#2、输入1-100以内所有的奇数
#方法一:
# count = 1
# while count < 101:
# print (count)
# count += 2
#方法二:
# count = 1
# while count < 101:
# if count % 2 == 1:
# print (count)
# count += 1
#3、求1-2+3-4+5....99的所有的和
# sum = 0
# count = 1
# while count < 100:
# if count %2 == 0:
# sum - count
# else:
# sum += count
# count += 1
# print (sum)
#用户登录(三次机会重试)
# user ="haha"
# possword = "123"
# count = 0
# while count < 3:
# user1 = input("姓名:")
# possword1 = input ("密码:")
# if user1 == user and possword1 == possword:
# print("登录成功!")
# else:
# print("登录失败!")
# count += 1
# print("当日次数已用完!")
# #格式化输出
# name = input ("姓名:")
# age = int(input("年龄:"))
# height =int ( input("身高:"))
# # msg = "我叫%s,今年%s,身高%s"%(name,age,height)
# # print(msg)
# a = """--------info of %s-----------
# name: %s
# age: %s
# height: %s
# -----------END---------------"""%(name,name ,age,height)
# print(a)
# a = range(100)
# count = 0
# for i in a :
# count = count + i
# print(count)
标签:list else input ... bre break 循环 count print
原文地址:https://www.cnblogs.com/yangyan1123/p/10205033.html