Source Code:
(back to article)
# If statement x = 10 if x > 0: print("x is positive") elif x == 0: print("x is zero") else: print("x is negative") # For loop for i in range(1, 11): print(i) # While loop i = 1 While i <= 10: print(i) i += 1 # Functions # Define a function def square(x): return x ** 2 # Call the function print(square(5))
Result:
Report an issue