Question: ' ' ' Program that has a conversation with the user. Uses elif branching and a random number to mix up the program's responses. '

'''
Program that has a conversation with the user.
Uses elif branching and a random number to mix up the program's responses.
'''
import random # Import a library to generate random numbers
print('Tell me something about yourself.')
print('You can type \'Goodbye\' at anytime to quit.
')
user_text = input()
while user_text != 'Goodbye':
random_num = random.randint(0,2) # Gives a random integer between 0 and 2
if random_num ==0:
print('
Please explain further.
')
elif random_num ==1:
print(f'
Why do you say: "{user_text}"?
')
elif random_num ==2:
print('
What else can you share?
')
else:
print('
Uh-oh, something went wrong. Try again.
')
user_text = input()
print('It was nice talking with you. Goodbye.
')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!