"Stupid methodology Python3" 4. Variables and Naming

Code: Here Insert Picture Description
run:
Here Insert Picture Description
1. To achieve the function as follows:
known to have 100 cars, each car can sit four people, there are 30 drivers, 90 passengers to be transported today, ask: (1) there are few available vehicles ? (2) There are several available drivers? (3) There are a few empty today? (4) How many people today can transport? (5) how many passengers today? (6) the number of people per vehicle today sitting
2. code assigned to the space_in_a_car 4.0, is a floating-point number, it replaced after 4 following results were obtained:
Here Insert Picture Description
compared with the previous, unchanged 120.0 become 120,3.0 . The reason is that the same difference in Python3 Python2 and a division operation, / rounding in Python2 representatives, the results obtained are integers; / representative division in Python, the result was floating.
3. Give the line variable assignment plus comments. Here Insert Picture Description
4. The operation of the editor as Python, with a common variable name, i, j, k and the like.
Here Insert Picture Description
Once the writing l = 90 l-90, the system will run error Here Insert Picture Description
must first define and then use.
5. code specification: a binary operator in a space on each side (+, -, *, /, =, ==,>, <, etc.)

Guess you like

Origin blog.csdn.net/weixin_45069175/article/details/90320669