mercredi 21 novembre 2018

Iterator of if-functions return errors

I have just started on a coding project that can encode messages. When trying to use if and elif functions, repl.it is returning an error, no matter what I try to end the if functions with.

Code:

    ConvertString = input("Enter a string: ")
    StringList = list(ConvertString)
    print (StringList)
    for x in list(range(len(StringList))
      if StringList[x] == "a":
        print("Letter found: a")
      elif StringList[x] == "b"
        print("Letter found: b")
      elif StringList[x] == "c"
        print("Letter found: c")
      elif StringList[x] == "d"
        print("Letter found: d")
      elif StringList[x] == "e"
        print("Letter found: e")
      elif StringList[x] == "f"
        print("Letter found: f")
      x += 1

Aucun commentaire:

Enregistrer un commentaire