Difference between revisions of "CSC111 Midterm Exam Preparation 2015"
Line 146: | Line 146: | ||
Write a loop that prints the first letter of all the words in a list of words. The list is called <tt>farm</tt>. Your program should work no matter how many names are in the list. For example, if the list is equal to <tt>farm = [ "Horse", "Cat", "Dog", "Mouse"]</tt>, the program will print H, C, D, and M, on separate lines. | Write a loop that prints the first letter of all the words in a list of words. The list is called <tt>farm</tt>. Your program should work no matter how many names are in the list. For example, if the list is equal to <tt>farm = [ "Horse", "Cat", "Dog", "Mouse"]</tt>, the program will print H, C, D, and M, on separate lines. | ||
<br /> | <br /> | ||
+ | =Question 15= | ||
+ | <br /> | ||
+ | What is printed by this program? | ||
+ | <br /> | ||
+ | ::<source lang="python"> | ||
+ | line = "Hello World!" | ||
+ | print( line[:5] + line[5: ] ) | ||
+ | </source> | ||
+ | |||
</onlydft> | </onlydft> |
Revision as of 21:01, 28 February 2015
--D. Thiebaut (talk) 18:08, 28 February 2015 (EST)
Midterm Exam Prep
The midterm is an in-class exam given under the rules of the honor code. It lasts 70 minutes. It will be closed books, closed notes, closed computers.