+ 2
Regarding Class
Please help me with the following code. Fill in the blanks to create a class with a method sayHi(). class Student def __init__(self, name): self.name = name sayHi( ): print("Hi from "+ .name) s1 = Student("Amy") s1.sayHi()
2 Réponses
+ 9
class Student:
def __init__(self, name):
self.name = name
def sayHi(self):
print("Hi from " + self.name)
s1 = Student("Amy")
s1.sayHi()
0
class student:
def__init__(self,name):
self.name=name
def say Hi(self):
print ("Hi from" + self.name)
s1 = student("Amy")
s1 = sayHi()