Python Heads and Tails

camwoo123

I need help for a Python game I am currently creating. When running the code it will stay open and do nothing after entering a number of times to flip. Here is what I have so far:

# Heads and Tails generator
# User how many times they wish to flip a coin and will recieve the results
CoinTosses = int(input("How many coins do you wish to flip: "))
Heads = 0
Tails = 0
CurrentCoinToss = 0
from random import randint
while CoinTosses != 0:
    CurrentCoinToss == int(randint(1, 2))
    if CurrentCoinToss == 1:
        Heads += 1
        CoinTosses -= 1
    if CurrentCoinToss == 2:
        Tails += 1
        CoinTosses -= 1
print("During this round you recieved: ", Heads, " and", Tails, " Tails!")
input("Press the enter key to exit")

What is wrong with this? I have studied my code and nothing SHOULD be wrong.

FrozenHeart

Change this line

CurrentCoinToss == int(randint(1, 2))

to this

CurrentCoinToss = int(randint(1, 2))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

python - infinite coin flip that stops when number of heads = number of tails

From Dev

python - infinite coin flip that stops when number of heads = number of tails

From Dev

How flipping a coin and display tails and heads counting?

From Dev

can someone explain this short segment of C++ code, I can't make heads or tails of it

From Dev

How do I traverse through a linked list after adding tails rather than heads

From Dev

can someone explain this short segment of C++ code, I can't make heads or tails of it

From Dev

Game: nine heads and tails. I am having trouble with binary stuff

From Dev

Using heads or tails to choose a between to sprites which will spawn and to choose the speed that the sprite will move

From Dev

Python Singly Linked Lists with Tails

From Dev

Elegant way to iterate over heads of lists in Python

From Dev

How to join correctly join words that trails or heads of dashes? - python

From Dev

How to get arrow heads tip to start/end at specified coordinates in Python?

From Dev

Monte-Carlo Simulation of expected tosses for two consecutive heads in python

From Dev

Tails - Package 'python3-tk' has no installation candidate

From Dev

Problems with Tails

From Dev

hg heads shown two heads but nothing to merge

From Dev

Git heads messed up?

From Dev

Notification without "heads up"

From Dev

Control the number of arrow heads

From Dev

Tails: How to connect Tails to a Samba network share?

From Dev

Pipe the heads of two files to a file

From Dev

Why are instances matched only by their heads?

From Dev

Removing heads from lists in Prolog

From Dev

Handling multiple heads after graft

From Dev

Interpretation of number of heads returned by fdisk

From Dev

Compare the heads of two files in bash

From Dev

Calculating no of heads using CHS formula

From Dev

Building WebRTC on specific branch heads

From Dev

JSQmessageviewcontroller: Bubbles without tails

Related Related

  1. 1

    python - infinite coin flip that stops when number of heads = number of tails

  2. 2

    python - infinite coin flip that stops when number of heads = number of tails

  3. 3

    How flipping a coin and display tails and heads counting?

  4. 4

    can someone explain this short segment of C++ code, I can't make heads or tails of it

  5. 5

    How do I traverse through a linked list after adding tails rather than heads

  6. 6

    can someone explain this short segment of C++ code, I can't make heads or tails of it

  7. 7

    Game: nine heads and tails. I am having trouble with binary stuff

  8. 8

    Using heads or tails to choose a between to sprites which will spawn and to choose the speed that the sprite will move

  9. 9

    Python Singly Linked Lists with Tails

  10. 10

    Elegant way to iterate over heads of lists in Python

  11. 11

    How to join correctly join words that trails or heads of dashes? - python

  12. 12

    How to get arrow heads tip to start/end at specified coordinates in Python?

  13. 13

    Monte-Carlo Simulation of expected tosses for two consecutive heads in python

  14. 14

    Tails - Package 'python3-tk' has no installation candidate

  15. 15

    Problems with Tails

  16. 16

    hg heads shown two heads but nothing to merge

  17. 17

    Git heads messed up?

  18. 18

    Notification without "heads up"

  19. 19

    Control the number of arrow heads

  20. 20

    Tails: How to connect Tails to a Samba network share?

  21. 21

    Pipe the heads of two files to a file

  22. 22

    Why are instances matched only by their heads?

  23. 23

    Removing heads from lists in Prolog

  24. 24

    Handling multiple heads after graft

  25. 25

    Interpretation of number of heads returned by fdisk

  26. 26

    Compare the heads of two files in bash

  27. 27

    Calculating no of heads using CHS formula

  28. 28

    Building WebRTC on specific branch heads

  29. 29

    JSQmessageviewcontroller: Bubbles without tails

HotTag

Archive