以下程序执行结果是________。 string = ["PHP", "Python", "C", "C++", "Java"] for item in string: item_temp = item.lower() for i in range(len(item)): if item_temp[i] in 'aeiou': string.remove(item) break print(string) s = sorted(string, reverse = True) print(s)[/i]
举一反三
- 下面程序的运行结果是(). void delch(char *s) { int i,j; char *a; a=s; for(i=0,j=0;a[i]!='\0';i++) if(a[i]>='0'&&a[i]<='9') {s[j]=a[i];j++;} s[j]='\0'; } main() { char *item="a34bc"; delch(item); printf("\n%s",item); }
- 程序运行结果为(______ )fruit = ['apple', 'banana', 'mango', 0]for item in fruit: if item == 0: fruit[item] = 'watermelon' elif item == 'mango': fruit[2] = 'pear'print(fruit)
- 以下类方法定义正确的是() A: class Student: fav=("唱歌","跳舞","绘画") def showFav(cls): for item in cls.fav: print(item) B: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in fav: print(item) C: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in cls.fav: print(item) D: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(): for item in fav: print(item)
- 接受用户输入,并将其输出为逗号分隔的格式。 item=input(”请输入商品名称:”) sales=input(“请输入商品数量:”) 输出结果需要满足下列要求: 字符串应当在双引号中 数值不能在引号或者其他符号中 每个项目用逗号分隔 请选择正确的3项 A: print(f’”{item}”,{sales}’) B: print(item + ‘,’ + sales) C: print(’”’ + item + ‘”,‘ + sales) D: print(f”{item},{sales}”) E: print(’”%s”, %s’ % (item, sales))
- 将字符串中的数字字符删除后输出。 #include "stdio.h" void delnum(char s[]) { int i,j; for(i=0,j=0;【1】;i++) if(s[i]<'0' 【2】 s[i]>'9') { s[j]=s[i]; j++; } 【3】; } main() { char item[50]; gets(item); 【4】; printf("%s ",item); }