Missing code
Need help with the input code to get the output code: Output: Enter first name: >>> Alex Enter last name: >>> Jones Jones Alex Input: class Student(): def _init_(): self.name = name self.surname = surname print(self.surname) print(self.name) name = input("Enter first name: ") surname = input("Enter last name: ") print(surname) print(name)
8/25/2020 3:48:42 PM
Ashraf Nagy
3 Answers
New AnswerIn your class your __init__() should have the parameters self, name, surname. Then you pass the input arguments when creating a Student object. Also, the __init__() method uses double underscores. class Student(): def __init__(self, name, surname): self.name = name self.surname = surname ... name = input("Enter first name: ") surname = input("Enter last name: ") Student alex = Student(name, surname) https://www.sololearn.com/learn/Python/2467/
Ashraf Nagy Please do not write codes into the thread tags. Just put Python there instead to clarify language context 👍