Implement function ion() that takes a string as input and returns True if the entered string ends in 'ion' and false otherwise.
ion('congratulation')
True
ion('marathon')
False
How can I start this off and Finish it?

Recommended Answers

All 4 Replies

Hint ...

s = "question"

print(s.endswith("ion"))  # True

WHAT'S THE UPPERCASE SITUATION?

commented: No sense -3

You can give endswith() a tuple of choices, for instance
s.endswith(("ion", "ION"))

But if you are concerned on case of the word, I would use the lower() method of strings.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.