6. Conditionals
example
x = 5
if x == 5:
print("x equals 5")
else:
print("x does not equal 5")
it will output
x equals 5
🍏 other operators
x = 6
if x > 5:
print("x greater than 5")
else:
print("x less than 5")
outputs
x greater than 5
other operators
< less than
!= not equal to
>= greater equal to
<= less equal to
smart python
if 3<x<5:
means if x between 3 and 5
@python_codes
example
x = 5
if x == 5:
print("x equals 5")
else:
print("x does not equal 5")
it will output
x equals 5
🍏 other operators
x = 6
if x > 5:
print("x greater than 5")
else:
print("x less than 5")
outputs
x greater than 5
other operators
< less than
!= not equal to
>= greater equal to
<= less equal to
smart python
if 3<x<5:
means if x between 3 and 5
@python_codes
from turtle import *
color('red', 'green')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()
@python_codes
color('red', 'green')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()
@python_codes
AI_ML.pdf
324.4 KB
What is the difference between Artificial Intelligence and Machine Learning ?