python_day1

  • 编码

ASCII --> GB --> GBK --> utf-8

  • 第一个程序

hello world

  • 输密码
#Author:Elson Zeng
import getpass
_username = 'jian'
_passwd = '123'
username = input("username:")
passwd = input("passwd:")

if _passwd == passwd and _username == username:
print ('welcome user {name} login'.format(name=username))
else:
print ('Invalid username or passwd!')
  • while and for 循环
#Author:Elson Zeng

age_of_oldboy = 56

count = 0
for i in range(3):
guess_age = int(input('guess age:'))
if guess_age == age_of_oldboy:
print ('you guess ture!')
exit()
elif guess_age > age_of_oldboy:
print ('you guess big')
else:
print ("you guess small")
count += 1
else:
print('you guess too many times,fuck off~!')
上一篇:大数据笔记5.8


下一篇:python学习总结_1