python--Numeric type

Source: Internet
Author: User
Tags arithmetic arithmetic operators logical operators

python numeric type

variables

-the variable is an area in memory.

Variable naming: Variables are composed of letters, numbers, and underscores.

The address variable in Python is the opposite of the C language, and a single piece of data contains multiple tags;

1. The difference between input and raw_input

Print + string

Input + Numeric type

Raw_input + Character type

Input receives numeric type data: How to make judgment leap year? and determine its type

This year can be divisible by 4 but not divisible by 100, or divisible by 400, then leap years

raw_input data that receives a string type:

2, arithmetic

Operators and expressions

Arithmetic operators: +,-, *,**,/,%,//

This method directly converts a shape to a floating-point type

Assignment operators: =, + =,-=,/=, *=,%=

Relational operators: >=, <, <=,! =, = =

Logical operators: Logical AND And, logical OR OR, logical non-not

3. Character type

1) difference between num=123 and num= "123"

2) integral type and long shaping

? Force defined as Long integer: num2 = 123L

3) Float type

? 1.2e10 represents a value of 1.2 of 10 times;

? 12e9 represents a value of 12 of 9 times;

4) plural type

? Python provides inline support for complex numbers, eg:3.14j, 8.32e-36j

5) Type bool

Examples:

First, the input of the results, and to find the average of the results

Second, the user login

1. User name and password system given;

2. When the user logs in, enter the user name and password to determine if the login is successful;

Enhancement Requirements:

1. User login has three opportunities, more than 3 times has not been successful, error;

2. If the username password is correct, the login is successful, exit the program; (Exit ())


python--Numeric type

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.