How to attempt?
Question :
Electrostatics
000 UN
Doug is fond of change, every now and then he tries to do new things. This time, he caught
up with a rod comprising of negative (N) and positive (P) charges. He is asked to calculate
the maximum net electrostatic field possible in the region due to the rod.
9
Note: Assume, Electrostatic Field = Total charge * 100
10
Input Specification:
input1: integer array denoting the magnitude of each charge
input2: String denoting nature of each charge, ith entry represents a sign of
charge at ith location in input1
input3: No. of charges it holds (length of input1)
Output Specification:
Return the maximum electrostatic fiold nonni
Answers
Answered by
7
Answer:
c=list(map(int,input().split())
e=input()
a=int(input())
count=0
for I in range(a):
if e[I]=='p':
count = count+c[I]
else
count = count-c[I]
print(abs(count*100))
Similar questions