0

Do not print

Hi guys, do you know what's wrong with this code, that it doesn't call me back? It's not wrong I just don't have the answer. https://code.sololearn.com/cbyh6KH0s3FX class Student(): name= "Pedro" age = "22" def __str__(self): print("My name is", "" , self.name, self.age) student = Student() Milion thanks

27th Apr 2022, 11:30 AM
Rayane Oliveira
Rayane Oliveira - avatar
3 Antworten
+ 2
Put the relevant programming language in tag section, not user names. Please put your code in a script on sololearn playground and link it. You did not call the method: student.__str__()
27th Apr 2022, 11:33 AM
Lisa
Lisa - avatar
+ 2
https://code.sololearn.com/c6GcP8YF2vTT/?ref=app instead of str its init (short for inititialize )
27th Apr 2022, 12:16 PM
Raul Ramirez
Raul Ramirez - avatar
+ 1
Lisa, it has worked :) Thank you
27th Apr 2022, 12:17 PM
Rayane Oliveira
Rayane Oliveira - avatar