0% found this document useful (0 votes)
9 views3 pages

Conditional Statements & Loop

assignment of python

Uploaded by

Drstrange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Conditional Statements & Loop

assignment of python

Uploaded by

Drstrange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PYTHON ASSIGNMENT CONDITIONAL STATEMENTS & LOOP

1. Write a Python program to find those numbers which are divisible by 7 and

multiple of 5, between 1500 and 2700 (both included).

2. 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 ]

Expected Output :

60°C is 140 in Fahrenheit

45°F is 7 in Celsius

3. Write a Python program to guess a number between 1 to 9.

Note : User is prompted to enter a guess. If the user guesses wrong then the

prompt appears again until the guess is correct, on successful guess, user will

get a "Well guessed!" message, and the program will exit.

**

***

****

*****

****

***

**

4. Write a Python program to construct the following pattern, using a nested for

loop.

5. Write a Python program that accepts a word from the user and reverse it.

6. Write a Python program to count the number of even and odd numbers from a

Ambuja Foundation
1/561A, Mansarovar Park, GT Road, Shahdara, 110032
series of numbers.

Sample numbers : numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9)

Expected Output :

8802551718 PYTHON CONDITIONAL STATEMENTS & LOOP

PYTHON

PYTHON ASSIGNMENT CONDITIONAL STATEMENTS & LOOP

Number of even numbers : 5

Number of odd numbers : 4

7. Write a Python program that prints each item and its corresponding type from

the following list.

Sample List : datalist = [1452, 11.23, 1+2j, True, 'Python foundation', (0, -1), [5,

12], {"class":'V', "section":'A'}]

8. Write a Python program that prints all the numbers from 0 to 6 except 3 and 6.

Note : Use 'continue' statement.

Expected Output : 0 1 2 4 5

9. Write a Python program to get the Fibonacci series between 0 to 50.

Note : The Fibonacci Sequence is the series of numbers :

0, 1, 1, 2, 3, 5, 8, 13, 21, ....

Every next number is found by adding up the two numbers before it.

Expected Output : 1 1 2 3 5 8 13 21 34

10. Write a Python program which iterates the integers from 1 to 50. For

multiples of three print "Fizz" instead of the number and for the multiples of five

print "Buzz". For numbers which are multiples of both three and five print

"FizzBuzz".

Sample Output :

fizzbuzz

fizz

4
Ambuja Foundation
1/561A, Mansarovar Park, GT Road, Shahdara, 110032
buzz

Ambuja Foundation
1/561A, Mansarovar Park, GT Road, Shahdara, 110032

You might also like