Use the following program as your base program and then add the option to convert from Celcius to Kelvin as option 3. This is Python
# Program displays a menu asking user if they want to convert to
Celcius or to Farenheit
# Based upon selection,
# Program accepts an input as a Celcius or a Farenheit temperature,
converts the temperature to
# the requested units and then outputs the converted temperature to
the screen.
print("Enter:")
print("1: for conversion from Celcius to Farenheit.")
print("2: for conversion from Farenheit to Celcius.\n")
choice = int(input())
if choice == 1:
celcius = input("Please enter the temperature in Celcius.
")
celcius = float(celcius)
farenheit = 9/5 * celcius + 32
print("A Celcius temperature of", celcius, "degrees is equal to a
farenheit temperature of ", farenheit, "degrees.")
elif choice == 2:
farenheit = input("Please enter the temperature in Farenheit.
")
farenheit = float(farenheit)
celcius = (farenheit - 32) * 5/9
print("A Farenheit temperature of", farenheit, "degrees is equal to
a celcius temperature of ", celcius, "degrees.")
else:
print("Incorrect response. Please run the program again.")
I'm having trouble finding the right code for celcius to kelvin and my elifs are saying invalid syntax
Answer: here is the answer for your question:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
code in python:
print("Enter:")
print("1: for conversion from Celcius to Farenheit.")
print("2: for conversion from Farenheit to Celcius.\n")
print("3: for conversion from Celcius. to kelvin\n")
choice = int(input())
if choice == 1:
celcius = input("Please enter the temperature in Celcius.
")
celcius = float(celcius)
farenheit = 9/5 * celcius + 32
print("A Celcius temperature of", celcius, "degrees is equal to a
farenheit temperature of ", farenheit, "degrees.")
elif choice == 2:
farenheit = input("Please enter the temperature in Farenheit.
")
farenheit = float(farenheit)
celcius = (farenheit - 32) * 5/9
print("A Farenheit temperature of", farenheit, "degrees is equal to
a celcius temperature of ", celcius, "degrees.")
elif choice == 3:
celcius = input("Please enter the temperature in Celcius. ")
celcius = float(celcius)
kelvin=celcius+ 273.15
print("A Celcius temperature of", celcius, "degrees is equal to a
kelvin temperature of ", kelvin, "degrees.")
else:
print("Incorrect response. Please run the program again.")
output:


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
I hope this would help you out
If you have any doubt, you can provide comment /feedback below the answer
Thanks
Use the following program as your base program and then add the option to convert from...
Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin Newton Your program should take a character which represents the temperature to convert from and a value to be converted to using the following specification: C - Celsius K - Kelvin N - Newton In addition your program should take in the following character to exit the program: X - eXit the program The numeric input for your program should be of type double....
#function to covert kilometer to miles #takes km input as an argument and return the calculation def kilometer_to_miles(km): return km * 0.6214 #function to covert miles to kilometer #takes miles input as an argument and return the calculation def miles_to_kilometer(miles): return miles/0.6214 #Main function to find the distance #by calling either of the two functions #prompt the user to enter his/her choice of distance conversion restart = 0 while (restart == 'y'): user_input = input ("Enter k to convert kilometer...
Hi! I need help with this for phython Temperature conversion. Complete the program by writing and calling a function that converts a temperature from Celsius into Fahrenheit. Use the formula F = C x 9/5 + 32. Test your program knowing that 50 Celsius is 122 Fahrenheit. def c_to_f(): # FIXME return # FIXME: Finish temp_c = float(input('Enter temperature in Celsius: ')) temp_f = None # FIXME: Call conversion function # temp_f = ?? # FIXME: Print result # print('Fahrenheit:'...
CAN YOU HELP ME TO DO THIS EXERCISE PLEASE USING C++ Write a program that gives the user two options: (1) Transform a temperature value from Celsius to Fahrenheit or (2) Transform a temperature value to Fahrenheit to Celsius. The two options are communicated to the user by the console by means of "cout" with this text: "If you want to transform from Fahrenheit to Celsius between character C (capital)." "If you want to transform from Celsius to Fahrenheit between...
For this portion of the lab, you will reuse the program you wrote before That means you will open the lab you wrote in the previous assignment and change it. You should NOT start from scratch. Also, all the requirements/prohibitions from the previous lab MUST also be included /omitted from this lab. Redesign the solution in the following manner: 1. All the functions used are value-returning functions. 2. Put the functions in an external module and let the main program...
C++ programming I need at least three test cases for the program and at least one test has to pass #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; void temperatureCoverter(float cel){ float f = ((cel*9.0)/5.0)+32; cout <<cel<<"C is equivalent to "<<round(f)<<"F"<<endl; } void distanceConverter(float km){ float miles = km * 0.6; cout<<km<<" km is equivalent to "<<fixed<<setprecision(2)<<miles<<" miles"<<endl; } void weightConverter(float kg){ float pounds=kg*2.2; cout<<kg<<" kg is equivalent to "<<fixed<<setprecision(1)<<pounds<<" pounds"<<endl; } int main() { string country;...
SCHEME :-) [5 marks] Write a procedure called convert that takes as arguments: a temperature value (number), and two strings representing the input and output units respectively. The procedure should support conversions to or from any combination of Celcius ("C"), Fahrenheit ("F"), and Kelvin ("K"). Any other unit argument should result in the return of an error string. A table of temperature conversion equations and a calculator for verification can be found here. (Note: to compare strings in Scheme you...
Describe the necessary user inputs from the program using the following table format. Choose the appropriate data type to store each user input and explain your choice. Input data type chosen and why Note that you are expected to take into consideration the value(s) of each transaction category. For example, your program should assess the transaction amount of each bill paid by the user before classifying it under the bill payment category. Below is the python program: from math import...
PHP
Can't get my code to work, what am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<script>
</script>
</head>
<body>
<h2>Temperature Conversion Table</h2>
<h4>Enter a starting value in degrees Fahrenheit and an
increment value.</h4>
<form name="myTemp"
onsubmit="convertCelcius()" method="post">
<input type="text" name="temperature"> Enter an value in
degrees Fahrenheit<br><br>
<input type="radio" name="degIncrement" id="degIncrement5">
Convert in increment in 5 degrees<br>
<input type="radio" name="degIncrement" id="degIncrement10">
Convert in increment in 10 degrees
<br/><br/><input type="submit"
value="Submit">
</form>
<?php
if( $_POST["temperature"] || $_POST["degincrement"] ) {
//get he...
Hello! I'm looking for help with this assignment. Complete a program in pseudocode and Python that performs the following tasks. Open the file called M4Lab1ii.py linked below these instructions in your M4 Content module in IDLE. Save as M4Lab1ii.py. Replace ii with your initials. [example for someone with the initials cc: M4Lab1cc.py] Complete Steps 1-7 as requested within the code’s comments. Run your program and test all four calculations, then exit the program. Save your program as M4Lab1ii.py using your...