The first day of the beginner's program, always starting with Hello World, Python is no exception;
1. Try the first Python program print output:
1 Print ("Hello World! ") ")
Operation Result:
2. Assign variables and branch outputs:
- Use print () as the information output;
- Use XXX = YYY, give the value of yyy to xxx;
- Use the input () statement to get the user output information, then assign the variable (to the left of the = number), use the INT () statement to restrict the input type, int to shape, and the default to string (string)
- Use the ' ' ' Comment text and format it, and finally call the print () output.
1 #Registration of Student information2 Print("Please enter the following student information:")3s_id = Int (input ("School Number:"))4S_name = input ("Name:")5s_age = Int (input ("Age:"))6S_class = input ("class:")7 8 #Enter the above registration information and export the Student information card9Stu_info =" "Ten ------------Student Information card: {s_name}----------- One A Study number: {s_id} - name: {s_name} - Age: {s_age} the class: {S_class} - - --------------------------------------- - " ". Format (s_id=s_id,s_name=s_name,s_age=s_age,s_class=S_class) + - Print(Stu_info) + Print(S_name,"data entry is complete! ")
Operation Result:
The road to survival Python W1