Skip to content

Commit 82a4a57

Browse files
lesson 02
1 parent fcbfe7c commit 82a4a57

File tree

6 files changed

+99
-0
lines changed

6 files changed

+99
-0
lines changed

lesson_02/escape_symb.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
\n
3+
\t
4+
\b
5+
\"
6+
\'
7+
\\
8+
"""

lesson_02/formating_output.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tmp = 'User name: %s %s'
2+
name = input('Please enter user name: ')
3+
sur_name = input('Please enter user sur name: ')
4+
print(tmp % (name, sur_name))

lesson_02/func_input.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# input()
2+
3+
a = input('Please enter a number (1-100): ')
4+
print(a)
5+
print(type(a))
6+
7+
# int()
8+
# b = int(a)
9+
# print(b, type(b))
10+
11+
# float()
12+
c = float(a)
13+
print(c, type(c))

lesson_02/func_print.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
print('Some text')
2+
print(45)
3+
print(34.4)
4+
5+
print('Text', 56, 78.2)
6+
7+
# end
8+
# sep
9+
10+
print('Text', 56, 78.2, sep=' <-> ')
11+
print('Some text', end=' ')
12+
print(45, end=' ')
13+
print(34.4)

lesson_02/type_of_data.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# int
2+
a = 347856432789563478652347896534786543792563478563427563456234567351759463756347856856
3+
print(a ** 2)
4+
print(type(a))
5+
6+
print(0b010101001)
7+
print(0o125326531)
8+
print(0x345ABCDEF)
9+
10+
# float
11+
print(0.1 + 0.1 + 0.1)
12+
# min 2.23e-308 2.23 * 10 ^ -308
13+
# max 1.79e+308 1.79 * 10 ^ +308
14+
15+
a = 3 ** 1000
16+
print(a)
17+
# b = a + 0.1
18+
print(type(3.14))
19+
20+
# complex
21+
a = (4 + 5j)
22+
print(type(a))
23+
24+
# bool
25+
a = True
26+
b = False
27+
print(type(a), type(b))
28+
29+
# str
30+
a = 'reutyuiowert'
31+
b = "utyoewiuyr"
32+
print(type(a), type(b))
33+
34+
a = """
35+
eruiyteruiogfkljds
36+
;lguher;oiqgue
37+
rekowgherhueriopgf
38+
5474iohcv28o074ytpf
39+
vihuorwyg45t9p34
40+
"""
41+
print(a)
42+
print(type(a))
43+
44+
print(print.__doc__)

lesson_02/variables.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
print(56)
2+
3+
# print = 6
4+
# print(78)
5+
6+
a = 6
7+
a = b = c = 0
8+
a, b, c = 4, 5, 6
9+
10+
x = 7
11+
y = 8
12+
tmp = x
13+
x = y
14+
y = tmp
15+
x, y = y, x
16+
17+

0 commit comments

Comments
 (0)