- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIntroduction-Exception-Handling-Debugging.py
More file actions
Latest commit
39 lines (29 loc) · 1 KB
/
Copy pathIntroduction-Exception-Handling-Debugging.py
File metadata and controls
39 lines (29 loc) · 1 KB
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
#basic prgrams
# Debugging
var_1=input('Enter the value of first number')
var_2=input('Enter the value of second number')
try:
int_var_1=int(var_1)
int_var_2=int(var_2)
result=int_var_1/int_var_2
print("Result of division is: ", result)
exceptValueError:
print('Please only enter integer values.')
# take input from the user till the time the values are not integer.
whileTrue:
var1=input('Enter the first number: ')
var2=input('Enter the second number: ')
try:
int_var1=int(var1)
int_var2=int(var2)
break
exceptValueError:
print('Enter only integer values.')
# take value from variable 1, 2 and 3. Compute the difference of variable 1, 2 and then
# divide it's result from variable 3
var1=int(input('Enter the value of first number: '))
var2=int(input('Enter the value of second number: '))
var3=int(input('Enter the value of third number: '))
result=var1-var2
division_result=var3/result
print(division_result)