I.. raw_input and Input
Input and Raw_input can read the console inputs, but input and raw_input are different when working with numbers.
1, when the input is a pure number
- Input returns a numeric type, such as Int,float
- Raw_inpout return String type, String type
2. When input is a string expression
- Input computes the numeric expression in the string, and Raw_input does not.
- For example, enter "57 + 3":
- Input will get an integer 60
- Raw_input will get the string "57 + 3"
- For example, enter "5,4,9,2,8,3":
- Input will get a tuple of integers
- Raw_input will get the string ' 5,4,9,2,8,3 '
ii. The difference between sort and sorted
Sort () is an order of itself, no return value
Sorted () has a return value, returns a well-ordered copy, the original value does not change
Iii. The difference between continue and break
both continue and break jump out of the loop statement. The difference is that continue jumps out of the loop, break jumps out of the loop
iv. The difference between Xrang and range
The range and xrange usages are exactly the same, and the difference in generating a list,xrange with range is a generator.
In order to generate a large number sequence, using xrange will be much better than range performance, because there is no need to open up a large amount of memory space.
The difference between some keywords in python