123 def convert_kg(value): | # Your code starts here 456 co 7 def convert_pounds (value): # Your code starts here def convert_ounces (value): # Your code starts here 8 9 10 11 12 13 if 14 15 16 17 18 name main # Test your code here # convert_kg (10) # convert_pounds (10) # convert_ounces (10) 19 20

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter9: Formula Auditing, Data Validation, And Complex Problem Solving
Section: Chapter Questions
Problem 5EYK
icon
Related questions
Question

Scenario

You work for a small company that exports artisan chocolate. Although you measure your products in kilograms, you often get orders in both pounds and ounces. You have decided that rather than have to look up conversions all the time, you could use Python code to take inputs to make conversions between the different units of measurement.

You will write three blocks of code. The first will convert kilograms to pounds and ounces. The second will convert pounds to kilograms and ounces. The third will convert ounces to kilograms and pounds.

The conversions are as follows:

  • 1 kilogram = 35.274 ounces
  • 1 kilogram = 2.20462 pounds
  • 1 pound = 0.453592 kilograms
  • 1 pound = 16 ounces
  • 1 ounce = 0.0283 kilograms
  • 1 ounce = 0.0625 pounds

For the purposes of this activity the template for a function has been provided. You have not yet covered functions in the course, but they are a way of reusing code. Like a Python script, a function can have zero or more parameters. In the code window you will see three functions defined as def convert_kg(value):, def convert_pounds(value):, and def convert_ounces(value):. Each function will have a block showing you where to place your code.

 

123
def convert_kg(value):
|
# Your code starts here
456 co
7
def convert_pounds (value):
# Your code starts here
def convert_ounces (value):
# Your code starts here
8
9
10
11
12
13
if
14
15
16
17
18
name
main
# Test your code here
# convert_kg (10)
# convert_pounds (10)
# convert_ounces (10)
19
20
Transcribed Image Text:123 def convert_kg(value): | # Your code starts here 456 co 7 def convert_pounds (value): # Your code starts here def convert_ounces (value): # Your code starts here 8 9 10 11 12 13 if 14 15 16 17 18 name main # Test your code here # convert_kg (10) # convert_pounds (10) # convert_ounces (10) 19 20
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,