(Jul-27-2022, 05:58 AM)sie Wrote: Hello, i was wondering on how can i remove the space between the variable color and a string ", I prefer red"
Possibly, don't introduce it; that way you don't have to remove it:
print (f"I don't like {color}, I prefer red.")You could use the '.lower()' method in the output...
color = input ("Please enter your favorite color ") print (f"I don't like {color.lower()}, I prefer red.")... which leaves the original input as is. There are cases when that is preferable.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein