Wednesday, June 10, 2020
Python Coding, Running Programming Assignment Paper - 825 Words
Python Coding, Running Programming Assignment Paper (Other (Not Listed) Sample) Content: def getData():list = []name_list = []verb_list = []fruit_list = []name_input = input()verb_input = input()fruit_input = input()seperator = ','namestr = name_input.split(seperator)verbstr = verb_input.split(seperator)fruitstr = fruit_input.split(seperator)name_list.append(namestr)verb_list.append(verbstr)fruit_list.append(fruitstr)list = name_list + verb_list + fruit_listprint(list)here is the main function that creates the sentence (given in the code for output):def main():seed = int(input())print("The seed is", seed)names,verbs,fruit = getData()print("NAMES:", names)print("VERBS:", verbs)print("FRUIT:", fruit)random.seed(seed)for i in range(10):n = pick(names, random.randint(1,1000))v = pick(verbs, random.randint(1,1000))f = pick(fruit, random.randint(1,1000))print(n,v,"the",f)if __name__ == "__main__":main()Code.NAMES = ['Adam', 'Betty', 'Charlie', 'Debbie', 'Elaine', 'Frank' 'George','Harry', 'Igor', 'Jack', 'Kevin', 'Larry', 'Moe', 'Nancy', 'Ophelia', 'Phil', 'Que ntin']VERBS = ['had', 'found', 'got...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment