Computer scienceProgramming languagesPythonObject-oriented programmingMethods

Methods and attributes

User

Report a typo

Create the User class that has two methods: __init__ and user_information. The __init__ method should define four attributes: name, surname, age and country, while user_information should print the following message:

{name} {surname} is {age} years old and lives in {country}.

Name, surname, age, and country will be provided as input. Process input, create an instance of the class, and call the user_information method.

Sample Input 1:

John
Smith
25
the USA

Sample Output 1:

John Smith is 25 years old and lives in the USA.
Write a program in Python 3





___

Create a free account to access the full topic