On Python
Ask the user to input a min and a max value for a range of numbers. Then use range(min, max) to:
a) Loop through the range specified by the user and find all the numbers that are divisible by 3 and print them.
b) Loop through the range and find only the first multiple of 3 and print it.
# Question 1
min = int(input("Enter min: ")) max = int(input("Enter max: ")) for x in range(min, max): if x%3==0: print(x)
#######################################
# Question 2 min = int(input("Enter min: ")) max = int(input("Enter max: ")) for x in range(min, max): if x%3==0: print(x) break
Get Answers For Free
Most questions answered within 1 hours.