Note 1 for <pratical Programming:an Introduction to Computer science Using Python 3>

Source: Internet
Author: User
Tags integer division

Book imformation: <pratical programming:an Introduction to Computer science Using Python 3> 2nd edtion

Author:paul Gries,jennifer Campbell,jason Montojo

Page:chapter 1 and Chapter 2.1-2.2

1.every Computer runs operating System,which It's the only program on the computer that's allowed direct access to the hardware (Hardware).

or more complicate (add another layer between the programmer and the hardware):

2.two ways to use the Python interpreter (interpreter) :

(1). Execute a saved Python program with. PY extension (extension, suffix)

(2). Using a Python shell (Shell, command parser )

3.the >>> symbol is called a prompt (hint), prompting to type something

4.the result of Interger division have a decimal point even is a whole number:

1 >>> 5/22 2.53 >>> 4/24 2.0

5.when the operands (operand) is int and Float,python automatically convert the int into a float:

1 >>> 17.0-102 7.03 >>> 17-10.04 7.0

And you can omit the zero like ' 17. ' (But most people think it's a bad idea)

6.integer Division,modulo (modulo)

1 2 23 >>>4 5

: Divisible

When the operands is negative or float,it takes the floor (rounding down) of the result.

1 2 -23 >>>//4 1
1 >>> 3.5//1.02 3.03 >>> 3//1.14 2.05 >>> 3.3 16 3.0

When using modulo,the sign of the result matches the divisor (divisor)

Definition: a% B = a-n*b,n is an integer that does not exceed A/b

1 >>> -17 of2 33 >>> -10% + 4 -3

7.exponentiation (Take power): * *

1 >>> 2 * * 32 83 >>> 3 * 34 27

8.binary operators (binocular operator), unary operators (monocular operator)

+ 、-、 *,/:binary operators

-(nagetive): Unary operators

1 >>>-52 -53 >>>--54 55 >>>---56 -5

Note 1 for <pratical Programming:an Introduction to Computer science Using Python 3>

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.