改变奇数/偶数参数的情况

时间:2018-06-13 07:24:27

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

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

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

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

请帮忙。

1 个答案:

答案 0 :(得分:0)

Here you can find the string methods请特别注意将在这里成为你朋友的upper()和lower()。