Small Python School #4
We continue to study Python. In touch "Little school of learning Python", lesson 4.
Course1
The daily rate is 14-15 minutes.
40-54 minute lesson.
Theses:
- There is multiple assignment in programming languages.
- Names have no type. Objects have types.
3.x=y=z=0 - Semicolons are allowed in Python. For compactness of the code. But this is not good.
- One of the important manifestos of the language is the principle of readability, it should be easy to read.
- x,y,x = 1,2,3 card or multiple assignment
- PEP8 - if you want to write public code, follow PEP8
- Carteges are immutable types.
9.T=1,2,3,4,5,6 - a = T[0]
- Elements are numbered from 0
- The first element has index 0
- a,b,*rest = T
- print(T) # (1,2,3,4,5,6)
15.print(*T) - A tuple is an object that contains links. And the type belongs not to the reference, but to the object itself, to which we
we refer. - Type annotation is optional.
- You can nest parameters of different types in a tuple.
- Up to 50 lines, the number of errors is proportional to the number of lines, and then it starts to be out of proportion.
Course2
The daily rate is 1/2-1/3 lessons.
Theses:
- Code naming rules - this is important. Only an underscore as code, the first character cannot be a character. You can start with an underscore. You cannot use keywords.
- The code is case sensitive.
- Variables must convey the meaning of the stored values.
- Capital letters are used very rarely, True False
- You can name a variable even as a single underscore character.
- Capital letters are used to call constants.
- In Python, the underscore style is more common.
- The second style is "camel style", each new word starts with a capital letter.
- It is possible, but highly undesirable, to name Cyrillic variables.
- x = input () - input function
- By default, the input function will accept any input as text.
- Many processes at the processor level are launched when the input function is called. Python is a high-level programming language
- \n break to a new line, if put inside quotes, then the user will enter on a new line input('What's your name\n');
- name, surname = input().split()
- map function - display the action on all elements of some sequence. x,y = map(int,input().split())
16.print('Hello');
First lesson: https://steemit.com/hive-152587/@alexmove.witness/small-python-school-1
Second lesson:
https://steemit.com/hive-152587/@alexmove.witness/small-python-school-2
Third lesson: https://steemit.com/hive-152587/@alexmove.witness/small-python-school-3
Small Python School Support Chat:
https://t.me/+lQtdzunysoxhOTgy
Thanks for studying.
Thank you for your attention.
Have a good day!