#This error keeps popping up, everything I have works, as I've tested it in a github codespace.

34 messages · Page 1 of 1 (latest)

glad lance
#

This is the actual code, I'm following a video tutorial on somethin, ignore the content lol.

MAX_LINES = 3


def deposit():
    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

def get_number_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 number of lines.")
        else:
            print("Please enter a number.")

    return lines

def main():
    balance = deposit()
    lines = get_number_of_lines()
    print(balance, lines)

    
main()```
#

Not really an error, but, the first lfunction works, just the second doesn't.

compact fossil
#

When you see that it means you didn't call the function

glad lance
#

Could you further expain that?

#

I'm sure everything I did was correct.

#

Because it works elsewhere, just not in vscode.

#

Well atleast my desktop version.

compact fossil
#

Your code looks fine so I think the code you ran isn't the code you shared

glad lance
#

Let me copy and paste it as a test

sonic jacinth
#

Works for me too

glad lance
#

It's the same code

sonic jacinth
#

Ran it with Programiz and w3schools online

glad lance
#

Try it in vscode if you can

#

Idk why it doesn't work in vscode

sonic jacinth
#

Don't have VSC installed

glad lance
#

Oh

#

aight

compact fossil
#

!exec ```py
def example():
return "called"

print("Calling the function:", example())
print("Not calling the function:", example)

surreal micaBOT
compact fossil
#

It's not an editor issue

#

It's a code issue

#

Maybe you haven't saved the file

glad lance
#

Bro

#

Im

#

so

#

stupid

compact fossil
#

Maybe you have two copies of the code and are running the wrong one

glad lance
compact fossil
#

Lol

sonic jacinth
#

Lmao

compact fossil
#

It happens

glad lance
#

Dude, you guys are life savers.

#

Thank you lol

sonic jacinth
#

Better make Ctrl+S a habit before running code, heh