diff --git a/tests/CleanScreen.py b/tests/CleanScreen.py new file mode 100644 index 0000000..80714ef --- /dev/null +++ b/tests/CleanScreen.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +# import only system from os +from os import system, name + +# import sleep to show output for some time period +from time import sleep + + +# define our clear function +def clear(): + # for windows + if name == 'nt': + _ = system('cls') + + # for mac and linux(here, os.name is 'posix') + else: + _ = system('clear') + + # print out some text + + +print('Hello CWIKIUS\n' * 10) + +# sleep for 2 seconds after printing output +sleep(2) + +# now call function we defined above +clear() diff --git a/tests/Variables.py b/tests/Variables.py index 5384a49..c5f830e 100644 --- a/tests/Variables.py +++ b/tests/Variables.py @@ -24,9 +24,11 @@ print(x) print(y) # 类型转换 -x = str(3) # x will be '3' -y = int(3) # y will be 3 -z = float(3) # z will be 3.0 +x1 = str(3) # x will be '3' +x2 = int(3) # y will be 3 +x3 = float(3) # z will be 3.0 +x4 = chr(31243) # z will be 3.0 +x5 = ord('程') # z will be 3.0 # 获得类型 print("==================")