Exercise 3.5.6: Introduce Yourself, Part 25 points
Write a program that:

stores your name in one variable called name
stores your age in another variable called age
prints a one-line greeting that includes your name and your age.
Your program should output something like this:

Hi! My name is Arthur and I am 62 years old.
Hint: Do not get user input for the values of name and age but instead simply save these values inside your program as static variables, or variables that do not change value.

(This is for python code someone help)

Respuesta :

tanoli

Answer:

Explanation:

Python Code

class Example:

   name="Usman Ali"

   age="28";

print "Hi! My name is ",Example.name," and i am ",Example.age," years old"

Code Explanation:

First declare a class Example and add 2 static variables as name and age.

And after that add print statement to show the appropriate output.

Note. Variables define after class declartion are considered as Static variable. If you want to define instance variable associated with Object or that class you need to write those instance under def __init__() method.

Code Output

Hi! My name is Usman Ali and i am 28 years old

The program is an illustration of a sequential program, and it does not require loops, iterations or conditions.

The program in Python, where comments are used to explain each line is as follows:

#This initializes the name

name = "Arthur"

#This initializes the age

age = 62

#This prints a one-line greeting that includes the name and age

print("Hi! My name is",name,"and I am",age,"years old.")

Read more about similar programs at:

https://brainly.com/question/16127677

ACCESS MORE
EDU ACCESS
Universidad de Mexico