Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, i need Python programs for the following questions. Thank you! Python- Iteration for loops 1. Write a program that will display a conversion table

Hi, i need Python programs for the following questions. Thank you!
Python- Iteration for loops
1. Write a program that will display a conversion table from miles to kilometres (1 mile = 1.6 km). Design the programs so that values for miles increase by 5. The table will start with 5 and end with 50 miles. Save your program as ConvertMiles
MILES KILOMETRES
5 8.0
10 16.0
. .
100 160.0
You can use the end parameter in python to help you create the table. Refer to the link below to see how it works!
http://www.geeksforgeeks.org/gfact-50-python-end-parameter-in-print/
2. Write a program that displays the countdown of a rocket (10, 9, ,0) and then says Blast Off! Save your program as CountDown
3. The square numbers are the integers of the form K K, e.g. 9 is a square number since 3 3 = 9. Write a program that reads an integer from input and outputs all the positive square numbers less than n, one per line in increasing order.
Note: The power operator a ** b computes a to the exponent of b. For example, 2 ** 3 produces 8 (which is 222).
sqrt(x) computes the square root of the number x. (You will need to import the math module to use this)
4. 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

More Books

Students also viewed these Databases questions