Life is short, and programming is hard. You might as well learn Python and feel the joy of soaring.

Don’t be afraid that the learning process is boring, here’s a Python candy pack from programmer Jackzhenguo: 147 code samples, each 60 seconds long, are nutritious and fun, covering everything from Python basics to machine learning.

Getting started is as simple as converting from decimal to binary, and shows the beauty of Python simplicity:

In[1]:bin(10)Out[1]:'0b1010'Copy the code

Winter is here, and even if you don’t have any hand-drawing skills, you can draw snowflakes in a few lines of code:

Examples are interesting examples, tutorials are also serious tutorials, learning path is clear, systematic, first let’s take a look at the complete directory:

Learning path

Construction completed:

1. Python Basics

Python strings and regularization

3. Python files

4. Python dates

5. Python tools

6. Drawing in Python

7. Python

The construction of:

Basic Python Algorithms

Python Machine learning, including basic concepts of machine learning and ten core algorithms, as well as small examples of Sklearn and Kaggle in action

PyQt make GUI

Flask front-end development

Python data analysis: NumPy, Pandas, Matplotlib, Plotly, etc

The tutorial begins with 82 easy-to-understand sections of code that introduce the basic syntax and functions of Python. From simple to complex, step by step.

Once you’ve mastered the basic concepts, you’re ready to move on. For example, string processing.

Among them, there is a summary of common knowledge, as you look up and use:

From regularization to the implementation of a simple crawler, step by step with code spread:

Of course, learning Python, you can’t ignore three powerful tools: iterators, generators, and decorators.

What is a decorator, you ask? Talk is cheap, show you the code, for example, write a decorator for the test runtime:

Importtimedeftiming (fn):defwrapper():start=time.time()fn() # Execute the fn argument passed in Stop = time. Time () return (stop - start) returnwrapper @ timingdeftest_list_append () : LST = [] foriinrange (0100, 000) : LST. Append (I) @timingdeflist_compre ():[iforiinrange(0,100000)] print("testlistappendtime:",a) print("testlistcomprehensiontime:",c) print("append/compre:",round(a/c,3)) # # # testlistappendtime: 0.0219 testlistcomprehensiontime: 0.00798 append/compre: 2.749Copy the code

Feel the taste of this grammar candy

Follow this tutorial and you will also get beautiful diagrams in 60 seconds:

60 seconds to create simple animation:

Merge sort:

importsmtplibfromemailimport(header)fromemail.mimeimport (text,application,multipart)importtimedefsender_mail():smt_p=smtplib.SMTP()smt_p.connect (host='smtp.qq.com',port=25)sender, password='[email protected]', "**************"smt_p.login(sender,password) receiver_addresses,count_num=['[email protected]','[email protected]'], 1foremail_addressinreceiver_addresses:try:msg=multipart.MIMEMultipart() msg['From']="zhenguo"msg['To']= Email_addressmsg ['subject']=header. header (' this is a message subject notification ',' utF-8 ')msg.attach(text.mimetext (' this is a test message, Do not reply to this email ~','plain',' utF-8 '))smt_p.sendmail(sender,email_address,msg.as_string()) Time. sleep(10)print(' count_num,email_address ') count_num=count_num+1exceptExceptionase: Print (' error in sending mail to %s '%(count_num,email_address))continuesmt_p.quit()sender_mail()Copy the code

In addition, the machine learning component is actively under construction, although it is not yet finished.

In this section, not only the basic concepts, but also the top ten core algorithms and small examples of Sklearn and Kaggle in action will be included.

Like a box of chocolates on your way to Learning Python, you will experience the joy of programming in a 60-second bite.

If you’re learning Python, mark it

Click here to learn more about Python and get 147 free crawler tutorials

To learn more