OOP Exercise 1 solution : Python tutorial 186

preview_player
Показать описание
Guys please help this channel to reach 20,000 subscribers. I'll keep uploading quality content for you.

Python is easy programming language to learn and anyone can learn it, and these tutorials are 100% free in hindi.

You can share this playlist with your brother, sisters and friends. This will surely add some values to their life.

If you follow this complete playlist of python tutorial surely you will learn everything about python programming language.

This is solution of exercise 1 of oop

Рекомендации по теме
Комментарии
Автор

Bhai sahab you are a hero and my teacher in programming. Thank you so so much.💌💌

vishnujatav
Автор

Jabardast video Sir... Main ab init method samajh paya achhe se.

deepakbharti
Автор

I really appreciate your efforts to make these python tutorials, it is very helpful for me and people like me who are beginners in programing, but i am not able to find the source codes on any of the link shared by you, request you to please share the source code, also the play list do not show all 241 videos, thank you once again to make this easy for us and for tutorials in hindi.

dheerajgeadam
Автор

Hi sir it is very easy:
class Laptop:
def __init__(self, brand, model, price):
self.brand = brand
self.model = model
self.price = price

l1 = Laptop('lenovo', 'AFR', 15000)
print(l1.brand, l1.model, l1.price)

mansoorurrehman
Автор

Harshit bhai mja a jta hai apko video dkh kr

kohinoorteamyogeshchhabra
Автор

File "C:\Users\icon\3D Objects\class.py", line 7, in <module>
a=Laptop("m", "n", 12000)
TypeError: Laptop() takes no arguments
WHY THIS

AK-iexb
Автор

Oh you made it look so simple thanks buddy.

jatinsharma
Автор

Sir 1st say the question for the program to be done and then start it

anandh
Автор

class Laptop:
def __init__(self, brand, model_name, price): # here 'self' is argument & ('brand', 'model_name', 'price') are attributes
self.brand = brand # instance veriables
self.model_name = model_name
self.price = price
self.details = brand + ' ' + model_name + ' ' + str(price)

user_1 = Laptop('HP', 'HP1234', 40000)
user_2 = Laptop('DELL', 'DL9832', 45000)

print(f"USER_1 : {user_1.brand}")
print(f"USER_1 details : {user_1.details}")

print(f"\nUSER_2 : {user_2.brand}")
print(f"USER_2 details : {user_2.details}")

rohanmukherjee
Автор

class laptop:
def __init__(self, name, modelname, price, ram):
self.name=name
self.modelname=modelname
self.price=price
self.ram=ram
def display(self):
print(self.name, self.modelname, self.price, self.ram)



l1=laptop("Hp", "1050x", 73000, "8GB")
l1.display()

surajitmandal
Автор

class Laptop:
def __init__(self, brand_name, model_name, price_i):
self.brand_name = brand_name
self.model_name = model_name
self.price = price_i
self.laptop_name = brand_name + " " + model_name + " " + price_i

Laptop1 = Laptop('Dell', 'E320', '63000')
Laptop2 = Laptop ( 'Lenovo', 'thinkpad', '55000')

print(Laptop1.laptop_name)
print(Laptop2.laptop_name)

AkankshaSachan
Автор

There is an error show while creating object that is Laptop()takes no arguments while I am solving the problem same as in ur video sir
Please help me in order to remove this error

suryaprakash-luxn
Автор

init method define nai kiye toh default constructor chal jaega kya

dragowolfx
Автор

sir after this upload tutorials about django rest framework

NepaliWhitehat
Автор

class Laptop:
def__init__(self, brand, name, price):
self.brand =brand
self.name=name
self.price=price
l1=Laptop('apple', 'aut115', 25000)
print(l1.name)

sir first line m he invalid snytax aa rha h plz bta dijiye kya mistake hai

geetanjaliroutela
Автор

Harshit Bhai Ye batao VS Code me hum other language ke script ko kaise run karenge

ajayverma
Автор

Sir! there is a little bit mistake in video title which appears in the start of video, currently it is :
Python tutorial 185
OOP - Exercise 1
it should be:
Python tutorial 186
OOP - Exercise 1 solution.
Thanks a lot.

zeeshanakram
Автор

class laptop:
def _init_(self, brand, model_name, price):
self.brand=brand
self.name=model_name
self.price=price
laptop1=laptop('hp', 'auxttpd', 65000)
print(laptop1.name)




type error laptop() takes no agruments

shivsrivastava
Автор

bhai mera ye vala aa rha hai jb bhi class bna rha hon laptop1 = Laptop('hp', 'au114tx', 643221)
TypeError: object() takes no parameters

sameerkhan-ezhf
Автор

this code is not working, dont know why,
IndentationError: expected an indented block

class Laptop:
def __init__(self, brand, model, price):
self.brand = brand
self.model = model
self.price = price

l1 = Laptop('HP', '2018', 60000)
l1 = Laptop('lenovo', '2019', 70000)

print(l1.brand)
print(l2.brand)

ExploreBeautyofPakistan