File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change 1
- def res (R1 , R2 ):
2
- sum = R1 + R2
3
- if (option == "series" ):
4
- return sum
5
- else :
6
- return (R1 * R2 )/ (R1 + R2 )
7
- Resistance1 = int (input ("Enter R1 : " ))
8
- Resistance2 = int (input ("Enter R2 : " ))
9
- option = str (input ("Enter series or parallel :" ))
10
- print ("\n " )
11
- R = res (Resistance1 ,Resistance2 )
12
- print ("The total resistance is" , R )
1
+ def res (R1 , R2 ):
2
+ sum = R1 + R2
3
+ if option == "series" :
4
+ return sum
5
+ elif option == "parallel" :
6
+ return (R1 * R2 )/ sum
7
+ return 0
8
+ Resistance1 = int (input ("Enter R1 : " ))
9
+ Resistance2 = int (input ("Enter R2 : " ))
10
+ option = input ("Enter series or parallel :" )
11
+ print ("\n " )
12
+ R = res (Resistance1 ,Resistance2 )
13
+ if R == 0 :
14
+ print ('Wrong Input!!' )
15
+ else :
16
+ print ("The total resistance is" , R )
You can’t perform that action at this time.
0 commit comments