#๐ Score parameters
11 messages ยท Page 1 of 1 (latest)
@torn kettle
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.
Some function before AceCheck returns None
Remember, you always need to return Score, even if you aren't modifying it, otherwise the function will return None
def PointCalculator(Score):#calculates the total points gained for a round.
print(f"Your score was:\n{Score}")
SlotCards = []
for row in range(0,3):
for column in range(0,3):
SlotCards += SlotGrid[row][column]#creates a list with all the cards in order
for item in range(0,len(SlotCards)):# will go through each item in list to check points.
Score =JokerCheck(SlotCards,Score,item)
Score = PawnCheck(SlotCards,Score,item)
Score =DiceCheck(SlotCards, Score,item)
Score = AceCheck(SlotCards,Score,item)
Score = SuitCheck(SlotCards,Score,item)
Score = KingCheck(SlotCards,Score,item)
print(Score)
return Score
you need to do a lot of rethinking here. first you're constantly overwriting score, then you're also at depth 3 of your nested for loop just returning it. when you return, the whole function exits. this will just return after row 0, column 0, item 0
will never check row 1 or 2, column 1 or 2, etc
oh ok the first isn't a problem, you're passing the score
!e to demonstrate
def some_score():
score = 0
for i in range(2):
for j in range(2):
score += 1
return score # returns on first iteration of innermost loop
def some_better_score():
score = 0
for i in range(2):
for j in range(2):
score += 1
return score # returns after the loops are done
print(some_score())
print(some_better_score())
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 1
002 | 4
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.