# # # a = 4 #where a is the last number of my student ID t = float(input("Enter number: ")) #area of a circle from math import pi from math import sqrt area = pi*t**2 #calculation for the area of a circle print("The area of a circle with radius {} is {:.2f}m**2".format(t, area)) #height of hypotenuse hyp_len = sqrt(a**2+t**2) #calculation for the hypontenuse length print("The length of the hypotenuse of a right angle triangle with lenghts {:.1f} and {} is {:.2f}".format(a, t, hyp_len)) #the solution to x for (1+t**2)x=a x = a/(1 + t**2) print("The solution to x for (1+t**2)x=a is {:.2f}".format(x)) #the electrical resistance of a 1+t**2 ohm resistor parallel with an a ohm resistor R1 = 1/(1+t**2) #where R1 is the resistance dependent on t R2 = 1/a # where R2 is the resistance dependent on a Rt = R1 + R2 #where Rt is equal to the sum of the variable resistors resistance = 1/Rt #where Rt is equal to the sum of the variable resistors print("The electrical resistance of a 1+t**2 ohm resistor parallel with an a ohm resistor is {:.2f} ohms".format(resistance)) #the area of a regular octogon oct_area = 2*(1+sqrt(2))*(2*t)**2 print("the area of a plane regular octogon with side {} is {:.2f}".format(2*t, oct_area))
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question