Oct-27-2020, 12:13 PM
I'm sorry to say it doesn't work for me, and I'm not sure why.
This is my code, where I've replaced Line 5 with your suggestion, bowlofred:
temperature = (input("Insert temperature: "))
if "f" in temperature or "F" in temperature:
temperature = temperature.upper()
temperature.replace("F", "") # this is a noop because the replaced string is not captured anywhere
print(temperature)
When I run it, I'm asked to input temperature.
I input 32F.
It then prints:
32F
So there's nothing being replaced.
This is my code, where I've replaced Line 5 with your suggestion, bowlofred:
temperature = (input("Insert temperature: "))
if "f" in temperature or "F" in temperature:
temperature = temperature.upper()
temperature.replace("F", "") # this is a noop because the replaced string is not captured anywhere
print(temperature)
When I run it, I'm asked to input temperature.
I input 32F.
It then prints:
32F
So there's nothing being replaced.