【问题标题】:How to convert the input into lowercase [duplicate]如何将输入转换为小写[重复]
【发布时间】:2020-05-29 06:29:21
【问题描述】:

我想知道,我该怎么做才能使即使答案是大写的,它仍然会标记分数?我是python新用户...

colleges = ["MIT", "UAB", "Harvard", "UA", "Standford"]
votes = [0, 0, 0, 0, 0]
Q1 = input("What is important in your future?\na)Invent something important\nb)Helping other people\nc)Know everything\nd)A job that I love\ne)Make the world better\n")
if (Q1 == "a"):
  votes[0] = votes[0]+1
elif (Q1 == "b"):
  votes[1] = votes[1]+1
elif (Q1 == "c"):
  votes[2] = votes[2]+1
elif (Q1 == "d"):
  votes[3] = votes[3]+1
elif (Q1 == "e"):
  votes[4] == votes[4]+1 

【问题讨论】:

标签: python


【解决方案1】:

使用Q1 = input("What is...").lower()

【讨论】:

    猜你喜欢
    • 2018-12-17
    • 1970-01-01
    • 2011-12-13
    • 1970-01-01
    • 2010-12-16
    • 1970-01-01
    • 2016-02-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多