The program does not consists of any syntax error but the module contains error in logic especially while placing the condition inside if statement.
Here we are actually planning to check whether the number passed in the “value” variable is within the given lower and upper range which is passed in second and third parameter.
Solution 1:
if value<=lower AND value>=upper Then
Display “The given number is outside the specified range.”
else
Display “The given number is within the specified range.”
End if
Alternate solution:
So for that the condition needs to be value>=lower and value <=lower. so
if value > lower AND value <upper Then
Display “The given number is within the specified range.”
else
Display “The given number is within the specified range.”
Apple uses social media to promote their products and increase user-engagement. This is a very effective method of advertising.
No it will actually help it
Answer:
count = 0
months = 0
years = int(input("Enter the number of years: "))
for year in range(1, years+1):
cars_sold = int(input("Enter the number of cars sold in first six months: "))
count += cars_sold
months += 6
print("Number of months: " + str(months))
print("Number of cars sold in total: " + str(count))
print("Average number of cars sold per month: " + str(count / months))
Explanation:
Initialize the variables
Ask the user for the number of years
Create a for loop that iterates depending on the given number of years
Ask the user for the number of cars sold in the first six months of the year
Increment the count by given number and increment the months by 6 after each iteration
Print the months, count and, average