0
classes
The provided code defines a Student class, creates a Student object, and calls its greet() method. However, the code has an error and does not run. Fix the code to produce the expected output. class Student: def __init__(self, name): self.name = name def greet(): print(self.name+" says hi") obj = Student("John") obj.greet() Can anybody help me out there...?
4 Answers
+ 3
I did this to cut the other def
class Student:
def __init__(self, name):
self.name = name
self.x = self.name+" says hi"
obj = Student("John")
print(obj.x)
+ 2
just change
def greet() -----into ----> def greet(self)
# celebrate it must work well
0
Hello Friends Sell Back College Books is a place for college students to sell their books easily and at affordable prices. We want to make it easy for students to sell books they no longer need https://www.resumehelpservices.com/velvetjobs-com-review/ but don't have a place to store. But velvetjobs make this platform easy for you to buy books in careers. You can also buy the book for yourself from
0
This will surely work without a doubt, using only 3 lines
name = input()
lvl = input()
print(name + "(Level " + lvl + ")")