Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to use return value from one function inside another function?

$
0
0

Basically, I've created my first function and it has a return value. I want to use this return value in another function. It's Python code in PyCharm and I am beginner so I'm still new with terms and everything.

This is my first function:

def deposit():  # amount he wants to bet with    while True:        amount = input("What would you like to deposit? $")        if amount.isdigit():            amount = int(amount)            if amount > 0:                break            else:                print("Amount must be greater than 0$")        else:            print("Please enter a number")    return amount

This is my second function:

def get_bet():    balance = amount   **HERE IS MY PROBLEM**    while True:        bet = input("What would you like to bet on each line? $")        if bet.isdigit():            bet = int(bet)            if bet <= balance:                if MIN_BET <= bet <= MAX_BET and bet <= balance:                    break                else:                    print(f"Bet must be between ${MIN_BET} - ${MAX_BET} ")            else:                print(f"Bet must be within your balance of ${balance} ")        else:            print("Please enter a number")    return bet

Thanks in advance


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>