Course Solutions Uncategorized (Solved) : Import Randomfaveword2 Csc108 Add World Random Number 0 3 Bob S Wordfaveword2 World Randnu Q34949578 . . . .

(Solved) : Import Randomfaveword2 Csc108 Add World Random Number 0 3 Bob S Wordfaveword2 World Randnu Q34949578 . . . .

 

import randomfave_word_2 = ‘csc108’# add ‘world’ and a random number (between 0-3) of ‘Bob’s to this wordfave_word_2 += “world”rand_num = random.randint(0,3)if rand_num == 0: fave_word_2 += ”elif rand_num == 1: fave_word_2 += ‘Bob’elif rand_num == 2: fave_word_2 += ‘BobBob’elif rand_num == 3: fave_word_2 += ‘BobBobBob’else: fave_word_2 += ”print(fave_word_2)

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. . . . .

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : 1 Consider Following Data Set Comprised Three Binary Input Attributes A1 A2 A3 One Binary Q37707450 . . . .(Solved) : 1 Consider Following Data Set Comprised Three Binary Input Attributes A1 A2 A3 One Binary Q37707450 . . . .

<p><img alt="1. Consider the following data set comprised of three binary input attributes (A1, A2, and A3) and one binary output: Example" src="https://media.cheggcdn.com/media%2F543%2F5437225c-e6c7-4fce-9836-65ccbdd4e605%2Fphp9nOxEx.png" style="height:775px;width:1024px;" aria-describedby="d3f"/></p>1. Consider the following data set