+ 1

How can I print a result which shows how many heads and how many tails have been shown

Eg:- Heads Tails Tails Heads https://code.sololearn.com/c7wdLABs1tuw/?ref=app

28th Aug 2023, 2:27 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar
4 Antworten
+ 7
Sreeju , it is not seen as very helpful when we are going to post a ready-made code. it is more helpful to give hints and tips, so that the op has a chance to find a solution by himself.
28th Aug 2023, 10:31 AM
Lothar
Lothar - avatar
+ 3
import random # Change range value to print more for i in range(10): coin = random.randint(1,2) if coin == 2: print("Heads") else: print("Tails")
28th Aug 2023, 3:21 AM
Sreeju
Sreeju - avatar
+ 3
That's right
28th Aug 2023, 10:47 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar
+ 1
Thank you
28th Aug 2023, 4:02 AM
P A Arrchith Iyer
P A Arrchith Iyer - avatar