Question

Review Аавьсера Аавьсера Аавьс давbcat Аав да 1 Normal 1 No Spac. Heading 1 Heading 2 Title Paragraph Styles Using python....
0 0
Add a comment Improve this question Transcribed image text
Answer #1

PYTHON PROGRAM

FORMULA:

Current= Voltage/Resistance

Power=Voltage*Current

The explanation of the program is given as comments in grey and italic.

#To draw the Graph
import matplotlib.pyplot as plt
#Voltage=50 (Given)
voltage=50
#List to hold all the values
currents=[]
powers=[]
resistances=[]
print("Resistance\tCurrent \tPower" )
# Resistance starts from 10 and moves till 30 in increments of 5
for resistance in range(10,31,5):
    #Append the resistance value to resistances list
    resistances.append(resistance)
    #Calculate current for this resistance 
    current=voltage/resistance
    #Append the current value to currents list
    currents.append(current)
    #Calculate power
    power=voltage*current
    # Append the power value to powers list
    powers.append(power)
    #Print the answer in console
    print(resistance,"\t\t",current,"\t\t",power)
#Plot the graph for currents list in x axis and corresponding resistance in y axis
plt.plot(currents,resistances)
plt.xlabel("Current")
plt.ylabel("Resistance")
plt.title("Current Vs Resistance")
plt.show()

SCREENSHOT OF THE CODE TO ASSIST IN INDENTATION

#To draw the Graph import matplotlib.pyplot as plt #Voltage=50 (Given) voltage=50 #List to hold all the values currents=[] po

OUTPUT SCREENSHOT

- Figure 1 166.66666666666669 Resistance 10 15 20 25 30 Current Power 5.0 250.0 3.3333333333333335 2.5 125.0 2.0 100.0 1.6666

Add a comment
Know the answer?
Add Answer to:
Review Аавьсера Аавьсера Аавьс давbcat Аав да 1 Normal 1 No Spac. Heading 1 Heading 2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT