1. Example of basic parameter definition
Print ("Hello World")
Name = "Paoche Ge"
name2 = Name
Duohang = "'
Print ("My name is", name)
Name = "Mr Li"
Print (Name2, "and", name)
‘‘‘
Print (Duohang) #打印duohang Multiple lines!
Username = input ("Username:")
Password = input ("Password:")
#打印多个参数
2, print out:
Name = input ("Name:")
age = Int (input ("Age:"))
Print (Type (age), type (str))
Job = input ("Job:")
Salary = input ("Salary:")
#不建议这种拼接方式, inefficient
info = ""
---------------Info of----------
Name: "+ name +"
Age: "+ Age +"
Job: ' + Job + '
Souru: ' + Souru + '
‘‘‘
Info1 = "'
---------------Info of%s----------
ame:%s
age:%d
job:%s
salary:%s
"% (name,name,age,job,salary)
Info2 = "' #建议这种方式
---------------info of {_name}----------
Aame:{_name}
Age:{_age}
Job:{_job}
Salary:{_salary}
". Format (_name=name,
_age=age,
_job=job,
_salary=salary)
Info3 = "'
---------------info of {0}----------
AAME:{0}
Age:{1}
JOB:{2}
SALARY:{3}
". Format (name,age,job,salary)
#print (INFO1)
Print (INFO3)
Python variable definition and print output instance