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!")
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")