【简答题】下面程序从键盘输入一个字符串,然后将其中的大写字母转换为小写字母,小写字母转换为大写字母,其他字符不变,请将程序填写完整。 str = input("请输入一个字符串") ns='' for c in str: if c>='A' and c<='Z': ns+=1 elif 2 ns+=c.upper() else: 3 print(ns)
【简答题】下面程序从键盘输入一个字符串,然后将其中的大写字母转换为小写字母,小写字母转换为大写字母,其他字符不变,请将程序填写完整。 str = input("请输入一个字符串") ns='' for c in str: if c>='A' and c<='Z': ns+=1 elif 2 ns+=c.upper() else: 3 print(ns)
【简答题】识别输入的字符串,每个单词输出一行,例如: 输入this is a book 则输出 this is a book #include void word(char s[ ] ) { 请编写代码 } void main() { char str[80]; printf("input string:"); gets(str); word(str); }