Lecture 11/17/2026
This commit is contained in:
parent
07b9e54bf0
commit
bf3265103a
44 changed files with 1195 additions and 3 deletions
27
lecture20261117/if/if02.py
Normal file
27
lecture20261117/if/if02.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
# if statement example
|
||||
if 22 > 7:
|
||||
print("22 is greater than 7")
|
||||
|
||||
print("A better method to define the code ...")
|
||||
|
||||
# Use variables in the if statement and print
|
||||
data1 = 22
|
||||
|
||||
|
||||
if data1 > 7:
|
||||
print(f"{data1} is greater than 7")
|
||||
|
||||
|
||||
# Or this form
|
||||
print("And another method to define the code ...")
|
||||
|
||||
|
||||
data1 = 22
|
||||
data2 = 7
|
||||
|
||||
if data1 > data2:
|
||||
print(f"{data1} is greater than {data2}")
|
||||
|
||||
print("Program ended")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue