hi please help me to identify the error . Class Triangle: definit(self,base,height):…
Jump to turn (10)
- 1hi please help me to identify the error . Class Triangle: definit(self,base,heig
- 2hi, im not getting the expected output from using the corrected code
- 3im using this code to get an output of choice to calculate area or perimeter but
- 4how to import math on python. please help me
- 5#Create a new class called Circle #Create its constructor #Its instance variable
- 6hi please help me.#Create a new class called Circle #Create its constructor #Its
- 7#Create a new class called Circle #Create its constructor #Its instance variable
- 8what's the value for the base
- 9even im entered this code:class Circle: definit(self,radius): self.radius = radi
- 10i'm running this code but it gives me syntax error, please help me.class Circle:
- User
hi please help me to identify the error . Class Triangle: def_init_(self,base,height): self.base=base self.height=height
codedef calc_area(self): return(self.base*self.height) def calc_peri(self): return((self.base *2)+(self.height *2)) - Assistant
The error is that there is a syntax error in the first line of the code. The correct syntax to define a class is "class Classname:", but in this case, there is a "_" missing between "def" and "init".
The corrected code is:
class Triangle: def init(self,base,height): self.base=base self.height=height
codedef calc_area(self): return(self.base*self.height) def calc_peri(self): return((self.base *2)+(self.height *2))