__author__ = 'Student' #Uncomment which bit of code you want to use # they are separated by comment block '''reply = input( "Enter a list of numbers: " ) list_numbers_as_strings = reply.split() new_list = [] # accumulators are useful when we want do or print something after modification / alteration of the original for number in list_numbers_as_strings: number = int( number ) new_list.append( number ) print( new_list ) maximum = max(new_list) print (maximum) # append is used when you want to add something to a list # concatenation using "+" is used for gluing strings together ''' ''' import random seed = input ("Give me a seed: ") random.seed( seed ) number = random.randrange(0, 5) # this will choose a value between 0 through 4 print(number) ''' ''' # WORDY.PY FALL 2017 words_string = input("Enter some words: ") # this prompts the user for some words and stores user input as a string words_list = words_string.split() # .split() will split the string into a list of words based on the string the user entered nbr_words = len( words_list ) # Accumulator(s) sum_lengths = 0 # set an accumulator for the total sum of the lengths of the words list_lengths = [] # set an empty list so that we can add the lengths of all the words as elements of this list for word in words_list: length_word = len( word ) # gets the length of word sum_lengths = sum_lengths + length_word # adds it to the sum accumulator list_lengths.append( length_word ) # adds it to our list of lengths of words average = sum_lengths // nbr_words # the average is the sum of the lengths divided by the number of words count_words_with_average_length = list_lengths.count( average ) # .count() will count the number of words with the same length as the average print( average, count_words_with_average_length ) # print the two entities side by side '''