【发布时间】: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
我应该如何定义一个接收字符串并根据偶数和奇数索引以大写和小写形式返回字符串的函数?
def myfunc(string):
for some in string:
if string.index%2==0:
我写了这么多,但我现在不知道该输入什么。
请帮忙。
【问题讨论】:
标签: string python-3.x function uppercase lowercase
Here you can find the string methods 特别看一下upper() 和lower() 这将是你的朋友。
【讨论】: