Grandma Ester normally gives you hugs for your birthday - one for every year old you are. When you turned 15, she squished you with 15 hugs!
This year, she, unfortunately, cannot see you on your birthday, so instead, she wants to send you virtual hugs!
Create a program that prompts the user for how old they are turning and then using a loop, output a virtual hug for every year old they are.
The following prints a single "virtual hug."
print("**HUG**")

Respuesta :

Answer:

Written in Python

age = int(input("How old are you? "))

for i in range(1,age+1):

     print("**HUG**")

Explanation:

The first line prompts the user for age

age = int(input("How old are you? "))

The next line is an iteration that starts from 1 till the user input

for i in range(1,age+1):

The last line prints "**HUG**" while the iteration is true

     print("**HUG**")

fichoh

The required program written in python 3 which prints virtual hugs based on the value of age inputted by the user is as follows :

age=int(input('Happy birthday, How old are you: '))

#prompts the user to enter an an integer value for their age

for hug in range(1, age+1):

#for loop loops through the supplied age value

print("**HUG**")

#for each year in the age supplied, **HUG** is displayed.

  • In other to achieve the required number of virtual hugs to be displayed, 1 is added to the age value supplied as the last value in the second range parameter is not inclusive.

Therefore, the output of the working program is attached.

Learn more on python programs:https://brainly.com/question/18732854

Ver imagen fichoh