欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

学习python,第一篇

程序员文章站 2022-07-27 20:32:44
结果:danie danie itxpl danie 猜年龄 age_itxpl = 35 for i in range(3): guess_age = int(input("guess age:")) if guess_age == age_itxpl: print("yes,you got it ......
name = "danie"
name2 = name

print(name,name2)

name = "itxpl"

print(name,name2)

结果:danie danie

           itxpl  danie

猜年龄

age_itxpl = 34
count = 0
while count < 3:
        guess_age = int(input("guess_age:"))
        if guess_age == age_itxpl:
              print("yes,you guess right!")
              break
        elif guess_age > age_itxpl:
              print("Make a guess!")
        else:
              print("Guess a little bigger!")
        count +=1
else:
      print("Guess the wrong invitation to dinner!")
学习python,第一篇
age_itxpl = 35
for i in range(3):
    guess_age = int(input("guess age:"))
    if guess_age == age_itxpl:
        print("yes,you got it.")
        break
    elif guess_age > age_itxpl:
        print("think smaller...")
    else:
        print("think bigger!")
else:
    print("you have tride too many time..fuck off")
View Code