Added code for lecture 2026-11-10
This commit is contained in:
parent
5b630435ae
commit
07b9e54bf0
52 changed files with 1248 additions and 1 deletions
27
lecture20261110/if/if02.py
Normal file
27
lecture20261110/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