标签:super oop pre nts text and cal python doc
# 1 vowels = 0 consonants = 0 for letter in ‘supercalifragilisticexpialidocious‘: if letter.lower() in ‘aeiou‘: vowels = vowels + 1 elif letter == ‘ ‘: pass else: consonants = consonants + 1 print(‘There are {} vowels in the text.‘.format(vowels)) print(‘And there are {} consonants in the text.‘.format(consonants)) # 2 students = { ‘male‘: [‘Bob‘, ‘Clark‘, ‘Frank‘, ‘Graig‘], ‘female‘: [‘Alice‘, ‘Emma‘, ‘Helen‘] } for key in students.keys(): for name in students[key]: if ‘a‘ in name: print(name)
标签:super oop pre nts text and cal python doc
原文地址:http://www.cnblogs.com/mxyzptlk/p/7190998.html