You are on page 1of 1

Q1: Divisible by 2 or 3

Write a program that prints out each number from 2 to 20 and writes whether the
number is divisible by 2 or 3, both, or neither. The output should look like this:

Num Div by 2 and/or 3?


--- ------------------
2 by 2
3 by 3
4 by 2
5 neither
6 both
7 neither
8 by 2
9 by 3
10 by 2
11 neither
12 both
13 neither
14 by 2
15 by 3
16 by 2
17 neither
18 both
19 neither
20 by 2

Q2: First multiple of 7


Write a program that traverses a list of numbers and prints out the first number in the
sequence that is a multiple of 7 (hint: you may want to use a break statement for this)
for the message, “No multiples of 7 found.” if none of the values in the list are multiples
of 7.

Q3. Write a Python program to find those numbers which are divisible by 7 and
multiple of 5, between 1500 and 2700 (both included).

Q4. Write a Python program to convert temperatures to and from celsius, fahrenheit.
[ Formula : c/5 = f-32/9 ]

[ where c = temperature in celsius and f = temperature in fahrenheit ]

You might also like