Temperature conversion in python assignment expert

Temperature Conversion

You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = [F - 32] * 5 / 9.

Formula to convert from Kelvin K to Celsius C is C = K - 273.

Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.

The input contains the temperature [a number] and the unit of the temperature scale [C, F, K] without any space.

The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.Input

The first line of the input contain a temperature Value in one of Celsius, Fahrenheit, and Kelvin scales.Output

The first line of output should contain the Celsius value and the unit of the Celsius without any space.

The second line of output should contain the Fahrenheit value and the unit of the Fahrenheit without any space.

The third line of output should contain the Kelvin value and the unit of the Kelvin without any space.Explanation

For example, if the given temperature Value is 25C then Celsius value is 25.0C, Fahrenheit value is 77.0F, and Kelvin value is 298.0K.

Sample Input 1

25C

Sample Output 1

25.0C

77.0F

298.0K

Sample Input 2

37.5F

Sample Output 2

3.06C

37.5F

276.06K

Temperature Conversion

You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = [F - 32] * 5 / 9.

Formula to convert from Kelvin K to Celsius C is C = K - 273.

Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.

The input contains the temperature [a number] and the unit of the temperature scale [C, F, K] without any space.

The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.

Input

The first line of the input contain a temperature Value in one of Celsius, Fahrenheit, and Kelvin scales.

Output

The first line of output should contain the Celsius value and the unit of the Celsius without any space.

The second line of output should contain the Fahrenheit value and the unit of the Fahrenheit without any space.

The third line of output should contain the Kelvin value and the unit of the Kelvin without any space.

Explanation

For example, if the given temperature Value is 25C then Celsius value is 25.0C, Fahrenheit value is 77.0F, and Kelvin value is 298.0K.

 Harry  August 25, 2022

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at Thank you

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at Thank you

 Harry  September 18, 2022

Problem Statement:

You are given a button, with that only one button available, we need to write all the alphabet. But, how this is possible? That only button outputs different results on clicking different number of times, for example, if you press the button 1 time, this means ‘a’ or ‘A’, 2 time means ‘b’ or ‘B’, 3 time means ‘c’ or ‘C’ and so on…
We are given a string, we need to write a Python code to find out how many times that button will be pressed to result in the string.
For example, ‘abcd’ => 1+2+3+4 =>10.

Code for Pager in Python:

s = input['Enter the string: ']
s = s.lower[]
press_count = 0
for i in s:
    press_count += ord[i]-96
print[press_count]

Output:

Also Read:

  • Split the sentence in Python | Assignment Expert
  • String Slicing in JavaScript | Assignment Expert
  • First and Last Digits in Python | Assignment Expert
  • List Indexing in Python | Assignment Expert
  • Date Format in Python | Assignment Expert
  • New Year Countdown in Python | Assignment Expert
  • Add Two Polynomials in Python | Assignment Expert
  • Sum of even numbers in Python | Assignment Expert
  • Evens and Odds in Python | Assignment Expert
  • A Game of Letters in Python | Assignment Expert
  • Sum of non-primes in Python | Assignment Expert
  • Smallest Missing Number in Python | Assignment Expert
  • String Rotation in Python | Assignment Expert
  • Secret Message in Python | Assignment Expert
  • Word Mix in Python | Assignment Expert
  • Single Digit Number in Python | Assignment Expert
  • Shift Numbers in Python | Assignment Expert
  • Weekend in Python | Assignment Expert
  • Shift Numbers in Python | Assignment Expert
  • Temperature Conversion in Python | Assignment Expert
  • Special Characters in Python | Assignment Expert
  • Sum of Prime Numbers in the Input in Python | Assignment Expert
  • Numbers in String-1 in Python | Assignment Expert
  • Replace Elements with Zeros in Python | Assignment Expert
  • Remove Words in Python | Assignment Expert
  • Print Digit 9 in Python | Assignment Expert
  • First Prime Number in Python | Assignment Expert
  • Simple Calculator in Python | Assignment Expert
  • Average of Given Numbers in Python | Assignment Expert
  • Maximum in Python | Assignment Expert

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at Thank you

Pager:

Imagine a paper with only one button. for the letter "A", you press the button one time, for "B", you press it 2 times for "E", you press it five times. for "G", it's pressed seven times, etc.

Given a string s, print the total number of times the button should be pressed

explanation: given string is abde. then the total no. of times the button pressed is 1+2+4+5=12

I/p: abde

O/p: 12

I/p: xyz

O/p: 75

pager

imagine a pager with only one button for the letter "A" you press the button one time for "B"ou press it two times for "E" you press it five times ,for "G" its pressed seven times

explanation :

for example if the given strings abcde , then

the total number of times the button pressed 1+2+4+5

so the output is 12

input: abde

output: 12

intput:xyz

output:75

inp = list[input[]]
alphabet = list['abcdefghijklmnopqrstuvwxyz']
out = 0
for i in range[len[inp]]:
    for j in range[26]:
        if inp[i] == alphabet[j]:
            out += j + 1
print[out]

Learn more about our help with Assignments: Python

How do you convert temperature in Python?

Python Program to Convert Celsius To Fahrenheit and Vice Versa.
Celsius = [Fahrenheit – 32] * 5/9 Fahrenheit = [Celsius * 9/5] + 32..
celsius = float[input["Enter temperature in celsius: "]] fahrenheit = [celsius * 9/5] + 32 print['%.2f Celsius is: %0.2f Fahrenheit' %[celsius, fahrenheit]].

How do you convert temperature readings?

Here are the temperature conversion formulas:.
Celsius to Kelvin: K = C + 273.15..
Kelvin to Celcius: C = K - 273.15..
Fahrenheit to Celcius: C = [F-32] [5/9].
Celsius to Fahrenheit: F = C[9/5] + 32..
Fahrenheit to Kelvin: K = [F-32] [5/9] + 273.15..
Kelvin to Fahrenheit: F = [K-273.15] [9/5] + 32..

What are the formulas for temperature conversion?

Temperature Conversion Formulas.

How do you convert temperature from one unit to another?

The formulas for temperature conversion are given as,.
Celsius to Fahrenheit Conversion: °F = [9/5] × [°C] + 32..
Fahrenheit to Celsius Conversion: °C = [5/9] × [°F − 32].
Celsius to Kelvin Conversion: K = °C + 273.15..
Fahrenheit to Kelvin Conversion: K = °F + 457.87..

Chủ Đề