0% found this document useful (0 votes)
20 views1 page

Class06 Python Homework

python

Uploaded by

alexzhang
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)
20 views1 page

Class06 Python Homework

python

Uploaded by

alexzhang
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/ 1

Looping - Home Work

1. Write a program that will output the line of text “I love Programming”, 10
times.

2. Write a program that will output the seven times table, as follows:
1 x 7 = 7
2 x 7 = 14
3 x 7 = 21 . . .

3. Write a program that will ask the user for a value and then print out the
tables for the inputted value.

4. Develop a program that will display to the screen the first 20 numbers,
with their squares and cubes, as follows:
1 1 1
2 4 8
3 9 27 .
.

5. Write a program using a FOR loop to print a conversion table showing


values in miles and the corresponding values in kilometers for mile values
ranging from 1 to 25. Please note that 1 mile = 1.61 km. A sample output
should read as follows:

Miles Kilometres
1 1.61
2 3.22
.
.
.
25 40.25

6. Write a program that will prompt the user to 6 numbers and then print the
number of positive numbers and the sum of negative numbers in the set.

7. Write a program to read 6 numbers and find the average of all odd numbers.

8. Write a program that will prompt the user to enter 5 numbers and then
print the smallest and largest number to the screen.

You might also like