import random import pygame x = random.randint(1,3) print(x) pygame.init() pygame.mixer.init() if (x==1): rainSound = pygame.mixer.music.load('/home/pi/Rain1.mp3') elif (x==2): rainSound = pygame.mixer.music.load('/home/pi/Rain2.mp3') elif (x==3): rainSound = pygame.mixer.music.load('/home/pi/Rain3.mp3') pygame.mixer.music.play() pygame.event.wait()