Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
394 views
in Technique[技术] by (71.8m points)

executable file window closes halfway (python)

So I wrote a really simple code that multiplies two numbers. This code works perfectly fine when I run it from Visual studio but when I build an exe file of it, it just closes after running half of the code. To be specific, the exe window closes right after I enter the 2nd input. Im very new to programming and stuff pls help

askuser = str.lower(input("This is a program multiplies numbers! Do you wish to use it? 
Y/N
"))

def lol():
    global x
    x = print("Enter a number :(")
    multiply_code()
def multiply_code():
    num2 = (input("Input your first number : 
 "))
    if num2.isalpha():
        lol()
    num1 = (input("Input your second number : 
 "))
    if num1.isalpha():
        lol()
    product = float(num1)*float(num2)
    print(product)
def exitcode():
    print("well, noone asked you to use this in the first place >:(")
if askuser == str("y"):
    multiply_code()
    
else:
    exitcode()
question from:https://stackoverflow.com/questions/65847391/executable-file-window-closes-halfway-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...