You must first import random
. To choose your image, do image = math_list.pop(random.randint(0,len(math_list)-1))
. randint
is used to choose a random number from 0 to 4, each one corresponding to an item in the list. pop
removes that item and returns it to image
.
More Related Contents:
- Faster version of ‘pygame.event.get()’. Why are events being missed and why are the events delayed?
- pygame.event.get() not returning any events when inside a thread
- Pygame already installed; however, python terminal says “No module named ‘pygame’ ” (Ubuntu 20.04.1)
- Lag when win.blit() background pygame
- Pygame is running slow
- jumping too fast?
- How to Center Text in Pygame
- Image rotation while moving
- How do I detect if the mouse is hovering over a button? PyGame button class is not displaying the text or changing colour on hover
- How do I create animated sprites using Sprite Sheets in Pygame?
- How to get if a key is pressed pygame [duplicate]
- Is it possible to change sprite colours in Pygame?
- Trying to delay a specific function for spawning enemy after a certain amount of time
- trying creating dropdown menu pygame, but got stuck
- How to display an image after a time interval?
- How do I use a PyGame timer event? How to add a clock to a pygame screen using a timer?
- Is it possible to make the keyboard module work with pygame and threading
- problems with pygame controller support
- Scale Everything On Pygame Display Surface
- How to move a sprite according to an angle in Pygame
- How to implement barriers to stop the player moving through walls
- Pygame make sprite walk in given rotation
- How to install pygame? [duplicate]
- How to zoom in and out of an image pygame and using the mousposition as the center of the zoom
- How do I add an image as texture of my 3D cube in pyopengl
- How to move the background image with keys in pygame?
- Setting a fixed FPS in Pygame, Python 3
- How to fix this DeprecationWarning
- What is the difference between super() with arguments and without arguments?
- How do I change the volume of the sound or music in PyGame?