Watched the machine learning in-depth learning video and raided python for several days.
1. Enter 123456 8910 using the while loop
2. Find all sums from 1 to 100.
3. Output all odd numbers from 1-100
4. Output all even numbers from 1-100
5. Find 1-2+3-4+5... The sum of all the numbers of 99
6. User login (three tries)
Programming ideas:
3. Write a code that outputs 1-100 first, add conditions in the middle, and skip until 100 when odd numbers are encountered.
1. job
2. operator
3. basic data types
integer: int
String: str
List: list
Tagged: tuple
Dictionary: Dict
IV.For
enumrat
xrange range
Learn Python these days.
1. Programming language
2、python、c#、java
3、python:pypy,cpython,jpython
4. Execution mode
interpreter
file
5. Develop an interpreter
python xxx.py
./ xxx.py #!/ usr/bin/env.python
6、ascii unicode utf-8
7、
2.7 # -*- coding:utf-8 -*-
3.x Default utf-8
8, variable, refers to
Variable Name = Value
Variable Name Requirements:
a. Numeric letters underlined
B. Numbers cannot begin.
c. Cannot duplicate py keyword
q=a
9. Conditions
If condition, elif condition, else
10、while
while condition
Run it once from top to bottom.
(Judge whether the condition is true) from the top down to execute once
...
...
...
Other content:
1, for loop
The user loops through the contents of an iterable object in order
2、enumerate
Add ordinal numbers to iterable objects
3, range and xrange
Specify range, generate specified number
Basic data types:
integer, int
# n1 = 123
# n2 = 456
# print(n1+n2)
# print(n1.__ add__(n2))
Gets the shortest representable binary number
n = 4
zq = n.bit_length()
print(zq)
String, str