+ 1

How to add this?

A = input() Now, how to add this integer a with a decimal?(like 0.8) if i can get this answer, i can make a celcius converter on my next project. Please help. If this question is already asked, Let me know in the comments below.

18th Mar 2021, 8:39 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
13 odpowiedzi
+ 2
conversion of celcius to fahreneit should use this formula: C*9/5+32 but your is 9/5 - C + 32 anyway, if you convert input to int at first line, you do not need to repeat it in second line... and converting to float rather than int would be more generic (as int can be parsed to float, but not the converse)
18th Mar 2021, 9:35 AM
visph
visph - avatar
+ 3
you first need to convert input (string) to number: A = float(A) then you could do mathematical expressions: A = A+0.8
18th Mar 2021, 8:47 AM
visph
visph - avatar
+ 2
Ty. Now my (-3 iq)brain can do it while im in shower coz it best place to thincc
18th Mar 2021, 8:49 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
18th Mar 2021, 9:26 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 2
A = int(input()) B = 9/5 -1 *int(a) + 32
18th Mar 2021, 9:30 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 2
Wat is generic
18th Mar 2021, 9:38 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 1
W8, my last braincell is sus that the input() wood work. Do u have an answer?
18th Mar 2021, 9:25 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 1
Okay?
18th Mar 2021, 9:29 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 1
This is my formula for the celcius converter. But it is inaccurate if i put the number 2
18th Mar 2021, 9:30 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 1
In putting the number 1 its accurate
18th Mar 2021, 9:30 AM
Shubhadeep Saha
Shubhadeep Saha - avatar
+ 1
generic: wich could handle more cases...
18th Mar 2021, 9:40 AM
visph
visph - avatar
0
??? I don't understand... :( could you be more descriptive? and share your whole code?
18th Mar 2021, 9:28 AM
visph
visph - avatar
- 1
Maybe this example can help you: celsius = int(input()) def conv(c): f = ((9/5)*c)+32 #even the * is handled before the + return f fahrenheit = conv(celsius) print(fahrenheit)
18th Mar 2021, 2:52 PM
Ervis Meta
Ervis Meta - avatar