'''create Two variables a and b Create a function called add, sub, multiplication, or division all functions should take 2 variables as parameters Pass the a and b values through the object(). ''' class calculator: def __init__(self,a,b): self.first_value=a self.second_value=b def added(self): print(f"The value of first {self.first_value} and the second value {self.second_value} and the addition of first and second value : {self.first_value+ self.second_value}") def subtract(self): print(f"The value of first {self.first_value} and the second value {self.second_value} and the subtraction of first and second value : {self.first_value - self.second_value}") def multiptly(self): print(f"The value of first {self.first_value} and the second value {self.second_value} and the mutliplication of first and second value : {self.first_value * self.second_value}") def divi(self): print(f"The value of first {self.first_value} and the second value {self.second_value} and the division of first and second value : {self.first_value / self.second_value}") addition=calculator(3,4) addition.added() subtraction=calculator(12,34) subtraction.subtract() multiplication=calculator(4,67) multiplication.multiptly() division=calculator(36,6) division.divi()
#Q4 Create a class called calculator #Create 2 variables a and b #Create a function called add, sub, mul, div all functions should take 2 variables as parameter #Pass the a and b value through object class calculator: def __init__(self,a,b): self.a=a self.b=b
def add(self): sum= self.a+self.b print("Sum is ", sum) def sub(self): diff= self.a-self.b print("Difference is ", diff) def mul(self): prod= self.a*self.b print("Product is ", prod) def div(self): div= self.a/self.b print("Division is ", div) num1= int(input("Enter the first value : ")) num2= int(input("Enter the second value : ")) calci=calculator(num1, num2) calci.add() calci.sub() calci.mul() calci.div()
'''5)create a class called teacher Create a variable = name and registry number using constructor. Create a function called display which should display the name and registry number of the teacher Create t1 and t2 object and pass the name and reg no value through object. ''' class teacher: def __init__(self,name,registry): #arguments or variables self.real_name=name #class instance self.register_number=registry def display(self): print(f"The Teacher name is {self.real_name} and his/her registered number is {self.register_number}") #created a object pass the arguments t1=teacher("LALLY","9523") t1.display() print(" ") t2=teacher("swathi","9056") t2.display()
class Fruit: def __int__(self): self.color = "red" apple = Fruit() print(apple.color) AttributeError: 'Fruit' object has no attribute 'color' please explain
Bro it is right or wrong class calculator(): def __init__(self,a,b): self.add=a+b self.sub=a-b self.mul=a*b self.div=a/b def display (self): print("addition:",self.add) print("subract:",self.sub) print("multiple:",self.mul) print("division:",self.div) operate=calculator(int(input()),int(input())) operate.display()
The way of our teaching is awesome please post many videos for python learners... Your teaching is becomes to easy understanding... Thankyou so much🎉
a = int(input("enter the first number: "))
b = int(input("enter the second number: "))
class cal:
def __init__ (self,a,b):
self.num1= a
self.num2= b
def add(self):
print("add: ", self.num1+self.num2)
def sub(self):
print("Sub: ",self.num1-self.num2)
def mul(self):
print("Mult: ",self.num1*self.num2)
def div(self):
print("Div: ",self.num1/self.num2)
obj = cal(a,b)
obj.add()
obj.sub()
obj.mul()
obj.div()
Excellent teaching bro ...I searched many videos for learning python...And I finally found that...Very much Tnx bro...
Bro, Really thanks a lot . Now I am using python in my office for automation. Your TH-cam course is help me a lot… once again thank you so much ❤❤❤❤❤
Glad to hear that
your video is useful of the python learners then easy to understand of the your videos
Thanks a lot
'''create Two variables a and b
Create a function called add, sub, multiplication, or division all functions should take 2 variables as parameters
Pass the a and b values through the object().
'''
class calculator:
def __init__(self,a,b):
self.first_value=a
self.second_value=b
def added(self):
print(f"The value of first {self.first_value} and the second value {self.second_value} and the addition of first and second value : {self.first_value+ self.second_value}")
def subtract(self):
print(f"The value of first {self.first_value} and the second value {self.second_value} and the subtraction of first and second value : {self.first_value - self.second_value}")
def multiptly(self):
print(f"The value of first {self.first_value} and the second value {self.second_value} and the mutliplication of first and second value : {self.first_value * self.second_value}")
def divi(self):
print(f"The value of first {self.first_value} and the second value {self.second_value} and the division of first and second value : {self.first_value / self.second_value}")
addition=calculator(3,4)
addition.added()
subtraction=calculator(12,34)
subtraction.subtract()
multiplication=calculator(4,67)
multiplication.multiptly()
division=calculator(36,6)
division.divi()
Excellent teaching bro i understood😇
create a class called calculator:
class calculator:
def __init__(self, h, n):
self.num1=h
self.num2=n
def calc(self):
print("Added: ", self.num1+self.num2)
print("Subracted: ", self.num1-self.num2)
print("Mutiplied: ", self.num1*self.num2)
print("Divided: ", self.num1/self.num2)
k=int(input("Enter 1st number: "))
l=int(input("Enter 2nd number: "))
total=calculator(k, l)
total.calc()
Thalaiva... you are great ❤
videos la letters la clear ah terila bro,yr teaching is very good
class calculator :
def __init__ (self,a,b):
self.add=a+b
self.sum=a-b
self.mul=a*b
self.div=a/b
def display (self) :
print(self.add)
print(self.sum)
print(self.mul)
print(self.div)
s1=calculator(10,5)
s1.display()
Neega vera level bro
Q4:
class calculator:
def __init__(self,a,b):
self.a=a
self.b=b
def add(self):
print("Add = ",self.a+self.b)
def sub(self):
print("Sub = ",self.a-self.b)
def multi(self):
print("Multi = ",self.a*self.b)
def divi(self):
print("Divi = ",self.a/self.b)
x=calculator(10,2)
x.add()
x.sub()
x.multi()
x.divi()
Answer:
Add = 12
Sub = 8
Multi = 20
Divi = 5.0
#Q4 Create a class called calculator
#Create 2 variables a and b
#Create a function called add, sub, mul, div all functions should take 2 variables as parameter
#Pass the a and b value through object
class calculator:
def __init__(self,a,b):
self.a=a
self.b=b
def add(self):
sum= self.a+self.b
print("Sum is ", sum)
def sub(self):
diff= self.a-self.b
print("Difference is ", diff)
def mul(self):
prod= self.a*self.b
print("Product is ", prod)
def div(self):
div= self.a/self.b
print("Division is ", div)
num1= int(input("Enter the first value : "))
num2= int(input("Enter the second value : "))
calci=calculator(num1, num2)
calci.add()
calci.sub()
calci.mul()
calci.div()
'''5)create a class called teacher
Create a variable = name and registry number using constructor.
Create a function called display which should display the name and registry number of the teacher
Create t1 and t2 object and pass the name and reg no value through object.
'''
class teacher:
def __init__(self,name,registry): #arguments or variables
self.real_name=name #class instance
self.register_number=registry
def display(self):
print(f"The Teacher name is {self.real_name} and his/her registered number is {self.register_number}")
#created a object pass the arguments
t1=teacher("LALLY","9523")
t1.display()
print("
")
t2=teacher("swathi","9056")
t2.display()
Html and css upload panuga
Bro short ah explain pannunga romba deep ah poguthu
Thank you brother
class Calculator:
def __init__(self,a,b):
self.a=a
self.b=b
def add(self):
print("Add",self.a+self.b)
def sub(self):
print("Sub",self.a-self.b)
def mul(self):
print("Mul",self.a*self.b)
def div(self):
print("Div",self.a/self.b)
num=Calculator(2,4)
num.add()
num.sub()
num.mul()
num.div()
super
num1=int(input("Enter the first number: "))
num2=int(input("Enter the sec number: "))
class calculator:
def __init__(self,num1,num2):
self.add=num1+num2
self.sub=num1-num2
self.mul=num1*num2
self.div=num1/num2
def display(self):
print("Addition: ",self.add)
print("Subraction: ",self.sub)
print("Multiplication: ",self.mul)
print("Division: ",self.div)
sum1=calculator(num1,num2)
sum1.display()
class Fruit:
def __int__(self):
self.color = "red"
apple = Fruit()
print(apple.color)
AttributeError: 'Fruit' object has no attribute 'color'
please explain
Innoru function create pannanum pro athu ulla print la kodukanum
def __init__(self): right
def __int__(self): wrong
int is wrong ❌
init is correct ✅
Pause&Play: class calculator:
def __init__(self,a,b):
self.a=a
self.b=b
def add(self):
result=self.a + self.b
print('Addtion is :', result)
def sub(self):
result=self.a - self.b
print('Subtraction is :', result)
def mul(self):
result=self.a * self.b
print('Multiplication is :', result)
def div(self):
result=self.a / self.b
print('Division is :', result)
user=calculator(5,6)
user.add()
user.sub()
user.mul()
user.div()
Bro it is right or wrong
class calculator():
def __init__(self,a,b):
self.add=a+b
self.sub=a-b
self.mul=a*b
self.div=a/b
def display (self):
print("addition:",self.add)
print("subract:",self.sub)
print("multiple:",self.mul)
print("division:",self.div)
operate=calculator(int(input()),int(input()))
operate.display()
Ithula user ta irunthu input vangi atha epadi intha object vachi function kulla call panrathu bro
bro i have one doubt class name need to follow the pascal case ?? is it necessary because in your videos your not using that in class name
enum extra python new new information solunga
It is showing error for me if I gave parameter
Python na yenna bro
Athu oru type of snake bro Amazon kaatla irukum😌
Python is a programming language which is used to communicate with computer and there are many programming languages like Java,c++, HTML etc..
Pause&Play: class teacher:
def __init__(self,name,reg):
self.name=name
self.registernumber=reg
def display(self):
print("Name:",self.name)
print("registernumber: ", self.registernumber)
t1=teacher("Rohit",1)
t2=teacher("Sam",2)
t1.display()
t2.display()