英语学习笔记2019-10-25
We should try to know more about the dynamics of the computer industry so that we can choose a better direction to go according to our actual conditions. The more we know, the better we will be. In recent years, Python has been more and more popular with the rise of big data, artificial intelligence and cloud computing, so it's necessary to know more about Python.
I. Python Learning Directions
- Python – Data Structure & Algorithm (internal strength)
- Python – Web Development (Django, Flask, Tornado...)
- Python – Crawler (requests, BeautifulSoup, XPath, pandas...)
- Python – Hacker Technology
- Python – Data Analysis – Data Mining -- KDD: Knowledge Discovery in Database
- Python – AI (Artificial Intelligence) – Machine Learning – Deep Learning (TensorFlow, PyTorch, Keras, ….)
https://runestone.academy/runestone/books/published/pythonds/index.html
Here I recommend an online Python editor to you.
You can access the website on your PC or smartphone.
http://www.dooccn.com/python3/
In-class Exercise: Write a Python program to evaluate the sum of 1, 2, 3, ...., and 100.
II. Local Python Development Environment
Last time we installed Anaconda 3 on the computer.
Now let's take a look at the start menu for Anaconda 3.
1. Anaconda Prompt
Let’s start Anaconda Prompt and we will see a window like this:
(1) Start Python
Type "python" after the Anaconda prompt > and then press Enter to enter the Python environment.
Now we can type a Python statement to print a message on the screen.
Type print("Welcome to Python World~") after the >>> prompt and Press Enter to execute the statement.
print() function is used to output some data on the screen.
Now let me demonstrate how to do addition by writing several Python statements.
No. 1 statement: assign 100 to the varible a, then a must be an int variable
No.2 statement: assign 200 to the variable b, then b must b an int variable
No.3 statement: assign the sum of a and b to the variable sum, then sum must be an int variable
No.4 statement: output the result by calling the print() function
No.1 and No.2 statements belong to the input part;
No. 3 statement belongs to the processing part;
No. 4 statement belongs to the output part.
We can use the type() function to get the type of a variable or an expression.
The result of an int data plus a float data will be of float type.
Can addition be performed on an int data and a str data?
There are several ways to solve the problem.
Method 1. use the conversion function str()
Method 2. use the type specifier %d to output int data
Method 3. use the format() function to output data in a specified format