Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
how to make a function to choose random things in python 1

how to make a function to choose random things in python

June 23, 2022 by Anurag batra
import random
def deal_card():
    cards = [11,2,3,4,5,6,7,8,10,10,10,10]
    card = random.choice(cards)
    return card

Here is what the above code is Doing:
1. It creates a list of cards.
2. It chooses a random card from the list.
3. It returns the card.

Categories Python Examples
Post navigation
json formatter terminal
select rows which entries equals one of the values pandas
© MyEduKit - 2022 . All Rights Reserved.