#๐Ÿ”’ sum keeps being 0

17 messages ยท Page 1 of 1 (latest)

warped islandBOT
#

@slow ridge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

gloomy jacinth
#

show the code

#

!paste

warped islandBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

gloomy jacinth
#

or

#

!code

warped islandBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

slow ridge
#
#!/usr/bin/env python
import sys

card1=input()[0]
card2=input()[0]

card1b = 0
card2b = 0

if card1 in {'T', 'J', 'Q', 'K'}:
    card1b = 10
elif card1 == 'A':
    card1b = 11
elif card1.isdigit():
    card1b = int(card1)

if card2 in {'T', 'J', 'Q', 'K'}:
    card2b = 10
elif card2 == 'A':
    card2b = 11
elif card2.isdigit():
    card2b = int(card2)

summed= card1b + card2b

if summed == 21:
    print('Blackjack!')
elif summed == 22:
    print('12')
else:
    print(summed)
gloomy jacinth
#

add a py behind the backticks for syntax highlighting

slow ridge
#

idk who said that but the [0] slices the first character because the input would have a suit

#

i think

icy aurora
#

when looking at this i assume it goes thru all the conditions without them being true

slow ridge
#

like 2H

#

nevermind i solved it

warped islandBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ sum keeps being 0