Skip to content
Advertisement

append random choice to list and print only random choice

I am really new to python and I’m in the middle of trying to create a small ouija game.

I have a list of numbers(ages) that i have generated a random choice for I want to append that random choice to an empty list and output only the random choice number However when I run my code it outputs everything from the original list, but the if else works as it appears to output the correct text as detailed below, but lists every number in the original list

Can someone help with this?

JavaScript

Advertisement

Answer

You have a list that contains a single string, instead of a list of multiple strings:

JavaScript

You can confirm this with print(len(age)).

This list contains a single big string.

What you want is this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement