1. First learn to use Python to write a+b programs:
A, b = map (int, raw_input (). Split ()) print a+bprint ' \ n '
The Raw_input () function reads a line from the standard input and returns a string (minus the end of the newline character). After reading, the string has a split () function that can be disassembled into a list of substrings based on the delimiter. For objects within a list, you need to take a transform, preserving the continuation of the string. If it is Python3, replace raw_input () with input ().
A, B = raw_input (). Strip (). Split ()
This line of code reads a line of string and separates A, B, but a, B is a string and needs to be converted again to int type. The Strip () method removes the character specified by the string's Kinsoku (the default is a space). Removes only the characters specified by the beginning and ends of the string, and the middle part is not removed.
The following example shows how the strip () function is used:
#!/usr/bin/python="0000000this is string EXAMPLE....WOW!!! 0000000 "; Print str. Strip(' 0 ');
The result of the above example output is as follows:
This isstring example .... WOW!!!
A, B, c = (int (x) for x in Raw_input (). Split ("))
This is a lot of writing algorithms for the classmate, although not how to use Python, but still have OJ Web site to provide support for Python compiler. This notation A, B, C has become an int type, and then the direct numerical operation is done.
Python basic syntax