max
returns the maximal value of a string
as well as a list. What is max("science")
and why?
reversed(sorted([5,4,1,2,8]))
and
why?
sorted(lst).index(min(lst))
for
any list lst
? Why? What's the value if
min
is replaced by max
?
str.endswith(str[-3:])
True?
st.upper().endswith(st)
True?
(Provide a specific example of when it's true and try to generalize)
in
operator determines if its left operand occurs
in its right operand and returns a boolean value. This means
'a' in 'stranger'
evaluates to True. What
is the value of 5 in [1,2,3,4]
?
st[0:2] in st
is False?
(Provide a specific example of when it's true and try to generalize)
st[0:2]*2 in st
is True?
(Provide a specific example of when it's true and try to generalize)
lst.count(lst[0])
the same
as the value of len(lst)
for a list lst
?
(Provide a specific example of when it's true and try to generalize)
Example A: Example B: Example C:
is_leap
returns true if year is a leap year and false otherwise. For each one list
whether or not it is correct.
If a method is not correct, provide a value for year for which it returns the wrong value.
FIRST ONE: SECOND ONE: THIRD ONE:
def all_same (value1, value2, value3):
maxPoints([2,2,4,5,4])
and why?
toss
?
elif
won't work with an example: