The first step of learning Python, seniors tell you how to learn it
Have the Python learning tutorials forwarded by your circle of friends been forgotten in your favorites? The original author, William Koehrsen, is an applied data science researcher and ultramarathon runner-up. This article is his introductory experience in learning Python, which may help you who have not yet taken action.
Reminiscing about my first Python program
For the sake of nostalgia, I want to share my first Python program two years ago. I first learned Python as an aerospace engineering student who wanted to avoid learning Spreadsheets, and I didn’t know why I chose Python.
My Python education began with Al Sweigart's book "Automated the Boring Stuff with Python". It is an excellent introductory book on programming that teaches you to use simple programs to complete useful tasks. When I take a new course, I look for opportunities to use it and try to solve a new problem in Python.
Before the first assignment, I was very eager to get this book worth 200 US dollars, but I couldn't even afford the rent of 20 US dollars. I saw that Amazon had a free one-week trial opportunity, so I got the right to use the book for a week through Amazon and completed the homework. While I could create a new account every time I need it, it would be too much trouble. I figured out a more efficient way to do some programming using Python.
One of the many useful libraries in Automate the Boring Stuff is pyautogui, which allows you to control the keyboard and mouse through Python. Some people say that when you have a hammer, every problem looks like a nail.
Python and pyautogui will allow me to press the arrow keys and take screenshots, solving the "unlimited free viewing of books problem".
I wrote the first program to automatically flip through each page in the book and take screenshots. Although there are only 10 lines, I am very proud!
The following is the entire content of this code:
Import pyautogui
Import time
#Sleep for 5 seconds, let me open the book time
sleep.leep(5)
# The range can be changed according to the number of pages (1000):
for i in range(1000):
# Turn page
pyautogui.keyDown('right')
pyautogui.keyUp('right')
# Save screenshot
pyautogui.screenshot(' images/page_%d.pdf'%i)
time.sleep (0.05)
It's very simple to run the program (I encourage anyone to try it). I saved the script as book_screenshot.py, then pulled up a command prompt in the same folder and typed:
python book_screenshot.py
Then, I would have 5 Flip the book in seconds and bring it to full screen. The program does the rest, going through each page and taking screenshots that are saved as pdf. I can then merge all the pdf files into one file and have a (albeit of dubious legality) copy of the book! Admittedly, this is a copy that does not respect copyright enough, but it is the method I have to use in order to read the book.
This example shows two key points for me to learn new skills:
1. The best way to learn new skills is to find the problem that needs to be solved!
2. You don’t need to fully master a skill before it is useful.
With just a few lines of code and a free online book, I wrote a program that I actually use. Learning the basics can be tedious as I get bogged down in data structures and loops. My first attempt at learning Python failed within a few hours. But once I changed my strategy and started developing solutions to real-world problems, I ended up learning some basic principles.
There is a lot to master in the world of programming and data science, but you don't need to learn everything at once. Pick a problem you need to solve and get started!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



VS Code extensions pose malicious risks, such as hiding malicious code, exploiting vulnerabilities, and masturbating as legitimate extensions. Methods to identify malicious extensions include: checking publishers, reading comments, checking code, and installing with caution. Security measures also include: security awareness, good habits, regular updates and antivirus software.

In VS Code, you can run the program in the terminal through the following steps: Prepare the code and open the integrated terminal to ensure that the code directory is consistent with the terminal working directory. Select the run command according to the programming language (such as Python's python your_file_name.py) to check whether it runs successfully and resolve errors. Use the debugger to improve debugging efficiency.

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

The key to running Jupyter Notebook in VS Code is to ensure that the Python environment is properly configured, understand that the code execution order is consistent with the cell order, and be aware of large files or external libraries that may affect performance. The code completion and debugging functions provided by VS Code can greatly improve coding efficiency and reduce errors.

Golang is more suitable for high concurrency tasks, while Python has more advantages in flexibility. 1.Golang efficiently handles concurrency through goroutine and channel. 2. Python relies on threading and asyncio, which is affected by GIL, but provides multiple concurrency methods. The choice should be based on specific needs.