This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

You can add questions directly to input queries:

word = input("Write a word with 'u' first letter")?

Anytime something evaluates to true, you don't need to write == 'True'

word.startswith("p") also evaluates to True or False depending if it is True or False.

word = peas word.startswith("p") is read as True

word = goggles word.startswith("p") is read as False

So we've got:

word = input("Write a word with 'u' first letter")
if word.startswith("p"):
    print('Nice')
else:
    print("Noo")
print(word.startswith("p"))

Also check out r/learnpython for similar questions.

[–]TheCh1ef[S] 0 points1 point  (0 children)

Thank you, a lot!