Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Class013_Python_Homework

The document outlines a Python class homework assignment consisting of five programming tasks. These tasks include creating a power calculator, a kilogram to pound converter, a division calculator, a total coin value calculator, and a program to sum the digits of a three-digit number. Each task specifies user input requirements and expected output formats.

Uploaded by

blue10solar
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)
4 views

Class013_Python_Homework

The document outlines a Python class homework assignment consisting of five programming tasks. These tasks include creating a power calculator, a kilogram to pound converter, a division calculator, a total coin value calculator, and a program to sum the digits of a three-digit number. Each task specifies user input requirements and expected output formats.

Uploaded by

blue10solar
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/ 2

Python class 03 homework

1.
Create a power calculator. (A calculator that calculates powers/exponents) The program should first ask
the user for a number to be the base, and then ask for another number to be the exponent, and then
output the result of the power.

Sample Output:

2.
Create a kilogram to pound converter. The program should ask the user for an amount in kilograms and
output to the user the equivalent amount in pounds.
Note: Use the conversion factor of: 1 kg = 2.20462 lb

Sample Output:

3.
Create a division calculator. (A calculator that only does dividing!) The program should ask the user for 2
numbers (ask one at a time), and then output the result of the first number divided by the second
number. You will show the result of the division in 2 different ways:

● Show the decimal result of the division. (eg. 5 / 2 = 2.5)


● Show the whole number result of the division along with the remainder. (eg. 5 / 2 = 2 with a
remainder of 1)

Sample Output:
4.
Create a total coin value calculator! This program will ask the user how many of each type of coin he/she
has and calculate the total amount of cash for the user.

Note:
A toonie is 2 dollars
A loonie is 1 dollar
A quarter is 25 cents
A dime is 10 cents
A nickel is 5 cents
A cent is …. We don’t use cents anymore!

Sample Output:

Bonus points if you can get your result to always be formatted to show 2 decimal places.

5.
Write a program that asks the user to input a 3 digit number, then output the sum of the 3 individual
digits in that number.
(eg. 658, sum of the digits is 6+5+8 = 19)
(eg. 418, sum of the digits is 4+1+8 = 13)

Sample Output:

You might also like