1. 程式人生 > >python 基礎課堂筆記

python 基礎課堂筆記

縮進 print nbsp 數據 span mil 類型 pytho gin

#Author:zyl
_username=‘zyl‘
_password= ‘zyl123‘
username= input("username:")
password = input("password:")
print(username,password)
if _username== username and _password == password:
print("welcome user {name} login...".format(name=username))
else: print("invalid usernaem or password!") #indentationError表示縮進錯誤
#if和else後都必須加冒號“:” #Author:zyl 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!") #猜年齡運用 if 語句

python 基礎課堂筆記