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
32
lecture20261110/if/if01.py
Normal file
32
lecture20261110/if/if01.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
program01 = '''
|
||||
|
||||
Program: if01
|
||||
This program demonstrates the conditional tests used in Python.
|
||||
|
||||
'''
|
||||
|
||||
print(program01)
|
||||
|
||||
a = 4
|
||||
b = 7
|
||||
c = 7
|
||||
|
||||
print(f"a = {a}\nb = {b}\nc = {c}\n")
|
||||
|
||||
print(f"a == b {a==b}")
|
||||
print(f"a != b {a!=b}")
|
||||
print(f"a < b {a<b}")
|
||||
print(f"a <= b {a<=b}")
|
||||
print(f"a > b {a>b}")
|
||||
print(f"a >= b {a>=b}")
|
||||
|
||||
print("\n")
|
||||
|
||||
print(f"c == b {c==b}")
|
||||
print(f"c != b {c!=b}")
|
||||
print(f"c < b {c<b}")
|
||||
print(f"c <= b {c<=b}")
|
||||
print(f"c > b {c>b}")
|
||||
print(f"c >= b {c>=b}")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue