Python Basics - Data Type - Identifier Name Specification

tags: python

A we call it a variable
A = 'Hello, the world'
print(a)

Data type concept

Data in Python has their own data types

Digital Type: Integer INT Floating Point Float Complex
print(4)    int  Integer type
print(3.1415)    floattype 
print((-1) ** 0.5)   complextype 
String Type: Actually, a normal text

String in Python requires a pair of single quotes, or double quotes to package

print('Today's weather is fine, good scenery is good at)
print('56')
Boolean type: used to express true / false / wrong

There are only two values ​​in the Boolean type, one is True, one is false

print(4 > 3)  True
print(1 > 5)  False
List type
names = ['Song Jiang','   ','Wu Song',' ']
Dictionary type
person = {'Name':'Dalang','Profession':Buy Cake ','height':'150'}
Yuanzu type
nums = (1,5,6,9,8)
Collection type
x = {9,'hello','good',True}
a = 34
b = 'hello'
c = True
d = ['Jay Chou','Eason Chan','Zhang Yu']

print(type(c))

In Python, the variable is no data type, the data type of our variable is actually the data type of the value corresponding to the variable.

Identifier: variable, module name, function name, class name

Nameout of the identifier:
rule:
1. Composed of numbers, letters, and underline, can not start with numbers
2. Strictly case sensitive (in computer programming, a total of 52 letters)
3. Cannot use keywords
Keywords: In Python language, there is a special meaning word, such as IF, For, Else, While, Try, etc.,
** Specification: ** Suggested compliance, compliance with the specification is professional, and the code is easy to read.
1. Small hump naming method: The first letter of the first word is lowercase, the first letter of each word is capitalized in UserNameAndPassword
2. Big hunch nomenclature: the first letter of each word is capitalized in Personmodel
3. Use the underscore connection: user_name_and_password
Use the variable, function and module name in Python, using underscore: Python's class name uses a large peak nomenclature

Assignment statement

a = 23

 I  = 'Peng Yuxi'
print(I)

Intelligent Recommendation

Python (Chapter 2) Language Characteristics, Code Specification, Reserved Word, Identifier, Basic Data Type, Operator, Priority, Basic Input Output

Chapter two This chapter overview Introducing the reserved word, identifier, variable, basic data type, data type conversion, operator, expression, and other content in Python 2.1 Python Grammatical F...

Python identifier, reserved word, variable, and data type

Reserved words: 'False', 'None', 'True', '__peg_parser__', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'glo...

【Python Learning】 -Data type, identifier symbol

type of data String: STR Value: int / float Bur: True / False List: List Metropolitan group: TUPLE Collection: set Dictionary: DICT The above program running results Identifier Simply put, a string of...

Python Reserved Word, Identifier, Variable, Data Type, Data Type Conversion

Reserved wordThat is, some words that have been given a special meaning by the Python language, and cannot be used as an identifier. Identifier:includeVariables, functions, classes, modules, and other...

C / C ++ Programming Specification (02) - Identifier Name

The naming of the identifier is clear, clear, clear meaning, and use a complete word or abbreviations that you can understand, avoid misunderstanding. Note: The shorter words can be abbreviated by rem...

More Recommendation

[Python basics] data type

Floating point number 1. Origin of the name: The floating point number is a decimal number. According to the scientific counting method, the decimal point position is variable, so it is called a float...

Basics of python identifier

A thousand miles begins with a single step. Python is an interpreted language, the language is object-oriented. Identifier: 1.C language, JAVA has an identifier, and there are differences python 2.PYT...

Python Basics - Identifier

Python foundation - identifier Identifier Identifier specification variable name Outward Identifier The identifier is our own name, namely the name of the name. Identifier specification Composed of al...

Day01 ---------- zero java learning Basics (JVM, JRE, JDK, data types, operators, the identifier specification, cast default)

JVM Java virtual machine, referred to as JVM, is a hypothetical computer to run all Java programs, a Java program is one of the operating environment, but also one of the most attractive characteristi...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top