Starting from:

$30

IT210- Fundamentals of Programming Lab 1 Solved

This is your first Python program for this class. Start by typing in the following simple program (including the mments). You can use either Spyder or SciTE to create and edit this program. If you use Spyder, edit your program in the window on the left. You can safely remove the lines that the editor provides by default. When you run it, you will interact with it in the window on the lower right.

# Your name

# First programming assignment — convert pounds to other units of weight

# Note that the input
function always give a string
IbsStr = input ( "Enter
the number of pounds .
lbs = float (IbsStr) #
Convert the string to a float
# compute other uni ts
of weight
# Get input in pounds

ozs = lbs * 16 tons — — lbs / 2000.

# output the results of the calculation print ( ) # Prints a blank line print (lbs, "pounds is the same as : ") print (ozs , " ounces " ) print (tons , tons t')

wr program will be named Lab01.py .

Test your program. Add Python code to this program to also show the weight in stones and kilograms. You will submit the Lab01.py file to the D2L drop box. This drop box will close at 1 minute before midnight tonight. Most students should be able to finish this assignment in class.

Two sample runs of the program with the specified changes are shown below. Misspelled words in the user interface are UGLY.

Enter the number of pounds: 2000 Enter the number of pounds:

2000.0 pounds is the same as:3.5 pounds is the same as:

32ØØØ.Ø ounces56.0 ounces

1.0 tons0.00175 tons

142.85719999999998 stones0.2500001 stones

907.184 kilograms1.587572 kilograms

More products