PYTHON FINAL EXAM ANSWERS(2012)
1.8.0 % 4
3 / 4
2. 1
3. 40
NEW DELHI: Although no Indian institution of higher learning is yet to make it to the top 200 in the Times Higher Education's (THE) World University Rankings list 2013-14, one new entrant — Panjab University— is closer to that elite group. Panjab University is the highest ranked Indian institution clubbed in the group of universities ranked between 226-250 ranks.def mystery(s):
""" (str) -> bool
"""
matches = 0
for i in range(len(s) // 2):
if s[i] == s[len(s) - 1 - i]: # <-- How many times is this line reached?
matches = matches + 1
return matches == (len(s) // 2)
mystery('civil')
Trace the function call mystery('civil') using the Python Visualizer. How many times is the line marked above reached?values = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]Using
values and indexing with non-negative indices, write an expression that evaluates to 5. Do not use addition, subtraction, or parentheses ( ) (brackets [ ] are required).breakfast = [['French', 'toast'], ['blueberry', 'pancakes'], ['scrambled', 'eggs']]
Using breakfast and indexing with only negative indices, write an expression that evaluates to 'blueberry'. Do not use addition, subtraction, or parentheses ( ) (brackets[ ] are required).