Skip to main content

L 2

This lesson i am learned if and else statements in python.
Here is a basic if/else statement i made with python:

num = int(input("Enter a number and i will check if it is positive: "))

if num > 0:
    print(str(num)+" is positive")
elif num == 0:
    print("i cant answer for 0")
elif num < 0:
    print(str(num)+" is negative")

i have also begun working on for and while loops.
i am currently deconstructing this for loop:

strl = ''

for i in range (0,17):
    if i < 9:
        strl += '. '
        print(strl)
    if i > 8:
        strl = strl[:-2]
        print(strl)

Comments