""" Purpose: introduce some another function from module random """ # by default the random module produces different interactions everytime we use it import random # random function choice( seq ) when a given a sequence as a parameter returns # a random element from the sequence ### get a string s = input( "Enter a string: " ) i1 = random.choice( s ) i2 = random.choice( s ) i3 = random.choice( s ) i4 = random.choice( s ) print( "Four random characters from string", s, ": ", i1, i2, i3, i4 ) reply = input() # pause until ready ### get a list of words reply = input( "Enter some words: " ) user_words = reply.split() w1 = random.choice( user_words ) w2 = random.choice( user_words ) w3 = random.choice( user_words ) w4 = random.choice( user_words ) print( "Four random words from list", user_words, ":", w1, w2, w3, w4 )