码迷,mamicode.com
首页 > 编程语言 > 详细

python—DAY1

时间:2019-01-01 17:19:06      阅读:146      评论:0      收藏:0      [点我收藏+]

标签: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)

python—DAY1

标签:list   else   input   ...   bre   break   循环   count   print   

原文地址:https://www.cnblogs.com/yangyan1123/p/10205033.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!