I am really happy to share python program which is written by Omkar Pawar and feeling proud of Omkar Pawar for his great efforts and implementing knowledge of C++ at greater level.
Logic of program will remain same but language may change.
[12:03 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: from array import *
incoming_c=array('i', [])
n=int (input('Enter the no. of incoming currents: '))
for i in range(n):
incoming_c.append(int(input('Enter the incoming currents: ')))
for i in range(len(incoming_c)):
print(incoming_c[i])
outgoing_c=array('i', [])
m=int (input('Enter the no. of outgoing currents: '))
for i in range(m-1):
outgoing_c.append(int(input('Enter the outgoing currents: ')))
for i in range(len(outgoing_c)):
print(outgoing_c[i])
sumi=sum(incoming_c)
sumo=sum(outgoing_c)
r=sumi-sumo
r=float(r)
if r>0:
print('Unknown current is an outgoing current of value: ',r)
else:
print('Unknown current is an incoming current of value: ',-r)
print('Done')
[12:04 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Python program for KCL👆🏻
Omkar Pawar
Output:
[12:04 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Output😊
[12:05 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Coded by me sir
[12:06 PM, 7/8/2020] SD Bhosale: May I know your name please?
[12:06 PM, 7/8/2020] SD Bhosale: contact number is missing.
[12:07 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Omkar Pawar
[12:07 PM, 7/8/2020] SD Bhosale: Great
[12:07 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: TyB
[12:07 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Mechanical
[12:07 PM, 7/8/2020] SD Bhosale: Great Omkar. I am happy for you.
[12:07 PM, 7/8/2020] SD Bhosale: 👍
[12:07 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Thank you sir
[12:12 PM, 7/8/2020] SD Bhosale: Omkar !!! is my session was useful for you to write python program?
[12:13 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Absolutely sir
[12:14 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: The basic logic is same for both programs in cpp and python
[12:17 PM, 7/8/2020] SD Bhosale: Great. I will share your program with all students.
[12:18 PM, 7/8/2020] Omkar Pawar TY Mechanical Student: Ok sir


No comments:
Post a Comment