下载 python  官网  https://www.python.org 
下载 pycharm 官网 http://www.jetbrains.com/pycharm/
我用的是 python3.7 现在最新

第一天学的命令

1、---------------------------
print("hello world!")


2、---------------------------
name=input("name:")
Age=int(input("Age:"))

info1='''
---------info1 name %s-----
name:%s
Age:%d
'''%(name,name,Age)

info2='''
------info2 of {_name}-----
Name:{_name}
Age:{_Age}
'''.format(
_name=name,
_Age=Age )
info3='''
------info3 of {0}--------
Name:{0}
Age:{1}
'''.format(name,Age )
print(info1)
print(info2)
print(info3)


3、-----------------------
for i in range (10):
print("i:",i)
i+=1
count=0
while True:
print("count:",count)
count+=1
if count==10:
break

if count ==9:
print("count==9")
else:
print("count!=9")


4、-------------------------

user1="jianwei"
password1="abc123"
user2="liangliang"
password2="321cba"

while True:
_user=input("User:")
if _user==user1 :
p_count=0
for i in range (3):
_pw=input("Password:")
if _pw==password1:
print("Login success!")
break
else:
print("Login failure!")
if i==2:
str1='''Account:%s is locked!!!'''%user1
print(str1)
user1="jianweilocked"
break
elif _user==user2:
p_count = 0
for i in range(3):
_pw = input("Password:")
if _pw == password2:
print("Login success!")
break
else:
print("Login failure!")
if i == 2:
str1 = '''Account:%s is locked!!!''' % user2
print(str1)
user1 = "jianweilocked"
break
else:
print("There is no such user!")



2018-04-20 17:24:35





posted on 2018-04-20 17:36  健伟  阅读(118)  评论(0)    收藏  举报