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 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… Also Read: 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 Problem Statement:
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:
Author: Harry
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