-
Notifications
You must be signed in to change notification settings - Fork 0
/
buggyAddingProgram.py
41 lines (29 loc) · 1.12 KB
/
buggyAddingProgram.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s- %(message)s')
logging.debug('Start of program')
def buggyAdder():
print('Enter the first number to add:')
first=input()
first=int(first)
assert first==int(first), first + ' Needs conversion to integer'
print('Enter the second number to add:')
second=input()
second=int(second)
assert second==int(second), second + ' Needs conversion to integer'
print('Enter the third number to add:')
third=input()
third=int(third)
assert third==int(third), third + ' Needs conversion to integer'
total=first + second + third
assert total==int(total), 'If string needs conversion to integer'
#print('The sum is ' + str(first) + str(second) + str(third)) what was happening
total=str(total)
assert total==str(total), total + ' needs converstion to string before printing output'
print('The sum is ' + total)
def main():
logging.debug('Entering main')
buggyAdder()
if __name__ == '__main__':
main()
logging.debug('End of program')