Using import sys : Create a python program called classname.py. The program should define a class called person that has one method called hello, and one attribute called name, which represents the name of the person.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 9RQ
icon
Related questions
Question

Using import sys : Create a python program called classname.py. The program should define a class
called person that has one method called hello, and one attribute called name,
which represents the name of the person.

classname.py
• Create a program called classname.py. The program should define a class
called person that has one method called hello, and one attribute called name,
which represents the name of the person.
• The hello method should print the following string to the screen:
'My name is
and I am a
where:
o The first blank should be the name attribute
o The second blank should be the name of the class
o The above blanks should NOT be manually printed (ex. print('My name is
Greg and I am a person'))
• After defining the class, there are three things you must do:
1. Instantiate an object of the class
2. Run the hello method of the instantiated object
a. (e.g., Greg.hello())
3. For grading purposes, you must also print the name of the class so I can be sure
you've created a class
a. (The expected output is <class'_main_.person'>)
Transcribed Image Text:classname.py • Create a program called classname.py. The program should define a class called person that has one method called hello, and one attribute called name, which represents the name of the person. • The hello method should print the following string to the screen: 'My name is and I am a where: o The first blank should be the name attribute o The second blank should be the name of the class o The above blanks should NOT be manually printed (ex. print('My name is Greg and I am a person')) • After defining the class, there are three things you must do: 1. Instantiate an object of the class 2. Run the hello method of the instantiated object a. (e.g., Greg.hello()) 3. For grading purposes, you must also print the name of the class so I can be sure you've created a class a. (The expected output is <class'_main_.person'>)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT