Print air_temperature with 1 decimal point followed by C. Sample output from given program: 36.4c

Print air_temperature with 1 decimal point followed by C. Sample output from given program: 36.4c

Answer

  1. #Read the value from keyboard and parse to float
  2. #assign the value to air_temperature
  3. air_temperature=float(input())
  4. #Print the air_temperature with one decimal place to right with C
  5. print('%.1fC'%air_temperature)
  6. #where f is a format specifier .1 is number of decimal places to display on right side
  7. #C is the character to print after the decimal value

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts