上传文件至「week12」
This commit is contained in:
18
week12/ex2.py
Normal file
18
week12/ex2.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from continueanyway import ca
|
||||
|
||||
@ca
|
||||
def ValidateInteger(i):
|
||||
if type(i)==int:
|
||||
print(f"{i} is a valid int")
|
||||
return i
|
||||
raise ValueError(f"The given number {i} is not a int")
|
||||
|
||||
def main():
|
||||
ValidateInteger("10")
|
||||
ValidateInteger(10.0)
|
||||
ValidateInteger("dshjkfsdjhfkjsd")
|
||||
ValidateInteger(10)
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user