Algorithms For Dummies


Challenging Difficult Problems



Download 7,18 Mb.
Pdf ko'rish
bet534/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   530   531   532   533   534   535   536   537   ...   651
Bog'liq
Algorithms

 Challenging Difficult Problems

card, which amounts to 1 after picking all the cards: (1/52) * 52 = 1. Instead, you 

can change this simple random algorithm by discarding the cards that you’ve seen 

from your possible choices:

from random import choice

my_cards = deck.copy()

guessed = 0

for card in deck:

    if card == choice(my_cards):

        guessed 

+= 1

    else:



        my_cards.pop(my_cards.index(card))

print ('Guessed %i card(s)' % guessed)

Guessed 1 card(s)

Now, on average, you’ll guess the right card more often because as the deck 

decreases, your chances of guessing increases and you’ll likely guess correctly 

more often when nearing the end of the game. (Your chances are 1 divided by the 

number of cards left in the deck).

Counting cards can provide an advantage in card games. A team of MIT students 

used card counting and probability estimates to win huge amounts in Las Vegas 

until the practice was banned from Casinos. The story even inspired a 2008 film 

entitled 21, starring Kevin Spacey. You can read more about the story at: 

http:// 


www.bbc.com/news/magazine-27519748.


Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   530   531   532   533   534   535   536   537   ...   651




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish