输入n个单词,计算每个单词长度.对单词长度排序,分行输出单词长度及其单词. 输入格式: 行1:单词个数n 分行输入n个单词 输出格式: 分行输出单词长度及其单词.(单词长度,单词)用元组表示 输入样例: 5 python list set 996 tuple 输出样例: (3, '996') (3, 'set') (4, 'list') (5, 'tuple') (6, 'python') n = int(input()) ls = [] for i in range(n): s = input…
46 Simple Python Exercises This is version 0.45 of a collection of simple Python exercises constructed (but in many cases only found and collected) by Torbj�rn Lager (torbjorn.lager@ling.gu.se). Most of them involve characters, words and phrases, rat…
46 Simple Python Exercises-Very simple exercises 4.Write a function that takes a character (i.e. a string of length 1) and returns True if it is a vowel, False otherwise. #编写一个函数,该函数接受一个字符(即长度为1的字符串),如果是元音,则返回true,否则返回false. def if_vowel(a): a=a.lowe…
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case letters. If no such two words exist, return 0. Example…