P_34 Coding Exercise for Beginners in Python | Heads or Tails | Python Tutorials for Beginners

preview_player
Показать описание
In this lecture we have written a virtual Coin Toss Program in which we will generate a random number and based on that it will tell "Heads or Tails"

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #pythonforbeginners #python #jennyslectures #pythonprogramming
Рекомендации по теме
Комментарии
Автор

Madam I from Andhra Pradesh mam. I learnt a lot from you madam. Like speaking skills and programming. Thank you so much madam to come on YouTube madam🥲

surendrag
Автор

today i actually coded this without looking at the answer, i have never felt this happy in many days lol, its the small wins everyday which counts

rizzshitha
Автор

Or this also works:


import random
l=["Heads", "Tails"]
a=random.choice(l)
print(a)

sushruthanayak
Автор

import random
t=(0, 1, 5000)
a=random.choice(t)
print(a)
if a==0:
print("it is heads")
elif a==1:
print("it is tails")
else:
print("neither heads or tails")




(is the above code is right or wrong mam.?)

tarunsai
Автор

Thanku so much ma'am!!! Aapke videos dekh k hi dsa ka exam pass kia h!!! Bs ek request h aapse plz ek aisi video bana dijiye jisme thoda ye clear ho ki cs k konse subject ka aage kya scope h aur konsa sbse jada imp h!!!

shrutijain
Автор

Please tell me some websites to practice python

ALONEBOY-esuc
Автор

Mam can we apply this method also:-
import random
coin=["Head", "Tail"]
print(random.choice(coin))

NajamAfzaal
Автор

import random
coin_toss = random.randint(0, 1)
if coin_toss == 0:
print("Heads")
else:
print("Tails")

tnkmouli
Автор

import random
a=random.randrange(1, 3)
choose=input("Enter what you want to choose : ")
if a == 1 :
print("You got Head")
else:
print("You got Tail")

what about this ?

pwinsider-pwpupil
Автор

Mam please continue c++ videos also...
printf("THANK YOU!");

aquibjawed
Автор

l=[0, 1]
a=random.choice(l)
print(a)
if a==0:
print(" it is head")
else:
print("it is tail")

UmairKhan-pj
Автор

import random

toss = input("Start Toss (press Enter)")
a = random.randint(0, 1)
if a == 0:
print("Heads")
else:
print("Tails")

mrpashabook
Автор

I can't import random module in my compiler .... Can you please clarify this

sumasikharam
Автор

Hi where can i get notes regarding this topics

muralikrishnasaichaitanyam
Автор

import random
toss=random.randint(1, 2)
if(toss==1):
print("your toss is HEAD")
else:
print("your toss is TAIL")

acchuanjan
Автор

#I did the following:
import random as r
l=[0, 1]
r.shuffle(l)
side=r.choice(l)
if (side==0):
print("Tails")
else :
print("Heads")

gautam
Автор

well... i did it like this

import random
a = [0, 1]
b = random.choice(a)
print(b)
if b==1:
print("Heads")
else:
print("Tails")

BankAccount-mj
Автор

from random import *

choice = randrange(0, 2)
if choice == 0:
print("Heads")
else:
print("Tails")

robinx
Автор

import random
a=random.randint(0, 1)
print(a)
if a==0:
print("it is tails")
else:
print("it is heads")

ValliSurvepalli-egpe
Автор

import random
list1=["Head", "Tail"]
a=random.choice(list1)
print(a)

snehakumari