20 likes | 127 Vues
Learn Python functions with simple examples. Follow along to see how values are modified and returned in the code snippets.
E N D
5 7 7 5 7 8 6 8 8 6 8 9 (nothing) What will the following print out? def doit(value): value = value + 1 print value, def main(): x = 5 y = 7 doit(x) doit(y) doit(y) main()
What will the following print out? def doit(number): if number < 5: return ‘small’ else: return ‘big’ def main(): a = doit(4) b = doit(7) print a, print b, main() small big small big small big a b a b a b (nothing)