0
MAX_LINES = 3


def user_deposit():
    while True:
        deposit_amount = input("what is your deposit amount? ")
        if deposit_amount.isdigit():
            deposit_amount = int(deposit_amount)
            if deposit_amount > 0:
                break
            else:
                print("enter a valid amount please.")
        else:
            print("please enter a number.")

    return deposit_amount


def get_num_of_lines():
    while True:
        lines = input(
            "enter the number of lines to bet on (1-" + str(MAX_LINES) + ").")
        if lines.isdigit():
            lines = int(lines)
            if 1 <= lines <= MAX_LINES:
                break
            else:
                print("enter a valid line number.")
        else:
            print("please enter a line number.")

    return lines


def main():
    balance = user_deposit
    lines = get_num_of_lines
    print(balance, lines)


main()

I am trying to take the user's deposit and take the user's desired line. The whole project is essentially a text-based slot machine. I am a beginner, and I am essentially doing it with a guy from Youtube. I know that the hex value represents where the object is stored in memory.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
  • 3
    Hey Diego. Please always tag your questions with the language & runtimes. As you may guess, `function` doesn't do it. I guess you need parenthesis: `get_num_of_lines()` and `user_deposit()`? – Maarten Bodewes Mar 04 '23 at 23:25
  • wow, thank you. Such an easy mistake, and thank you for the tip. – Diego Jimenez Mar 04 '23 at 23:35

2 Answers2

1

the reason you are getting the memory addresses for the functions is because both balance and lines are aliases to them. It seems as if you are trying to call those functions and assign the value they return to balance and lines. For this you have to invoke the functions by using ( and ).

Good luck and welcome to Stack overflow.

Dario
  • 228
  • 1
  • 9
-1

You forgot to add parenthesis to the function calls in main().

Correction:

def main():
    balance = user_deposit()
    lines = get_num_of_lines()
    print(balance, lines)
AbdelRahman
  • 242
  • 10