Skip to Content
Learn
Slots
Lambda Function: Respond to Slot

We now have access to the slot within the Lambda function. The only thing left to do is respond appropriately. If the user guesses correctly (“python”), we can congratulate them on getting it correct:

Correct! Python is the most popular language.

Conversely, if they get it incorrect, we’ll repeat their guess and let them know the correct answer:

You guessed that java is the most popular. Actually, python is our most popular language.

Instructions

1.

Add an if statement after the definition of myLanguage. If the user has guessed correctly (“python”), respond to the user with the string - “Correct! Python is the most popular language.”

2.

Follow the if statement with an else statement to repeat the user’s guess and let them know the correct answer.

Use this string: “You guessed that java is the most popular. Actually, python is our most popular language”, but replace java with the user’s guess.

Folder Icon

Take this course for free

Already have an account?