import randomfave_word_3 = ‘catz’# add ‘world’ and a random number (between 0-3) of ‘Bob’s to this wordfave_word_3 += “world”rand_num = random.randint(0,3)if rand_num == 0: fave_word_3 += ”elif rand_num == 1: fave_word_3 += ‘Bob’elif rand_num == 2: fave_word_3 += ‘BobBob’elif rand_num == 3: fave_word_3 += ‘BobBobBob’else: fave_word_3 += ”print(fave_word_3)
Looking for a way to turn this into a function and cut down onredundant code. (python)
Expert Answer
An answer will be send to you shortly. . . . .