python 基础课堂笔记
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 基础课堂笔记相关的知识,希望对你有一定的参考价值。
#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:
_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!")
print("yes,you got it.")
elif guess_age > age_of_oldboy:
print("think smaller...")
else:
print("think bigger!")
#猜年龄运用 if 语句
以上是关于python 基础课堂笔记的主要内容,如果未能解决你的问题,请参考以下文章
Python自动化开发课堂笔记Day04 - Python基础(函数)