Respuesta :
Answer:
Written in Python:
n = int(input("Days: "))
total = 0
for i in range(1,n+1):
if i <= 10:
total = total + 10
elif i <= 60:
total = total + 40
elif i <= 99:
total = total + 100 - i
print(str(total)+ " widgets")
Explanation:
This line prompts user for number of days
n = int(input("Days: "))
This line initializes total widgets to 0
total = 0
The following iteration calculates the widgets based on the given instruction
for i in range(1,n+1):
if i <= 10: -> When there are less than or equal to 10
total = total + 10
elif i <= 60: -> When there are less than or equal to 10
total = total + 40
elif i <= 99: -> When there are less than 100 days
total = total + 100 - i
This line prints the output
print(str(total)+ " widgets")
The required program written in python 3 is :
n = int(input('Enter the number of days :' ))
#takes in an input from the user
total = 0
#initialize total to 0
if n <= 10 :
#if statement input is less than or equal to 10
total = 10*n
# set total to 10 multiplied by the input value
elif n<=60 and n>10:
total = (10*10)+(40*(n-10))
else :
t = n - 60
total = (10*10)+(50*40)+(40-t)
print(total)
#output the total value.
- n = number of days entered by the user, to calculate the total number of widgets available that day.
- t = number of days beyond 60 days.
- total = variable which gives the total number of widgets on a certain day. It is initialized as 0.
- First if statement uses the condition given for the number of widgets produced in the first 10 days.
- The elif statement gives the condition for days which falls between 11 and 60 (11 and 60 inclusive).
- else condition gives the total number of widgets for days above 60.
Learn more : https://brainly.com/question/15061375