Added week 6
This commit is contained in:
21
week6/ex3.py
Normal file
21
week6/ex3.py
Normal file
@@ -0,0 +1,21 @@
|
||||
def main():
|
||||
print('==Exercise 3==')
|
||||
|
||||
flag=True
|
||||
while flag:
|
||||
a = input("pls input a number:")
|
||||
try:
|
||||
a = int(a)
|
||||
flag=False
|
||||
except :
|
||||
print("pls input a number!")
|
||||
|
||||
print(f"Test if the number {a} is even: {True if a%2==0 else False}")
|
||||
|
||||
#我其实挺想直接a%2==0的,不过尊重一下本节课的主题
|
||||
|
||||
print('==End Of Ex3==')
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user