from C + + to Python (i) I/O and variables
The first blog post.
A few days ago to see roommates reprinted the View of the article: "A qualified computer professional college graduates, to write at least 300 blog." Although I disagree, but let me rethink the role of blogging, I decided to emulate, and recently also learning Python, so I have this series.
Bloggers have learned C + + and data structures, there is a programming basis for the new language Python know little about, only know web crawler, machine learning these are related. Consulted a number of websites, finally decided to Liaoche teacher's website learning-Liaoche's official website
For a basic computer person, it is not difficult to install and IDE build. Subline good is good, but the blogger prefers to use IDLE with F5, the number of beginners code will not be so much. (plus a white complexion.)
After contact, there is only one feeling-Python is alot easier than C + +
Here's a print example, and we see that Python just needs a line to print it out directly.
Print (' hello,world! ')
#include <iostream>
std::cout << "hello,world!" << Endl;
return 0;
Run print statements at least three lines
And Python's variable declarations are even more powerful:
A = 1
t_007 = ' T007 '
#动态语言不用声明 and can be assigned multiple times to different types
A = ' ABC '
b = a
a = ' XYZ '
print (b)
So, a points to ' ABC ', where B points to a point. Then a goes to point ' XYZ ', so B or ' ABC '.
Static languages, C + + and Java, and dynamic languages, JS and Python are fundamentally different in their handling of variables. Take the wardrobe for example, static language is assigned wardrobe, each wardrobe has the name of each wardrobe. Each variable corresponds to a variable value. and dynamic language is the key and wardrobe relationship, open a wardrobe, you can use a lot of keys.
What about the division of the dynamic language? Will it always float. Python actually turns the annotation symbol of C + + into "floor apart", 10//3 = 3, which is equivalent to integer division.
Incidentally, Python has no integer size or floating-point size limit. There is a point of view that for each programming language, the time saved when coding. will be more useful in ... Run-time top. That explains why C is so high in usage today.
However, with the development of hardware integration, more simple development is a more progressive language may be.
------------------------------------------------
Good luck. 2018.2.1 Corleone
Next: From C + + to Python (ii) character encoding
On an article: no