File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "[python]" :{
3+ "editor.defaultFormatter" : " ms-python.black-formatter" ,
4+ "editor.formatOnSave" : true ,
5+ "editor.codeActionsOnSave" : {
6+ "source.organizeImports" : true
7+ }
8+ },
9+ "isort.args" : [" --profile" , " black" ],
10+ }
Original file line number Diff line number Diff line change 1+ empty_list = []
2+
3+ user_choice = None
4+ counter = 0
5+
6+ # Allow user to input numbers to the list
7+ while True :
8+ try :
9+ number = int (input (f"\n Enter a number { counter + 1 } : " ))
10+ empty_list .append (number )
11+ counter += 1
12+ except ValueError :
13+ print ("\n Sorry, you have to input an interger." )
14+
15+ user_choice = input ("Do you wish to continue(Type 'Y' for yes. Any other input means no.)? " )
16+ if user_choice .lower () != "y" :
17+ break
18+
19+ element_sum = sum (empty_list )
20+
21+ print (f"\n The sum of the entered numbers is { element_sum } ." )
You can’t perform that action at this time.
0 commit comments