Example = If the person types in 20, say that 20 was NOT the correct answer My current code that I’m trying to work with is:
JavaScript
x
4
1
response = (input ('Type a number'))
2
if response == '5':
3
print('5 was the correct answer')
4
Advertisement
Answer
Add an else
and use f-strings to insert the user’s input into your response:
JavaScript
1
6
1
answer = input('Type a number')
2
if answer == '5':
3
print(f'{answer} was the correct answer')
4
else:
5
print(f'{answer} was NOT the correct answer')
6