Oct-26-2020, 10:19 PM
(This post was last modified: Oct-26-2020, 10:31 PM by snippsat.
Edit Reason: Fix code tag
)
Hi Guys.
I am trying to remove the letter F or C or f or c from the string and then print it.
Here is the code, and for the love of god, I don't understand what I am doing wrong. Its printing exactly what i type in 32F or 25C...
I am trying to remove the letter F or C or f or c from the string and then print it.
Here is the code, and for the love of god, I don't understand what I am doing wrong. Its printing exactly what i type in 32F or 25C...
temperature = (input("Insert temperature: ")) if "f" in temperature or "F" in temperature: new_string = temperature.replace("F", "") new_string = temperature.replace('f', '') print(new_string) else: new_string = temperature.replace("c", "") new_string = temperature.replace('C', '') print(new_string)