【问题标题】:change case from odd/even argument从奇/偶参数改变大小写
【发布时间】:2018-11-22 16:30:32
【问题描述】:

我应该如何定义一个接收字符串并根据偶数和奇数索引以大写和小写形式返回字符串的函数?

def myfunc(string):
    for some in string:
        if string.index%2==0:

我写了这么多,但我现在不知道该输入什么。

请帮忙。

【问题讨论】:

    标签: string python-3.x function uppercase lowercase


    【解决方案1】:

    Here you can find the string methods 特别看一下upper() 和lower() 这将是你的朋友。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-06
      • 1970-01-01
      相关资源
      最近更新 更多