# ------------------------------------------------------------ #Student: Austin Wells #Class: CIS122 #Date: 5/4/2015 #Program Title: Chapter 8 Programming Excercise 2.py #(Lottery Number Generator) #Program Description: The program generates a random 7-digit lottery number. # ------------------------------------------------------------ import random # Prints out winning lottery numbers def printStuff(printStr1, randLottoNums): print(printStr1), for i in range(0,len(randLottoNums)): print(randLottoNums[i]), #generate random 7-digit int array def generateRandList(): intList = [] for i in range(0,7): intList.append(random.randint(0,9)) return intList #main driver function def main(): try: printStuff("The winning lotterty numbers are: ",generateRandList()) except (EOFError): print '\n\nInvalid input. You have forgotten to add input. Please Reset program and Please enter an integer' main()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question