Python Forum
[split] Need help solving this
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Need help solving this
#3
To tack onto perfingo's response, there are a few ways to fix this.

  1. Add another comparison.
    franko = input("Please enter the text you want to translate")
    if franko == "A" or franko == "a":
        print("ا")
  2. Use a tuple to contain the possible inputs and compare using "in".
    franko = input("Please enter the text you want to translate")
    if franko in ("A", "a"):
        print("ا")
  3. Or my personal favorite which involves a call to str.lower() and then comparison. This can be useful when the user types more than one character to control for capitalization errors.
    franko = input("Please enter the text you want to translate").lower()
    if franko == "a":
        print("ا")
Reply


Messages In This Thread
[split] Need help solving this - by RobinFire136 - Jan-21-2020, 03:20 PM
RE: [split] Need help solving this - by stullis - Jan-21-2020, 07:54 PM
RE: [split] Need help solving this - by buran - Jan-21-2020, 08:00 PM
RE: Need help solving this - by perfringo - Jan-21-2020, 04:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020