Python跳过Elif语句

时间:2018-09-07 02:24:52

标签: python python-3.x

我正在尝试编写一个程序,该程序根据用户键入的输入来打印字典中的值和键。当第11行的elif语句被跳过时,将出现问题。 if 语句是否为假,都将跳过 elif 语句。我正在学习,所以我真的不知道我的错误在哪里。感谢您的帮助!

areaM = {str(1) + " acre" : str(160) + " sq rods"}
linearM = {str(1) + " ft" : str(12) + " in", str(1) + " yd": str(3) + " ft"}

def displayConversion(conv):
    for k, v in conv.items():
        print(str(v) + " = " + str(k))
while True:
    print("Enter a conversion")    
    if input() == "Area Meassure":
        displayConversion(areaM)
    elif input() == "Linear Meassure":
        displayConversion(linearM)
    else:
        print("Conversion not available")

1 个答案:

答案 0 :(得分:1)

也许这是完整的代码(public async Task<IEnumerable<Tag>> AllTags() { return await _context.Tags .Include(q => q.PostTags).ThenInclude(q => q.Post); } 太多):

inputs