Dec-30-2019, 12:41 AM
I am new to Python and have been trying to trim some code for brevity.
Following is the original code.
Why does this not work? What am I missing?
Python 3.8
macOS Catalina
Following is the original code.
user_sentance = input("Enter a sentance. ") user_character = input("Enter a character. ") index = user_sentance.find(user_character) print("{} is at index {}.".format(user_character, index))Then I try to replace the print() statement with:
print("{} is at index {}.".format(user_character, user_sentance.find(user_character))I get an invaled syntax error.
Why does this not work? What am I missing?
Python 3.8
macOS Catalina