Computer Science, asked by samarthjain482, 2 months ago

Write a Python program for
to find the numbers that are divisible by 6 from 31 to 60

Answers

Answered by Cosmique
8

To write a program to find and list the numbers that are divisible by 6 from 31 to 60

  • Source C0de will be:

n = list()  

for x in range (31, 60):  

       if (x%6==0):

           n.append(x)  

print( n, "is the list of numbers divisible by 6")  

  • Output produced:

[36, 42, 48, 54] is the list of numbers divisible by 6

  • list() is used to create an empty list.
  • % is used an a remainder operator.
  • == as a relational operator for checking the equality.
  • append() is used to add elements to an exisiting list.
Similar questions