21 lines
634 B
Python
Executable File
21 lines
634 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import math
|
|
|
|
print("This code is not indented, and is assumed to be in the global scope")
|
|
|
|
def foo(a,b):
|
|
#the contents of the function are indented
|
|
print(a)
|
|
print(b)
|
|
c = 0
|
|
for I in range(0,5):
|
|
#the contents of the loop are indented relative to the loop statement
|
|
#this is a for loop that will increment the variable I until it reaches 5, (4 being the last time it executes the loop)
|
|
|
|
print("I",I,"c",c)
|
|
c = c + a - b
|
|
return c #the return value of the function
|
|
|
|
ret = foo(4,5) #calling the function we just defined
|
|
print("ret = ", ret) |