As the group of gay whim, intends to use the popular Python language to complete our pair programming project, I also take the opportunity to learn Python syntax details and characteristics. However, converting from the C + + language to Python is a challenging task.
First, Python has a special syntax format: indentation. The execution code, unlike the IF, while condition, is identified by the curly braces {}, and Python represents this hierarchical relationship in the form of indentation. For example:
1 ifA>B:2max=a3Print"the larger person is%d"%max)4 elifa<B:5max=b6Print"the larger person is%d"%max)7 Else:8Print"The two are the same size")
Also, you will find that the conditional parentheses () that follow the If are not there, instead of the colon. In addition, some of the nuances of grammar are different from the language we were exposed to earlier.
In Python, when we declare a variable, we don't have to indicate whether its data type is int or float or string, and the interpreter automatically chooses the data type based on its value, which gives the program ape a lot of convenience.
The Python library also has a lot of handy functions for manipulating strings, and we can use them directly without having to code a lot of lines to implement this function.
Next week, my team and I will continue to learn more about the Python language, and will combine our respective code into a modular, arithmetic expression to achieve the automatic generation and calculation functions.
Pair Programming 1-Beginner Python language