day01学习总结(20170213)

Posted 绿洲2017

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了day01学习总结(20170213)相关的知识,希望对你有一定的参考价值。

#1测试判断用户与密码是否正确:
import getpass
username = "llz"
password = "123455"
_username = input("请输入用户名:")
#assword = getpass.getpass("请输入密码:")
_password = input("请输入密码:")
if _username == username and _password == password:
print("wlelcome user {name} longin ...".format(name = username))
else:
print("Invalid user or name!")

#2猜年龄的游戏1:
age_of_oldboy = 70
guess_age = int(input("guess oldboy_age:"))
if guess_age == age_of_oldboy :
print("yes,you got it!")
elif guess_age > age_of_oldboy:
print ("guess smaller...")
else:
print("guess it bigger...")

#3猜年龄的游戏.循环方法01:
age_of_oldboy = 56
count = 0
while count < 3:
guess_age = int(input("guess oldboy_age:"))
if guess_age == age_of_oldboy:
print ("yes,you got it!")
break
elif guess_age > age_of_oldboy:
print ("guess smaller...")
else:
print("guess it bigger...")
count +=1
else:
print ("your tried more than 3 times...")

#4猜年龄的游戏.循环方法02:
age_of_oldboy = 56
count = 0
for count in range(3):
guess_age = int(input("guess oldboy_age:"))
if guess_age == age_of_oldboy:
print ("yes,you got it!")
break
elif guess_age > age_of_oldboy:
print ("guess smaller...")
else:
print("guess it bigger...")
else:
print ("your tried more than 3 times...")

#5:打印循环数字:
for i in range(9):
print("______",i)
for j in range(9):
print(j)
if i > 5:
print("end!")
break

#6测试模块打印目录:
import os
cmd_res = os.popen("dir").read()
print("-->",cmd_res)
os.mkdir("new_dir")

以上是关于day01学习总结(20170213)的主要内容,如果未能解决你的问题,请参考以下文章

java基础学习_面向对象(下)01_day08总结

java基础学习_面向对象(上)01_day07总结

java基础学习_java基础语法(上)01_day02总结.txt

2111 JAVASE每日复习总结 链接汇总

2107 JAVASE每日复习总结 链接汇总

2110 JAVASE每日复习总结 链接汇总