标签:comm pytho ring 原则 com 代码注释 好的 shandong world
>>>print("
Hello World!
")
>>>
Hello World!
1、什么是变量 :
name = "Fugui"
name----变量名
Fugui---变量值
2、标识符命令规范:
3、定义方式:
驼峰体
AgeOfOldboy = 56 NumberOfStudents = 80
下划线
age_of_oldboy = 56 number_of_students = 80
4、定义变量不好的方式举例:
常量即指不变的量,如pai 3.141592653..., 或在程序运行过程中不会改变的量
1、读取用户输入:
name = input("What is your name?") print("Hello " + name )
执行脚本就会发现,程序会等待你输入姓名后再往下继续走。
可以让用户输入多个信息,如下
name = input("What is your name?") age = input("How old are you?") hometown = input("Where is your hometown?") print("Hello ",name , "your are ", age , "years old, you came from",hometown)
执行输出
What is your name?Alex Li How old are you?22 Where is your hometown?ShanDong Hello Alex Li your are 22 years old, you came from ShanDong
2、注释:
代码注释原则:
标签:comm pytho ring 原则 com 代码注释 好的 shandong world
原文地址:http://www.cnblogs.com/yifugui/p/7171996.html