I meant something more like this
Also nothing is storing the returns from "score"
import random def main(): totalCards = 52 playerOne = 0 playerTwo = 0 pOneScore = 0 pTwoScore = 0 deck = [] suit = [] totalList = [] deck = ["Ace","King","Queen","Jack",2,3,4,5,6,7,8,9,10] suit = ["of spades","of hearts","of clubs","of diamonds"] for num in deck: for suitType in suit: totalList.append(str(num) + ' ' + suitType) print("Welcome to war. Press any button to deal a hand.") while (totalCards > 0): input() print("Cards are being delt!") print() theOutput = dealCard(totalList, playerOne, playerTwo) totalList = theOutput[0] playerOne = theOutput[1] playerTwo = theOutput)[2] print() score(playerOne, playerTwo, pOneScore, pTwoScore) totalCards -= 2 print(totalCards, "cards remain in the deck.") print("Player one's score: ", pOneScore) print("Player two's score: ", pTwoScore) print("The game of war has ended!") print("The final score is: ") def dealCard(totalList, playerOne, playerTwo): playerOneSuit = "" playerTwoSuit = "" playerOne = random.choice(totalList) print("Player one: ",playerOne, playerOneSuit) totalList.remove(playerOne) playerTwo = random.choice(totalList) print("Player two: ",playerTwo, playerTwoSuit) totalList.remove(playerTwo) return totalList, playerOne, playerTwo def score(playerOne, playerTwo, pOneScore, pTwoScore): playerOne = playerOne.split() playerTwo = playerTwo.split() try: int(playerOne[0]) pOne = playerOne + 3 except: if playerOne == ("Ace of spades") or ("Ace of clubs") or ("Ace of hearts") or ("Ace of diamonds"): pOne = 1 elif PlayerOne == ("King of spades") or ("King of clubs") or ("King of hearts") or ("King of diamonds"): pOne = 2 elif PlayerOne == ("Queen of spades") or ("Queen of clubs") or ("Queen of hearts") or ("Queen of diamonds"): pOne = 3 elif PlayerOne == ("Jack of spades") or ("Jack of clubs") or ("Jack of hearts") or ("Jack of diamonds"): pOne =4 try: int(playerTwo[0]) pOne = playerOne + 3 except: if playerTwo == ("Ace of spades") or ("Ace of clubs") or ("Ace of hearts") or ("Ace of diamonds"): pTwo = 1 elif playerTwo == ("King of spades") or ("King of clubs") or ("King of hearts") or ("King of diamonds"): pTwo = 2 elif playerTwo == ("Queen of spades") or ("Queen of clubs") or ("Queen of hearts") or ("Queen of diamonds"): pTwo = 3 elif playerTwo == ("Jack of spades") or ("Jack of clubs") or ("Jack of hearts") or ("Jack of diamonds"): pTwo = 4 #debug print("DEBUG", pTwo) if pOne > pTwo: print("Player 2 wins the hand!") pTwoScore += 1 elif pOne < pTwo: print("Player 1 wins the hand!") pOneScore += 1 elif pOne == pTwo: print("It's a tie!") return playerOne, playerTwo, pOneScore, pTwoScore main()May be a few syntax errors, sorry.
Also nothing is storing the returns from "score"