-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5aa23ca
commit 819313a
Showing
1 changed file
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
def res(R1, R2): | ||
sum = R1 + R2 | ||
if (option =="series"): | ||
return sum | ||
else: | ||
return (R1 * R2)/(R1 + R2) | ||
Resistance1 = int(input("Enter R1 : ")) | ||
Resistance2 = int(input("Enter R2 : ")) | ||
option = str(input("Enter series or parallel :")) | ||
print("\n") | ||
R = res(Resistance1,Resistance2 ) | ||
print("The total resistance is", R) | ||
def res(R1, R2): | ||
sum = R1 + R2 | ||
if option =="series": | ||
return sum | ||
elif option =="parallel" : | ||
return (R1 * R2)/sum | ||
return 0 | ||
Resistance1 = int(input("Enter R1 : ")) | ||
Resistance2 = int(input("Enter R2 : ")) | ||
option = input("Enter series or parallel :") | ||
print("\n") | ||
R = res(Resistance1,Resistance2 ) | ||
if R==0: | ||
print('Wrong Input!!' ) | ||
else: | ||
print("The total resistance is", R) |