python-20190707
Posted zxw2016208120
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python-20190707相关的知识,希望对你有一定的参考价值。
‘‘‘print("hello world!")
print("123")
x=3
y=5
print("x乘以y=", x*y)
name = "alex li"
name2 = name
print(name,name2)
name = "jack"
print("what is the value of name2 now?")
print(u"我爱北京天安门")
death_age = 80
name = input("your name:")
age = input("your age:")
print("you can still live for ",death_age-int(age),"years")‘‘‘
‘‘‘age_xiaowei = 24
input("age = ")
if(int(age) < age_xiaowei:
print("No,you are wrong,just guess bigger")
else if (int(age) > age_xiaowei:
print("No,you are wrong,just guess smaller")
else if (int(age) == age_xiaowei:
print("you are right"))))‘‘‘
age_xiaowei = 24
guess_age=int(input("guess_age:"))
if guess_age == age_xiaowei: #if后面接条件,必须注意的是,条件后必须带冒号
print("you are right")
else: #与if一样,else后面接条件,条件后必须带冒号
print("you are wrong") #在python中,用相同的缩进代表同一级别的代码
‘‘‘age_xiaowei = 24
guess_age = int(input("age = "))
if guess_age < age_xiaowei:
print("No,you are wrong,just guess bigger")
elif guess_age > age_xiaowei: #在python中,elseif必须写成elif
print("No,you are wrong,just guess smaller")
else:
print("you are right")‘‘‘
以上是关于python-20190707的主要内容,如果未能解决你的问题,请参考以下文章