Added week 7

This commit is contained in:
2026-04-20 09:35:37 +08:00
parent 9b90ac4340
commit 734ca9d761
10 changed files with 166 additions and 0 deletions

24
week7/Assignment/ex2.py Normal file
View File

@@ -0,0 +1,24 @@
def main():
print('==Assignment 2==')
flag=True
while flag:
a = input("pls input number:")
try:
a = int(a)
flag=False
except :
print("pls input a number!")
counter=0
total=0
while counter<a:counter+=1;total+=counter
print(f"Total from 1 to a: {total}")
print('==End Of Assi2==')
return 0
if __name__ == '__main__':
main()