Question

In: Computer Science

Get values for min and max using assignment statements and the input function. Print min and...

  1. Get values for min and max using assignment statements and the input function.
    Print min and max.
    Run the script.
    fix any errors you find.
  2. Remove the print statements you wrote above.
    Print the labels "Kelvin" and "Fahrenheit".
    Print a line of dashes under the labels.
    Run the script.
    fix any errors you find.
  3. Write a for loop that will give the loop variable kelvin values between min and max.
    Inside the code block print the value of kelvin
    Run the script.
    fix any errors you find.
  4. Remove the print statement inside the for a loop.
    Write an assignment statement that calculates the value of the equivalent Fahrenheit temperature.
    Print the Fahrenheit and Kelvin temperatures.
    Run the script.
    fix any errors you find.
  5. Use escape characters to align the Fahrenheit values with their label.
    Run the script.
    fix any errors you find.

Solutions

Expert Solution

Code:

#taking minimum and maximum values as inputs
min=int(input("Enter minimum value"))
max=int(input("Enter maximum value"))
#printing labels of kelvin and farenheit
print("kelvin       Farenheit")
#printing dashed lines
print("-----------------------------------")
#a loop that iterates from min to max
for kelvin in range(min,max):
   #converting kelvin to farenheit
   Farenheit=(kelvin -273.15)* 9/5 + 32
   #printing using tab escape character
   print(str(kelvin)+"\t\t"+str(Farenheit))

Output:

Code Screenshot:

Code snippet:

#taking minimum and maximum values as inputs
min=int(input("Enter minimum value"))
max=int(input("Enter maximum value"))
#printing labels of kelvin and farenheit
print("kelvin           Farenheit")
#printing dashed lines
print("-----------------------------------")
#a loop that iterates from min to max
for kelvin in range(min,max):
        #converting kelvin to farenheit
        Farenheit=(kelvin -273.15)* 9/5 + 32
        #printing using tab escape character 
        print(str(kelvin)+"\t\t"+str(Farenheit))

Related Solutions

c++ Write a program that print stars, Max and Min values. It should use the following...
c++ Write a program that print stars, Max and Min values. It should use the following functions: (2 pts) int getNum ( ) should ask the user for a number and return the number. This function should be called by main once for each number to be entered. Input Validation: Do not accept numbers less than -100. (2 pts) void printStars ( int n ) should print n number of stars. If n is less than 0, display "Invalid" message...
Using an array and a function, print the values of an array backwards. Please follow these...
Using an array and a function, print the values of an array backwards. Please follow these guidelines: - Setup your array manually (whichever values you want, as many as you want and whichever datatype you prefer). - Call your function. You should send two parameters to such function: the array’s length and the array. - Inside the function, go ahead and print the array backwards. - Your function shouldn’t return anything.
MUST BE DONE IN C (NOT C++) Using an array and a function, print the values...
MUST BE DONE IN C (NOT C++) Using an array and a function, print the values of an array backwards. Please follow these guidelines: - Setup your array manually (whichever values you want, as many as you want and whichever datatype you prefer). - Call your function. You should send two parameters to such function: the array’s length and the array. - Inside the function, go ahead and print the array backwards. - Your function shouldn’t return anything
Write a JavaScript function to get the values of form containing the following input fields: fname...
Write a JavaScript function to get the values of form containing the following input fields: fname lname address city state
In MIPS assembly language, write a function that will display the max and min value in...
In MIPS assembly language, write a function that will display the max and min value in an array. Then write a function to calculate and display the average of all values in an array. This must be done in MIPS assembly language.
Write a Python program that computes certain values such as sum, product, max, min and average...
Write a Python program that computes certain values such as sum, product, max, min and average of any 5 given numbers along with the following requirements. Define a function that takes 5 numbers, calculates and returns the sum of the numbers. Define a function that takes 5 numbers, calculates and returns the product of the numbers. Define a function that takes 5 numbers, calculates and returns the average of the numbers. Must use the function you defined earlier to find...
Write below in Python Get user name from keyboard using input() function (Example username = input("Enter...
Write below in Python Get user name from keyboard using input() function (Example username = input("Enter username:") A: What is your name? B: My name is XXXX. B: What is yours? A: My name is XXXX. A: Nice to meet you. B: Nice to meet you, too. Use print statement and use input() function
Find the absolute max/min values of f(x) = x/x2+1 on the interval [-2,2].
Find the absolute max/min values of f(x) = x/x2+1 on the interval [-2,2].
PLEASE USE PTHON SPYDER Given a data file, find the max, min, and average values of...
PLEASE USE PTHON SPYDER Given a data file, find the max, min, and average values of columns. Also, create an addition column that is based on the other columns. There will be no error checking required for this lab. You are provided with a data file named (surprise!) data.txt. Data is arranged in columns where each item of data is twelve columns wide (so it is easy to extract data items using slicing): Name Height(m) Weight(kg) Joe 1.82 72.57 Mary...
Describe the center and spread of the following values: Min: 3.31 Max: 5.21 Std Dev. 0.4339...
Describe the center and spread of the following values: Min: 3.31 Max: 5.21 Std Dev. 0.4339 Mean: 4.08 Median: 4.02 1st Quartile: 3.78 3rd Quartile: 4.40
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT