标签:格式化 word 一个 confirm 提醒 soft name 猜数字 note
print("xxx")
用于存储东西以便之后调用
name ="Tortoise man"
print("My name is",name)
name2 =name
print("My name is",name,name2)
name ="X"
print(name,name2)
此时的name != name2
ASCII 255=2^8-1 1byte
GB2312 7XXX
GBK1.0 2W+
GB18030 27XXX
Unicode 2bytes
utf-8 English: 1byte, Chinese:3bytes
#XXX
‘XXX‘ or "XXX"
username=input("username:")
password=input("password:")
name =input("name:")
age =input("age:")
job =input("job")
salary =input("salary")
info=‘‘‘
-------info of %s----
name =%s
age =%d
job =%s
salary =%s
‘‘‘%(name,age,job,salary)
print(info)
name =input("name:")
age =input("age:")
job =input("job")
salary =input("salary")
info2 =‘‘‘
------info of {_name}-----
name ={_name}
age ={_age}
job ={_job}
salary ={_salary}
‘‘‘.format (_name =name,
_age=age,
_job=job,
_salary=salary)
print(info2)
name =input("name:")
age =input("age:")
job =input("job")
salary =input("salary")
info3=‘‘‘
-----info of {0}-----
name={0}
age={1}
job={2}
salary={3}
‘‘‘.format(name,age,job,salary)
print(info3)
note A:打印输入类型
print(type("X"))
note B:字符变数字
int(print("X"))
import getpass
username = import(“username:”)
password =getpass.getpass (“password:”)
_username = input(“username:”)
_password =input (“password:”)
If _username == username and _password == password:
Print(“welcome user (name) login….”)
Else:
Print(“invalid username or password!”)
age_of _oldboy = 56
guess_age = int(input(“guess age:”))
if guess_age ==age_of_oldboy:
print(“yes,you got it”)
elif guess_age>age_of_oldboy:
print(“think smaller…”)
else:
print(“think bigger!”)
count = 0
while True:
print(“count:”,count)
count = count +1
If count == 1000:
Break
age_of _oldboy = 56
while true:
guess_age = int(input(“guess age:”))
if guess_age ==age_of_oldboy:
print(“yes,you got it”)
break
elif guess_age>age_of_oldboy:
print(“think smaller…”)
else:
print(“think bigger!”)
age_of _oldboy = 56
count = 0
while true:
if count == 3:
break
guess_age = int(input(“guess age:”))
if guess_age ==age_of_oldboy:
print(“yes,you got it”)
break
elif guess_age>age_of_oldboy:
print(“think smaller…”)
else:
print(“think bigger!”)
count =count+1
age_of _oldboy = 56
count = 0
while count<3:
guess_age = int(input(“guess age:”))
if guess_age ==age_of_oldboy:
print(“yes,you got it”)
break
elif guess_age>age_of_oldboy:
print(“think smaller…”)
else:
print(“think bigger!”)
count =count+ 1
age_of _oldboy = 56
count = 0
while true:
if count<3:
guess_age = int(input(“guess age:”))
if guess_age ==age_of_oldboy:
print(“yes,you got it”)
break
elif guess_age>age_of_oldboy:
print(“think smaller…”)
count=count+ 1
else:
print(“you have tried too many times….”)
age_of_oldboy = 56
count = 0
while count <3:
guess_age = int(input("guess age:") )
if guess_age == age_of_oldboy :
print("yes, you got it. ")
break
elif guess_age > age_of_oldboy:
print("think smaller...")
else:
print("think bigger!")
count +=1
if count == 3:
countine_confirm = input("do you want to keep guessing..?")
if countine_confirm != ‘n‘:
count =0
for i in range(10):
print(“loop”,i)
for i in range(0,10,2):
print(“loop”,i)
age_of _oldboy = 56
for i in range(3):
guess_age = int(input(“guess age:”))
if guess_age ==age_of_oldboy:
print(“yes,you got it”)
break
elif guess_age>age_of_oldboy:
print(“think smaller…”)
else:
print(“you have tried too many times….”)
for I in range(0,10):
If i<3:
print(“loop”,i)
else:
continue
print(“hehe…”)
for i in range(10):
print(“loop”,i)
for j in range(10):
print(j)
if j>5
break
标签:格式化 word 一个 confirm 提醒 soft name 猜数字 note
原文地址:https://www.cnblogs.com/tortoise-man/p/9351691.html