Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Today at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Python Bootcamp 100 Days of Code
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Honda.putha" data-source="post: 26633955" data-attributes="member: 565644"><p>[CODE=python]import random</p><p>from replit import clear</p><p>from art import logo</p><p></p><p>def deal_card():</p><p> cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]</p><p> return random.choice(cards)</p><p></p><p>def calculate_score(cards):</p><p> if sum(cards) == 21 and len(cards) == 2:</p><p> return 0</p><p> </p><p> if 11 in cards and sum(cards) > 21:</p><p> cards.remove(11)</p><p> cards.append(1)</p><p> </p><p> return sum(cards)</p><p></p><p>def compare(user_score,computer_score):</p><p></p><p> if user_score == computer_score:</p><p> print("Drawn!")</p><p> elif computer_score == 0:</p><p> print("Computer wins with a BlackJack")</p><p> elif user_score == 0:</p><p> print("User win with a BlackJack")</p><p> elif user_score > 21:</p><p> print("User loses with over scoring.")</p><p> elif computer_score > 21:</p><p> print("Computer lose with over scoring. ")</p><p> elif computer_score > user_score:</p><p> print("Computer win.")</p><p> elif computer_score < user_score:</p><p> print("User win.")</p><p> </p><p></p><p>def play_game():</p><p></p><p> print(logo)</p><p></p><p> is_game_over = False</p><p></p><p> user_cards = []</p><p> computer_cards = []</p><p></p><p> for _ in range(2):</p><p> user_cards.append(deal_card())</p><p> computer_cards.append(deal_card())</p><p></p><p></p><p> while not is_game_over:</p><p></p><p> user_score = calculate_score(user_cards)</p><p> computer_score = calculate_score(computer_cards)</p><p> print(f" Your cards: {user_cards}, current score: {user_score}")</p><p> print(f" Computer's first card: {computer_cards[0]}")</p><p> </p><p> if user_score == 0 or computer_score == 0 or user_score >21:</p><p> is_game_over = True</p><p> else:</p><p> continue_deal = input("Press 'y' if you want to deal another card or 'n' to stop: ").lower()</p><p> if continue_deal == 'y':</p><p> user_cards.append(deal_card())</p><p> else:</p><p> is_game_over = True</p><p> </p><p> if not (user_score == 0 or computer_score == 0 or user_score >21):</p><p> while computer_score < 17:</p><p> computer_cards.append(deal_card())</p><p> computer_score = calculate_score(computer_cards)</p><p></p><p> print(f" Your final hand: {user_cards}, final score: {user_score}")</p><p> print(f" Computer's final hand: {computer_cards}, final score: {computer_score}")</p><p> print(compare(user_score, computer_score))</p><p></p><p>while input("Do you want to continue playing BlackJack? 'y' ").lower() == 'y':</p><p> clear()</p><p> play_game()[/CODE]</p><p></p><p>මේ කෝඩ් එකෙන් None කියලා ප්රින්ට් වෙනවානෙ. කොහෙන්ද හොයාගන්න බෑ.</p><p></p><p>[ATTACH=full]134471[/ATTACH]</p><hr /><p>#Day 12 done</p><p>------ <span style="font-size: 10px">Post added on [DATETIME="UT"]1625798635[/DATETIME]</span></p></blockquote><p></p>
[QUOTE="Honda.putha, post: 26633955, member: 565644"] [CODE=python]import random from replit import clear from art import logo def deal_card(): cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] return random.choice(cards) def calculate_score(cards): if sum(cards) == 21 and len(cards) == 2: return 0 if 11 in cards and sum(cards) > 21: cards.remove(11) cards.append(1) return sum(cards) def compare(user_score,computer_score): if user_score == computer_score: print("Drawn!") elif computer_score == 0: print("Computer wins with a BlackJack") elif user_score == 0: print("User win with a BlackJack") elif user_score > 21: print("User loses with over scoring.") elif computer_score > 21: print("Computer lose with over scoring. ") elif computer_score > user_score: print("Computer win.") elif computer_score < user_score: print("User win.") def play_game(): print(logo) is_game_over = False user_cards = [] computer_cards = [] for _ in range(2): user_cards.append(deal_card()) computer_cards.append(deal_card()) while not is_game_over: user_score = calculate_score(user_cards) computer_score = calculate_score(computer_cards) print(f" Your cards: {user_cards}, current score: {user_score}") print(f" Computer's first card: {computer_cards[0]}") if user_score == 0 or computer_score == 0 or user_score >21: is_game_over = True else: continue_deal = input("Press 'y' if you want to deal another card or 'n' to stop: ").lower() if continue_deal == 'y': user_cards.append(deal_card()) else: is_game_over = True if not (user_score == 0 or computer_score == 0 or user_score >21): while computer_score < 17: computer_cards.append(deal_card()) computer_score = calculate_score(computer_cards) print(f" Your final hand: {user_cards}, final score: {user_score}") print(f" Computer's final hand: {computer_cards}, final score: {computer_score}") print(compare(user_score, computer_score)) while input("Do you want to continue playing BlackJack? 'y' ").lower() == 'y': clear() play_game()[/CODE] මේ කෝඩ් එකෙන් None කියලා ප්රින්ට් වෙනවානෙ. කොහෙන්ද හොයාගන්න බෑ. [ATTACH type="full"]134471[/ATTACH] [HR][/HR] #Day 12 done ------ [SIZE=2]Post added on [DATETIME="UT"]1625798635[/DATETIME][/SIZE] [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom