简体   繁体   English

如何检查用户输入中的两件事

[英]How to check two things in user input

I would like to check if my option string and my option string int are equal to BOTH values D and D. Does not pair with them both. 我想检查我的选项字符串和我的选项字符串int是否等于值D和D。两者都不配对。

if option + option_2 == "D" and "D":
    rate = r()
    time = t()
    distance = velocity * time
    print (f"The distance traveled is {distance} meters")
    exit()`

您可以改用以下条件:

if option == option_2 == "D":

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM