simple issue with python
Go to solution
Solved by corrado33,
You're gunna want to use a dictionary.
Basically.
thisdict = { 1: "Knock Knock", 2: "A blond walks into a bar", 3: "Insert Joke Here" } string randomJoke = thisdict[random.randint(1,3)] print randomJoke
Or just put the jokes into an array and use the random number as the array index.
jokes = ["Joke1", "Joke2", "Joke3"] string randomJoke = jokes[random.randint(0,3)] print randomJoke
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now