-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.txt
More file actions
43 lines (26 loc) · 1.89 KB
/
notes.txt
File metadata and controls
43 lines (26 loc) · 1.89 KB
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
module is basicaly the already written content so we don't need tp rewrite the logic, for example if we want to find the harmonic mean then we can directly do it with the help of the module as its already written in it.
python works on repl(read evaluate print and then loop)
triple single quotes semultiple lines print ho sakti haan aur triple double quotes se multiple line comment ho sakti haan
there are 2 types of modules
external and internal
pyttsx3 is the external module for text to speech
input is always string in python sp type cast karna padta ha
string is immutable
new thing came after python 3.6 is:-
print(f"Good Afternoon {name} ")
here we can use the name variable directly inside the " "
strings can't be changed they are immutable but it can be done in lists ..
tupples are immutable
in dictionary difference between dict.get("name") and dic["name"] is that .get give none but the second gives error if the key doesnot exists
s={} will create empty dictionary
e=set() will create empty set
no element can be repeated in set
set are unindexed and unordered
1==1.0 in python because values are same
in keyword is used to find whether a particular string is present or not
for loop with else is also there in python where once the for loop finishes else statements get triggered
pass keyword is used in python to skip that particular part of the code
in file open and close suppose you dont want to everytime write file.close(), so use wwith keyword
No, in Python, the parent class constructor (__init__ method) is not called automatically when a child class object is created. You must explicitly call it.
error raise karna se programm vahi crash ho jata ha
try except ka baad else ma vo piece of code likhta haan jo tabhi execute ho jab try wala code sahi se work kare aur finally ma vo likhta haan jo pakka run hona hi ha chahe error ai ya na ai and mainly its useful in function...