Implementing logic

Report a typo

Advanced input() handling is used to read input directly into several variables, e. g.,

name, surname = input().split(), but a user still can enter more or fewer words.

In this task, you have to make sure that the user entered the necessary amount of words and...

  • If there are more or fewer words in the input, print an error: "You need to enter exactly 2 words. Try again!"
  • If everything's good, greet the user personally.

Sample Input 1:

Anthony Stark

Sample Output 1:

Welcome to our party, Anthony Stark

Sample Input 2:

Steven Rogers Captain America

Sample Output 2:

You need to enter exactly 2 words. Try again!
Write a program in Python 3





___

Create a free account to access the full topic