Self & __init__() (Constructors) | Python Tutorials For Absolute Beginners In Hindi #55

Self & __init__() (Constructors) | Python Tutorials For Absolute Beginners In Hindi #55

CodeWithHarry

5 лет назад

344,319 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Aßhí
Aßhí - 28.07.2023 17:26

Purane videos me Jayda topics cover kre hai abhi wale.python course me nhi kiye cover

Ответить
Prabhakar mehra
Prabhakar mehra - 17.06.2023 23:54

Wow thank you sir

Ответить
Vishesh Gupta
Vishesh Gupta - 08.06.2023 13:04

Thanks Harry Bhai ❤

Ответить
Prashant Sharma
Prashant Sharma - 04.06.2023 21:58

You are amazing at explaining the concepts. Much love to you.🤩

Ответить
random
random - 06.05.2023 08:54

if you havent learned JS constructor function you cant understand this fully , i was same , but now i know what is object its noting but a dictionary (called object in JS , same key value pair ) , when you try to create a object (or instance) in python this create self={ } a empty dictionary then we apply key value pair => you write in dot notation remember self.key=value , and finally the constructor function (in Python _init__() ) return the dictionary (object) to the variable where you called the __init_ ,
IN JS
same things happens uptill now i havent got any class concept in JS but , to create an object in JS we use new operator and this.key=value ....

Ответить
Dev Tewatia
Dev Tewatia - 19.04.2023 19:43

Sir my code is not work even i checked it 4 to 5 times it completely same but not running may you help me to resolve it

Ответить
Rahul Khandapatra
Rahul Khandapatra - 30.03.2023 15:11

what is 'f' that you is written after 'return'

Ответить
Real truth
Real truth - 18.02.2023 13:11

return f gives error. kindly explain.

Ответить
Arshit kale
Arshit kale - 12.02.2023 08:20

Brother attribute error

Ответить
MS Alam
MS Alam - 03.01.2023 15:17

Your way of teaching is unbelievable and so much easy to understand. Thanks for spreading you teaching

Ответить
Kevin Limbasiya
Kevin Limbasiya - 16.11.2022 15:24

Thanks

Ответить
Manoj Rudra
Manoj Rudra - 16.11.2022 14:56

bhai mujhe kuch bhi samajh nhi aata bhir bhi mai aapka video dekhta hu

Ответить
WK Power
WK Power - 10.11.2022 21:43

bhai app ache sarjhate ho but sub ek me hi lipa pota kr dete ho

Ответить
Rakesh Koduri
Rakesh Koduri - 26.10.2022 14:21

Bro i have a issue regarding this.
Type error: employee() takes no arguments

Ответить
Mizan ur Rahman
Mizan ur Rahman - 12.10.2022 16:25

o m maan what a great teaching method

Ответить
ROHAN MORE
ROHAN MORE - 11.10.2022 15:59

Bhai placement hote hi milne aaunga, pata nhi kaha rehte ho but dhund lunga, Thank you man., thank you so much.

Ответить
Ayush Dwivedi
Ayush Dwivedi - 09.10.2022 17:58

I applied f strings but I was not able to see () in place of this I saw green colour normal bracket like we put in a normal quote..anyone help me in this

Ответить
Rahul Srivastava
Rahul Srivastava - 27.09.2022 21:47

Saw 5 videos on the same topic before this. But got clarity only after viewing your video Harry. Great explanation bro. Keep up the good work.

Ответить
Alone Tech
Alone Tech - 25.09.2022 20:41

Bro I have a problem I'll make a python program and he running without any error but output not showing in paydroid3 and jupyter notebook what will I do???????

Ответить
Rahul Rao
Rahul Rao - 13.08.2022 12:16

Most object-oriented programming languages such as Java, C++, C#..etc have the concept of a constructor, a special method that creates and initializes the object when it is created.

Python is a little different it has a constructor and an initializer. The constructor function is rarely used unless you're doing something exotic.

The constructor function in python is called _new_ and _init_ is the initializer function.

Wish you guys the best!

Ответить
Parwaaz Sandhu
Parwaaz Sandhu - 11.08.2022 22:23

instead of constructor what if we can just declare a variable
class Employee:
no_of_leaves =9
name =[]
salary =[]

In one of my codes I wanted to create list or dicts instead of variables, So I used this approach. What about using such approach with Variables

Ответить
somya shukla
somya shukla - 27.07.2022 15:54

Sir notes kaise milenge

Ответить
Rishabh
Rishabh - 05.07.2022 18:18

Awesome explanation bhaiya 😘😘🙏🏻🙏🏻

Ответить
raghavmanish raghavmanish
raghavmanish raghavmanish - 03.07.2022 16:08

enjoyingb this playlist

Ответить
Rohit hcr2
Rohit hcr2 - 30.06.2022 13:11

class student:
def __init__(self,agame,aphone,ahero):
self.game=agame
self.phone=aphone
self.hero=ahero

harry = student("pugb","mi",1)
print(harry.phone)

Ответить
Balraj Borude
Balraj Borude - 26.06.2022 08:14

Great explanation👌👌

Ответить
illwiz
illwiz - 24.06.2022 08:18

not speaking english.. take english video down immediately to stop confusion thanks.

Ответить
AmayVlogs
AmayVlogs - 10.06.2022 13:33

class gamers:
pass

def alldetails(self):
return f"Winner is {self.winner_of_CSGO}, with a prizepool of {self.prizepool}, and a trophy named {self.trophy}"
mahesh = gamers()
atharva = gamers()
rohit = gamers()

mahesh.winner_of_CSGO = "Mahesh securing 1st prize"
mahesh.prizepool = 5000000
mahesh.trophy = " [2022 Series league of CSGO]"

atharva.winner_of_CSGO = "Atharva securing 3rd prize "
atharva.prizepool = 200000
atharva.trophy = " [2021 Series league of CSGO]"

rohit.winner_of_CSGO = " Rohit securing 3rd prize "
rohit.prizepool = 105000
rohit.trophy = " [2020 series league of CSGO]"

print(rohit.alldetails())

Ответить
Mridul Ghosh Shanto
Mridul Ghosh Shanto - 31.05.2022 10:14

Wah harry vhai iyee kiya bat kahii hame to samaz ya gaya.... 😂

Ответить
RohanOf ElvenPower
RohanOf ElvenPower - 23.05.2022 23:59

speak english you trolls

Ответить
FanaticAuthorship
FanaticAuthorship - 22.05.2022 09:13

why did he wrote that "f" after return ?
return f"Name is {self.name}. Salary is {self.salary} and role is {self.role}"

Ответить
Bhawik Verma
Bhawik Verma - 12.05.2022 16:18

Honestly, you just saved me here. I spent 2 days watching videos on repeat and was still getting nowhere. You cleared it out with so ease. Thanks man!!

Ответить
Mayank Arora
Mayank Arora - 29.04.2022 16:40

great video, it helped a lot thankyou :)

Ответить
Taqi Mushaidi
Taqi Mushaidi - 25.04.2022 15:30

Bro, kya kya karty ho waqt barbad karny sy bachnaay k liye aur bookmark aur reminders k ilawa??

Ответить
Shahid Qureshi
Shahid Qureshi - 24.04.2022 14:02

great video

Ответить
Devraj Bhattacharya
Devraj Bhattacharya - 25.03.2022 10:28

thanks harry bhai

Ответить