Basic Python Tutorial 1: Getting Started basics

Source: Internet
Author: User
Tags cmath

Write in front of the series, a little sentiment

No carding summary of knowledge is worthless, only the systematic careful comb to form their own knowledge framework, otherwise always into the broken slice-like learning-forgetting cycle.

Learning method is really more important than hard "silly learning", and the most important method of learning is nothing but a summary of carding, restudying, multi-hands practice. As a programmer, it is important to implement this "technique" in order to quickly transform and get started with Python.

I have finished reading the technical books almost no, from today on to read the second edition of the basic Python tutorial, and each chapter write a blog record, summed up the study.

This book is a total of 29 chapters and is scheduled to be read within 14 days. Arduous task, challenge it, take the courage to challenge the marathon ~


Chapter One summary of Python introduction

The program is a combination of expressions + statements

The expression is shaped like "2+3", the statement is like print ("Hello,world"), "What is an expression, and what is a statement?"

Second, the algorithm

The algorithm is actually how to organize the programming language, similar to the role of recipes.

Iii. Some introductory points of knowledge

    • From __future__ Import Division #__future__代表一些未来会正式引入Python的模块
    • Use import to be aware of possible module name collisions, if you do not have to import as much as possible, and then use X.Y to refer to the methods in the module
    • Both repr and Str are representations of the string, which is the function, which is the data type, the string form of the REPR () return value, and STR () converts the value to a string. Add Repr () after the direct output string form:

>>> Print (repr ("Hello,world"))
' Hello,world '
>>> print (' Hello,world ')
Hello,world

    • Comparison of input and raw_input: Raw_input is equivalent to input in Python3
    • R, omit the \ Escape character, but cannot end with \:

>>> print (R ' c:\nowhere\e ')
C:\nowhere\e
>>> print (R ' c:\nowhere ' \ \ ')
C:\nowhere\
>>> print (R ' c:\nowhere ' \ ')

Syntaxerror:eol while scanning string literal

    • A long string with "..." means, \ n is a newline character.

Iii. some of the functions of this chapter

ABS ()

Import Math

Import cmath# can calculate complex numbers

MATH.SQRT () #求正数平方根

Cmath.sqrt () #可以求负数的平方根, Output imaginary

Input ()

Math.ceil #返回上入整数, the return value type is float

math.floor# returns the next rounding integer, type float, floor except, equal to//

pow# equivalent to * *

% #取模

Basic Python Tutorial 1: Getting Started basics

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.