Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python programming temperature.in.celsius = raw input('Enter the temperature in Celsius : # change the stored value from string format to float format temperature in.celsius

python programming
image text in transcribed
image text in transcribed
temperature.in.celsius = raw input('Enter the temperature in Celsius : " # change the stored value from string format to float format temperature in.celsius = float(temperature.in.celsius); # convert temperature from Celsius to Fahrenheit temperature in farenheit = (9.0/5) * temperature.in.celsius + 32 # Print the conversion print "The temperature is ", temperature in farenheit, " degrees Farenheit" After reading and understanding the code above, write a program that converts given distance from inches to centimeters using the formula: 1 cm = 1 in * 2.54 The program should ask for the distance in inches and print the entered distance in centimeters as follows: What is the distance in inches?: 10 10 inches is 25.4 cm Save the program as inchesToCentimeters.py. Test your program with several cases to make sure it is working properly. # First make the math library available import math print "This program finds the real solutions to a quadratic" print "Note: this program will crashes if the equation has no real roots" print # Get the value of the coeffients and store them as variables a, b and c a = raw input ("Enter the coeffients a: ") b = raw.input ("Enter the coeffients b: ") c = raw.input("Enter the coeffients c: ") # Convert the coefficients from string format to float-point format a = float(a) b = float(b) C-float(c) discRoot = math.sqrt(b + b - 4. a. c) root1 = (-b + discRoot) / (2 * a) root2 = (-b - discRoot) / (2 + a) print print "The roots of the equations are:", rooti, ",", root2 Using the above program as base, write a program that computes the distance between two points (x, y) and (C2, y2) using the formula D= (12-01) +(12- y) The program should ask for the values of 21, 91, 2, and y2 and print the distance D as follows: This program finds the distance between two points Enter x.1: 1 Enter y-1: 1 Enter x 2: 2 Enter y 2: 2 The distance between (1,1) and (2,2) is 1.41421356237 Save the program as distance.py. Test your program with several cases to make sure it is work- ing properly

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago