课程第三讲
school = 'Massachusetts Institute of Technology' numVowels = 0 numCons = 0 for char in school: if char == 'a' or char == 'e' or char == 'i' or char == 'o' or char == 'u': numVowels += 1 elif char == 'o' or char == 'M': print char else: numCons -= 1 print 'numVowels is: ' + str(numVowels) print 'numCons is: ' + str(numCons)
How many times doesoprint out? Disregard theo's in last two print statements.
0, if 为True ,就不判断下面的elif else.
What will the value of the variable numVowels be?
11,大写I没算
What will the value of the variable numCons be?
-25,加空格。
最后
以上就是快乐钢笔最近收集整理的关于MIT 6.00.1x 笔记的全部内容,更多相关MIT内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复