Question

assignment 1 Make sure you are able to write a python program as described in the...

assignment 1

Make sure you are able to write a python program as described in the text. You will be working in repl.it

  • Title your program temperature.
  • Add a comment to say that this program converts Fahrenheit to Centigrade.
  • Create variables:
    • fahrenheit and centigrade values
    • my name
  • Have the program prompt the user (the instructor) for a value for the fahrenheit variable.
  • Convert the value to centigrade, using this formula:
    (fahrenheit - 32) * ÷ 9 = centigrade
  • Have the program print results (the centigrade value)to the screen. Concatenate the value for the my name variable in to the screen print.

assignment 2

  • Title your program temperature2.
  • Add a comment to say that this program allows conversion to either Fahrenheit or Centigrade.
  • Create variables:
    • fahrenheit and centigrade values
    • my name
    • and any other variables you may need
  • Have the program ask the user (the instructor) if they want to convert to Fahrenheit or Centigrade
  • Based on response, run the appropriate formula for conversion:
    • (fahrenheit - 32) * 5 ÷ 9 = centigrade
    • centigrade * 9 ÷5 + 32 = fahrenheit
0 0
Add a comment Improve this question Transcribed image text
Answer #1
# assignment 1
# this program converts Fahrenheit to Centigrade.
fahrenheit = 0
centigrade = 0
my_name = 'ronaldo'

# Have the program prompt the user (the instructor) for a value for the fahrenheit variable.
fahrenheit = float(input("Enter temperature in fahrenheit: "))
# Convert the value to centigrade, using this formula:
# (fahrenheit - 32) * (5 / 9) = centigrade
centigrade = (fahrenheit - 32) * (5 / 9)
# Have the program print results (the centigrade value)to the screen.
# Concatenate the value for the my name variable in to the screen print.
print(my_name + ": " + str(fahrenheit) + " fahrenheit is " + str(centigrade) + " centigrade")

# assignment 2
# this program converts either Centigrade to Fahrenheit or Fahrenheit to Centigrade.
fahrenheit = 0
centigrade = 0
my_name = 'ronaldo'

# Have the program ask the user (the instructor) if they want to convert to Fahrenheit or Centigrade
print("1. Fahrenheit to Centigrade")
print("2. Centigrade to Fahrenheit")
choice = int(input("Enter your choice(1 or 2): "))
if choice == 1:
    fahrenheit = float(input("Enter temperature in fahrenheit: "))
    # Convert the value to centigrade, using this formula:
    # (fahrenheit - 32) * (5 / 9) = centigrade
    centigrade = (fahrenheit - 32) * (5 / 9)
    # Have the program print results (the centigrade value)to the screen.
    # Concatenate the value for the my name variable in to the screen print.
    print(my_name + ": " + str(fahrenheit) + " fahrenheit is " + str(centigrade) + " centigrade")
else:
    centigrade = float(input("Enter temperature in centigrade: "))
    # Convert the value to centigrade, using this formula:
    # (fahrenheit - 32) * (5 / 9) = centigrade
    fahrenheit = centigrade * 1.8 + 32
    # Have the program print results (the centigrade value)to the screen.
    # Concatenate the value for the my name variable in to the screen print.
    print(my_name + ": " + str(centigrade) + " centigrade is " + str(fahrenheit) + " fahrenheit")

