在Python中运行程序时中断

问题描述 投票:0回答:1

当我在终端中运行此代码**时,我应该按“enter”键在第 6 行之后运行 ** 我不知道问题所在 我正在学习python过程中 预先感谢大家........

print("hi dear,\n welcom to my program in python")
name = input("please enter your name:")


def greeting(name):
    print(input(f"hello dear {name}"))


greeting(name)
question1 = print(input(f"how are you today dear {name}?"))
answer1 = "fine"
if answer1 == True:
    print("good to know that\nGood Luck my Friend")
else:
    print(input(q2="describe for me what happen to you??!!"))
    q2 = ""
    if q2 == True:
        print("ok,no problem...we can solve it.\nplease call to your best friend or doctor for get better.")
else:
    print("contact me on this account\[email protected]!!!")
python terminal runtime-error break autopep8
1个回答
0
投票

试试这个 -

print("hi dear,\n welcom to my program in python")
name = input("please enter your name:")

def greeting(name):
    print(f"hello dear {name}")

greeting(name)
question1 = input(f"how are you today dear {name}? ")
answer1 = "fine"
if answer1 == "fine":
    print("good to know that\nGood Luck my Friend")
else:
    q2 = input("describe for me what happened to you??!! ")
    if q2 == True:
        print("ok, no problem...we can solve it.\nplease call your best friend or doctor to get better.")
    else:
        print("contact me on this account\[email protected]!!!")

要求输入时,不需要 print 关键字。

© www.soinside.com 2019 - 2024. All rights reserved.