-
Notifications
You must be signed in to change notification settings - Fork 3
/
intro.py
123 lines (88 loc) · 2.56 KB
/
intro.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Data Types - bool,int,float,complex,str,None
"""
Python Basic 3.8.8
Seshanba 14:00
Tutorial file
"""
# print("Hello world!")
# python2 - print "Hello world !"
# python3 - print("Hello world !")
# comment line
# print(input("name ?"))
# Variables
# O'zgaruvchi - kompyuter xotirasidagi katakchalarga olib boruvchi manzil
# def main(x,y):
# print(x,y)
# print(main) # <function main at 0x00000225A76361F0>
# name = "John"
# 1-mantiqan togri nom
# 2-ingliz tilida
# 3-birinchi belgi raqam bolishi mumkin emas
# 4-faqat lotin harflari , sonlar va _ mumkin holos
# userProfileImage = 'src/profile.jpg' # Camel Case
# user_profile_image = 'src/profile.jpg' # Kebab Case
# a = 10
# b = 5
# b = 2
# print(a+b) # 12
# x,y,z = 1,2,3
# print(x+y+z) # 6
# AUTH_USER = 'gandi111'
# AUTH_USER = 'mahatma333'
# print(AUTH_USER)
# import keyword
# print(keyword.kwlist)
# ['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
# Data Types , Data Structure
# bool - True/False
# print(bool(1)) # True
# print(bool("text")) # True
# print(bool("")) # False
# print(bool(0)) # False
# int - 1 ,-1
# x = 10
# y = -5
# z = 2
# print(x+y*z) # 0
# print((x+y)*z) # 10
# float - 1.0 , -1.0
# x = 5
# y = 5.3
# print((x*2) - (x * y)) # -16.5
# print(type(x)) # <class 'int'>
# print(type(y)) # <class 'float'>
# complex - 2n
# age = int(input('Your age ? \n')) # 20
# weight = float(input("Weight ?")) # 78
# # "20"*2 = "2020"
# print(age * 2) # 40
# print(weight) # 78.0
# print(str(age)*5) # 2020202020
# str() - qator , belgilar ketma-ketligi
# s = str(123)
# print(type(s))
# print(s*2)
# print(s/2) # TypeError: unsupported operand type(s) for /: 'str' and 'int'
# print(s-2) # TypeError: unsupported operand type(s) for /: 'str' and 'int'
# print(s+2) # TypeError: can only concatenate str (not "int") to str
# s = """lorem 1"""
# s2 = "lorem 2"
# s3 = 'lorem 3'
# print('user "username" = john')
# print("""user "username" = 'john'""")
# print('don\'t') # don't
# \t - tab
# \n - new line
# \a - system sound
# print("\t\tlorem\n ipsum \a")
# f string
# 1-variant
# var = "f string"
# var2 = "variant 2"
# print("%s" %var) # f string
# #2-variant
# print("{0}/{1}".format(var,var2))
# # 3-variant
# print(f"{var} = {2+2}")
# print(r"\t lorem , \nipsum") # \t lorem , \nipsum
# Data Structure - list,tuple,dict,set,frozenset,bytes,bytearray