Python- Iteration for loop,Iteration while loops Solution.DOCX

Python- Iteration for loop,Iteration while loops Solution

Python- Iteration for loop

1. If a × b = n, we call a × b a factorization of n. In this exercise, write a program that takes a positive integer from input, and then outputs all factorizations of n; you should follow the formatting given by the following example for n=10.

1 times 10 equals 10
2 times 5 equals 10
5 times 2 equals 10
10 times 1 equals 10

Python- Iteration while loops

1. Write a Python program to find and print those numbers which are divisible by 7 and multiples of 5, between 1500 and 2700 inclusive.

2. Write a Python program which iterates the integers from 1 to 50. For multiples of three print "Bizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "BizzBuzz" otherwise print the number itself.

3. Write a Python program that asks the user to guess a number between 1 to 9. The program should generate a random number between 1 and 9. The 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.

Note: To generate a random number, import random.
randint(a, b) will generate a random number between a and b, inclusive
Powered by