Untitled

 avatar
unknown
plain_text
a year ago
903 B
15
Indexable
# from 11 to 20 using loops (Past Homework)
for i in range (11,21):
    print(i)
#solution using while loops
i=11    
while i<21:
    print(i) 
    i=i+1   

#if condition
x= 2 
y= 3
if x>y:
    print('True')
else:
    print('False')   

# if elif condition
x= 3 
y= 3
if x>y:
    print('x is greater than y')
elif x==y:   
    print('x is equal to y')     
else:
    print('x is smaller than y')

#if condition
x= 2 
y= 3
if x>=y:
    print('True')
else:
    print('False')   

#simple calculator - to calculate Factorial
i= sprite.input('What is the number?')
sum=1
for i in range(i,0,-1):
    sum=sum*i
print(sum)

#Homework example
street = 11
if street<10:
    print('cars cannot move here')
else:
    print('cars can move here')    


#Home work :
Create an if condition that checks if the student succeeded or not depending on degrees variable
Editor is loading...
Leave a Comment