mercredi 22 janvier 2020

Generating a random number (1-2) as a variable then getting python to do one of two things based on the variable generated

I am making a card game and with 2 players. I want to make a system where it randomly selects one of the players then that player will go first. Here is my code. I am programming in python.

A random number between one and two is determined to decide which player will pick the first card.

  print("Determining which player will go first...")

  first = print(random.randint(1,2))

if first == int(1) :
   print(player1 + " will go first.")

if first == int(2):
   print(player2 + " will go first.")

code (image)

Any help is appreciated




Aucun commentaire:

Enregistrer un commentaire