Hi can some one point me some guidance, i pretend to pass the value of function schema to a variable that will be used as the argument step inside the range module.
i hope its clear .. sorry the newbie guys.
after some trials i got the edit fine.
import os
import sys
def schema(x):
if x == 'M':
step=1
else:
step=2
return step
def main():
left_start = 1
left_end = 9
sch = schema('M')
range1= range(left_start,left_end,sch)
if 2 in range1:
print "In range"
else:
print "Missing in range"
if __name__ == '__main__':
main()
Your code has a problem with indentation. The following:
should read
Otherwise, the function returns
Nonewhenx == 'M'.A more concise way to write that function is: