Coding Exercise for Beginners in Python with solution | Exercise 26 | Python for Beginners #lec88

preview_player
Показать описание
In this lecture we have written a Python Program to find out Area and Circumference of a Circle using Class and Objects(OOP concepts)

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #codingquestions #python #pythonforbeginners #jennyslectures
Рекомендации по теме
Комментарии
Автор

After watching your OOP's videos lecture, I am able to write code by myself and m feeling so confident. A million thanks to you. Thanks for shaping my knowledge.

rupayadav
Автор

class rectangle:
def __init__(self, width, length):
self.width=width
self.length=length
def area(self):
return self.width*self.length
a=int(input("Enter length of rectangle: "))
b=int(input("Enter breadth of rectangle: "))

rectangle_1=rectangle(a, b)
print(f"the area of rectangle :{rectangle_1.area()}")

chilkurisasenderreddy
Автор

class Rectangle:
def __init__(self, length, breadth) -> None:
self.rectLength = length
self.rectBreadth = breadth

def rectArea(self):
return self.rectLength * self.rectBreadth

rect1 = Rectangle(int(input("Length: ")), int(input("Breadth: ")))
print("Area: ", rect1.rectArea())

Thankyou so much mam, you are helping us understand so so so clearly! Thanks a lot!

sowbaranikag
Автор

Having watched your Python video lectures, I now feel confident in writing code independently. I want to express my gratitude for your guidance. Thank you so much for your valuable teachings.

ayeshawaheed
Автор

class rectangle:
def __init__(self, height, width):
self.Height=height
self.Width=width
self.area=self.Height * self.Width

height of the rectangle:")), int(input("Enter width of the rectangle:")))
print(rectangle_1.area)

white-hat
Автор

The best OOP tutorial every, simplified and very clear explanation.

flipdruid
Автор

class Rectangle:
def __init__(self, base, height):
self.base = base
self.height = height

def area(self):
return self.base * self.height


rectangle_1 = Rectangle(10, 4)
print(rectangle_1.area())

devSackey
Автор

class Rectangle:
def __init__(self, length, breadth): # l=5, b=4
self.length = length
self.breadth = breadth
def area(self):
return self.length*self.breadth

print(Rectangle(5, 4).area())

tharunteja
Автор

class rectangle():
l= 50
b= 30
def __init__(self):
self.area_rec= 2* (self.l + self.b)
area_rectangle= rectangle()

rakeshrajmandala
Автор

class Rectangle:
def __init__(self, length, breadth):
self.length = length
self.breadth = breadth

def area(self):
return self.length * self.breadth


area_of_rectangle = Rectangle(4, 5)
print('Area of rectangle:', area_of_rectangle.area(), 'sq.units')

prakulhn
Автор

Practice is important in coding journey.

futureboy
Автор

class area:
def __init__(self, radius):
pie=3.14
self.radius=radius
self.areaa=pie*radius**2
self.circum=2*pie*radius
area1=area(14)
print(area1.areaa)
print(area1.circum)

SindhujaReddy-gwfo
Автор

class Rectangle:
def __init__(self, length, width):
self.length=length
self.width=width
def area(self):
Area=self.length*self.width
return Area

rectangle_1=Rectangle(5, 10)
rectangle_2=Rectangle(5, 20)
rectangle_3=Rectangle(5, 30)
print(rectangle_1.area())

priyangsagar
Автор

class rectangle:
def __init__(self, length, width):
self.length=length
self.width=width
def get_area_of_rectangle(self):
return self.length * self.width

rectangle_1=rectangle(4, 5)
print(f'The area of rectangle is:

This Python code defines a class named rectangle that represents a rectangle. The class has two methods:

__init__(self, length, width): This is the constructor method that’s called when you create a new instance of the class. It takes two parameters - length and width, and assigns them to the instance variables self.length and self.width.
get_area_of_rectangle(self): This method calculates the area of the rectangle by multiplying the length and width of the rectangle (self.length * self.width).
After defining the class, the code creates an instance of the rectangle class with length 4 and width 5 (rectangle_1 = rectangle(4, 5)).

Finally, it prints the area of rectangle_1 by calling the get_area_of_rectangle method

So, if you run this code, it will print: The area of rectangle is: 20, because the area of a rectangle with length 4 and width 5 is 20 (4*5).

muneebbolo
Автор

class Rectangle:
def __init__(self, l, b):
self.l=l
self.b=b
def area_of_rectangele(self):
return self.l*self.b
def circum_of_rectangle(self):
return (2*self.l)+(2*self.b)
rect1=Rectangle(2, 4)
print(f"Area of Rectangle is
print(f"Circumference of Rectangle is

damulurimanikanta
Автор

Mam plzz make a playlist of Core java plzz mam plzzz....its huge request

shivanijha
Автор

Excellent explanation. Thanks you very much for giving this valuable knowledge. love from srilanka

ktjjkfc
Автор

Area of rectangle:

class Area:
def __init__(self, length, breadth):
self.length = length
self.breadth = breadth
self.final_area = self.length * self.breadth
def display(self):
print(f"The area of rectangle is {self.final_area}")


object_1 = Area(4, 3)
object_1.display()

telugutechcorner
Автор

East or west jenny madam is the best🎉 for python

vaibhavpatharkar
Автор

class rectangle:
l=3
b=7
def __init__(self):

object=rectangle()
print(object.area)

alaganijagadeesh
join shbcf.ru