python基础一

2018-02-16  本文已影响5人  我想走走

# Author:FengFeng

#打印hello world

print("hello world")

name ="fengfeng"

print("my name is",name)

PIE ="fengzi"

username =input("username:")

password =input("password:")

print(username,password)

msg ="""

name = "fengfengsss"

"""

# Author:FengFeng

#输入框写法
name = input("name:")
age = input("age:")
job = input("job:")
salary = input("salary:")
#占位符,拼接打印
info = '''
------- info if  %s ----------
Name: %s
Age: %s
Job:%s
Salary : %s
''' % (name,name,age,job,salary)
print(info)
# Author:FengFeng
#while循环
age_if_oldboy = 56
count = 0
while count < 3:
    guess_age = int(input("guess age:"))
    if guess_age == age_if_oldboy:
        print("yes, you got it.")
        break
    elif guess_age > age_if_oldboy:
        print("think smaller...")
    else:
        print("think bigger...")
    count+=1
    if count == 3:
        continue_confirm = input("do you want to keep guessing..?")
        if continue_confirm != 'n':
            count = 0
else:
    print("you have tried too many times.. fuck off")
#for循环
for i in range(0,10):
    if i < 5:
        print("loop",i)
    else:
        continue #跳出本次循环,进入下一次循环,break 结束整个循环
    print("hehe...")
# Author:FengFeng

import getpass
#输入框 账号密码输入
_username = "alex"
_password = "abc123"
username = input("username:")
password = input("password:")
#if else 判断
if _username == username and _password == password:
    print("Welcome user {name} login...".format(name = username))
else:
    print("Invalid username or password")
上一篇 下一篇

猜你喜欢

热点阅读