Skip to content

Instantly share code, notes, and snippets.

@tommypratama
Created February 2, 2020 08:06
Show Gist options
  • Save tommypratama/f757e53fa3667f74b0304e6172cbcd80 to your computer and use it in GitHub Desktop.
Save tommypratama/f757e53fa3667f74b0304e6172cbcd80 to your computer and use it in GitHub Desktop.
Random Sample

Random Sample

import random 

cars = ['Innova Venturer', 'Nissan Leaf', 'Camry Hybrid', 'Seri 7', 'Porsche Boxter', 'Tesla 3', 
        'Alphard', 'X4', 'Seri 6', 'C200 coupe']

random = random.sample(range(len(cars)), 2)

print(cars[random[0]], "-", cars[random[1]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment