
输入变量 回忆上次内容
变量
#变量a的声明和赋值 a = 0 #变量a的重新赋值 a = 1

接收输入
input
input()


变量接收输入
name = input()


查询帮助

#什么是input help(input) 具体帮助

添加输入提示 name = input("what is your name:")


中断输入

如果用户点击 Ctrl-D

apple vi apple.py

增加提示


优化输入


照猫画虎

运行起来

汇总函数 #!/usr/bin/python3 a = input("How many apples do you got?\n") print("You got " + a + " apples!") b = input("How many bananas do you got?\n") print("You got " + b + " bananas!") total = a + b print("You got " + total + " fruits!")

总结

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。