Add a comment
Know the answer?
Add Answer to:
assignment 1 Make sure you are able to write a python program as described in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write python program using IDLE Write a full program that asks the user to enter his/her...

    Write python program using IDLE Write a full program that asks the user to enter his/her name then repeatedly ask to enter the temperature in Fahrenheit and convert it to Celsius, the program should then prompt the user if he/she wants to continue or exit the program. The formula for the conversion is: °C = (°F - 32) x 5/9 The program should use a function for the conversion. An Example of a sample run should appear on the screen...

  • write in python idle Write full program that asks the user to enter his/her name then...

    write in python idle Write full program that asks the user to enter his/her name then repeatedly ask to enter the temperature in Fahrenheit and convert it to Celsius, the program should then prompt the user if he/she wants to continue or exit the program. The formula for conversion is: °C = (°F - 32) x 5/9 The program should use a function for the conversion. An Example of a sample run should appear on the screen like the text...

  • write a python program that use while and for loop.

    Write a Python program that- Uses a while loop to produce a table that shows the conversion of degrees Celsius to degrees Fahrenheit between 0 degrees Celsius and 100 degrees Celsius. Theconversion formula is Fahrenheit = Celsius * 9 / 5 + 32-Uses a for loop to produce a table that shows the conversion of degrees Fahrenheit to degrees Celsius between 0 degrees Fahrenheit and 100 degrees Fahrenheit. Theconversion formula is Centigrade = (Fahrenheit – 32) * 5/9.-Each conversion table...

  • Create a program in Python that will allow the user to enter a temperature in Fahrenheit...

    Create a program in Python that will allow the user to enter a temperature in Fahrenheit which will then be converted to degrees Celsius. The program will keep asking the user for a Fahrenheit temperature until the user enters Q to quit. After each conversion the program needs to print out the degrees Celsius. The input prompts for this problem need to look like the following: Degrees Fahrenheit: Continue: For these input prompts watch the capitalization and spacing. There are...

  • C++ optional exercise. You are going to convert temperatures in this program. You will give the...

    C++ optional exercise. You are going to convert temperatures in this program. You will give the user the choice of converting Fahrenheit to Celsius or Celsius to Fahrenheit. With the correct answer you will also display the number entered. The user should have the option to convert as many temperatures as they want. Use functions and a menu (also a function) and, assume they will convert at least one temperature. When finished upload and submit the zipped project. the formulas...

  • In Java. I am getting confused with this assignment, my confusion starts where I stopped. Create a package named tempera...

    In Java. I am getting confused with this assignment, my confusion starts where I stopped. Create a package named temperature and create a program that has a while loop. • Inside the while loop, your program will prompt the user for temperature in Centigrade. • If the Centigrade value read in is <= -100, the loop will exit. • Otherwise, your program will compute the Fahrenheit equivalent temperature. • Inside the while loop, your program will print out the Centigrade...

  • . Use what you learned from our First Python Program to write a Python program that...

    . Use what you learned from our First Python Program to write a Python program that will carry out the following tasks. Ask user provide the following information: unit price (for example: 2.5) quantity (for example: 4) Use the following formula to calculate the revenue: revenue = unit price x quantity Print the result in the following format on the console: The revenue is $___. (for example: The revenue is $10.0.) . . Use the following formula to calculate the...

  • CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1....

    CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1. Create a program named printRandomNumbers that gets input from the user and then produces a list of random numbers. 2. Import the random module 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description c. Programmer's Name (You) 4. Prompt the user for the following: a. Number of random numbers required b. Lower limit of...

  • In this assignment you are asked to write a python program to maintain the Student enrollment...

    In this assignment you are asked to write a python program to maintain the Student enrollment in to a class and points scored by him in a class. You need to do it by using a List of Tuples What you need to do? 1. You need to repeatedly display this menu to the user 1. Enroll into Class 2. Drop from Class 3. Calculate average of grades for a course 4. View all Students 5. Exit 2. Ask the...

  • PLEASE DO THIS IN PYTHON!!!!!!!! 1.) For each lab program you develop, make sure to include...

    PLEASE DO THIS IN PYTHON!!!!!!!! 1.) For each lab program you develop, make sure to include the following header - replace the dots with your section #, semester, your full name, your instructor’s name, and lab #:                         Class: CSE 1321L Section:       ...          Term:          ... Instructor:    ... Name:          ...    Lab#:          ... Make sure to put the correct comment character(s) before the above lines in each file. C# & Java use // for comments, Python uses a # Exercise #1:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT