Question: In python can anyone help me to implement function with for-loops in this please def lesser(tup,value): Returns the number of elements in tup strictly
In python can anyone help me to implement function with for-loops in this please def lesser(tup,value): """ Returns the number of elements in tup strictly less than value Examples: lesser((5, 9, 1, 7), 6) returns 2 lesser((1, 2, 3), -1) returns 0 Parameter tup: the tuple to check Precondition: tup is a non-empty tuple of ints Parameter value: the value to compare to the tuple Precondition: value is an int """ result = 0 for x in tup: result = introcs.rindex_tup(tup, x) return result #pretty sure what I have rn is wrong
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
