day3_作业
s = '132a4b5c' s1 = s[0]+s[2]+s[1] print(s1)#输出123
#使用while和for循环分别打印字符串s=’asdfer’中每个元素。 s = 'asdfer' num = 0 while num < len(s): print(s[num]) num += 1
#使用while和for循环分别打印字符串s=’asdfer’中每个元素。 s = 'asdfer' for num in s: print(num)
#【解析答案】使用while和for循环分别打印字符串s=’asdfer’中每个元素。 s = 'asdfer' for i in s: print(i)
#【解析答案】使用while和for循环分别打印字符串s=’asdfer’中每个元素。 s = 'asdfer' index = 0 while 1: print(s[index]) index += 1 if index == len(s): break