Beginner Pythonista here
Making a betting game as part of an OOP exercise.
made a Player class with a bet function:
# Player Class
class Player():
def __init__(self,name):
self.name = name
self.hand = []
self.chips = 0
def deposit(self,amount):
self.chips += int(amount)
print(f"{amount} chips deposited.\nTotal available funds: {self.chips}")
def bet(self):
amount = int(input("Place your bet: "))
if not amount > self.chips:
self.chips -= amount
print(f"You bet {amount}. New Balance: {self.chips}")
return amount
else:
print("You cannot bet above your chips")
I was under the impression that a method within a class acted as a function, but the "return amount" command returns "None/NoneType".
How can I return the integer value to add to assign to a variable?
Thanks in advance