笨办法学python3练习代码11-12:print()
ex11.py
1 print("How old are you? ",end = " ") #加入end = " ",则函数不再自动换行 2 age = input() 3 print("How tall are you?",end = " ") 4 height = input() 5 print("How much do you weigh?",end = " ") 6 weight = input() 7 8 print(f"so, you're {age} old,{height} tall and {weight} heavy.")
ex12.py
1 #可以在input(”里面直接输入提示信息“) 2 #input函数除了全部原样输出提示信息外,还要用户输入自己想要输入的字符,不管用户输入的字符是不是数字,用户输入的字符全部按字符串处理。 3 age = input("How old are you? ") #除了原样输出How old are you?,还要接受一个来自用户的字符串。 4 height = input("How tall are you? ") 5 weight = input("How m uch do you weight? ") 7 print(f"so,you're {age} old, {height} tall and {weight} heavy.")

浙公网安备 33010602011771号