Skip to content

Instantly share code, notes, and snippets.

@de-sh
Last active October 2, 2017 13:29
Show Gist options
  • Save de-sh/8ca07398c904dbc14c9896cd0599a4f7 to your computer and use it in GitHub Desktop.
Save de-sh/8ca07398c904dbc14c9896cd0599a4f7 to your computer and use it in GitHub Desktop.
Python working
def volCy():
r = int(input("Radius: "))
h = int(input("Height: "))
V = 3.1415*(r**2)*h
print("The volume is ",V)
def surSp():
r = int(input("Radius: "))
A = 3.1415*4*(r**2)
print("The surface area is ",A)
def pyth():
a = int(input("The opposite side is "))
b = int(input("The adjacent side is "))
c = (a**2 + b**2)**0.5
print("The hypotenuse of the triangle by Pythagoras theorem is ", c)
def mid():
a = (int(input("Enter abscica of point 1: ")), int(input("Enter ordinate of point 2: ")))
b = (int(input("Enter abscica of point 2: ")), int(input("Enter ordinate of point 2: ")))
m = ((a[0]+b[0])/2, (a[1]+b[1])/2)
print("The midpoint is ",m)
def heron():
a = int(input("Side a of triangle: "))
b = int(input("Side b of triangle: "))
c = int(input("Side c of triangle: "))
s = (a + b + c)/2
A = (s*(s-a)*(s-b)*(s-c))**0.5
print("The area of the triangle is: ",A)
def printLarge():
a = int(input())
b = int(input())
c = int(input())
if a >= b:
if a >= c:
print(a)
else:
print(c)
else:
if a >= c:
print(b)
else:
print(c)
def rootQuad():
a = int(input())
b = int(input())
c = int(input())
d = b**2 - 4*a*c
if d < 0:
print("No real roots")
elif d == 0:
x = -b/(2*a)
print("One real root:",x)
else:
x1 = (d-b)/(2*a)
x2 = -(b+d)/(2*a)
print("Two real roots:",x1,x2)
def isMult():
a = int(input())
b = int(input())
if a % b == 0:
print(a,"is a multiple of",b)
else:
print("Not a multiple")
def factorial():
n = int(input())
fa = 1
while n > 0:
fa *= n
n -= 1
print(fa)
def fibSeries():
n = int(input())
a = 1
b = 1
for n in range(n+1):
if n == 0:
print(1)
else:
c = b
b += a
a = c
print(a)
def revNum():
n = int(input())
r = 0
while n != 0:
r += n % 10
n //= 10
print(r)
def gcd():
a = int(input())
b = int(input())
if a < b:
(a,b) = (b,a)
while a%b != 0:
(a,b) = (b,a%b)
print(b)
def rev():
n = int(input())
r = 0
while n != 0:
r *= 10
r += n%10
n //= 10
print(r)
def smallSer():
print("Input 0 to exit")
n = int(input())
s = n
while n != 0:
if s > n:
s = n
n = int(input())
print(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment