Hi, here is the new code ... just leave a space behind every word. import random
def wordList(): adj1 = ["Big ", "Small ", "Early ", "Late ", "Red ", "Tall ", "Short "] subj = ["politician ", "man ", "woman ", "whale ", "company ", "child ", "soldier "] obj = ["budget ", "money ", "box ", "gift ", "gun ", "tank ", "drone "] adj2 = ["hot ", "crazy ", "stupid ", "fast ", "worthless ", "awesome ", "dirty "] verb = ["spends ", "shoots ", "evades ", "pursues ", "subverts ", "passes ", "flirts "] y = adj1[generate()], subj[generate()] + obj[generate()] + adj2[generate()] + verb[generate()] return y def generate(): random0_6 = random.randint(0, 6) return random0_6 def main(): print (wordList(), ".", sep="") main() I´ve tested it. Have fun ... mika Byron Ruffin <byron.ruf...@g.austincc.edu> schrieb am 10:00 Sonntag, 3.November 2013: The output generates a sentence made up of words chosen randomly from lists. I am having trouble getting a space between each of the words. Should I be thinking about .split? Here is the code (ignore indent errors as it was copied and pasted) Thank you: import random def wordList(): adj1 = ["Big", "Small", "Early", "Late", "Red", "Tall", "Short"] subj = ["politician", "man", "woman", "whale", "company", "child", "soldier"] obj = ["budget", "money", "box", "gift", "gun", "tank", "drone"] adj2 = ["hot", "crazy", "stupid", "fast", "worthless", "awesome", "dirty"] verb = ["spends", "shoots", "evades", "pursues", "subverts", "passes", "flirts"] y = adj1[generate()], subj[generate()] + obj[generate()] + adj2[generate()] + verb[generate()] return y def generate(): random0_6 = random.randint(0, 6) return random0_6 def main(): print (wordList(), ".", sep="") main()
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor