Python Spyder (1)
Python Spyder (1)
num = 8
a=5
b=6
c=7
s = (a + b + c) / 2
# conversion factor
conv_fac = 0.621371
# calculate miles
celsius = 37.5
# calculate fahrenheit
if (num % 2) == 0:
print("{0} is Even".format(num))
else:
print("{0} is Odd".format(num))
year = 2000
# if not divided by both 400 (century year) and 4 (not century year)
else:
num = 29
flag = False
if num == 0 or num == 1:
if (num % i) == 0:
flag = True
break
if flag:
else:
Example 9: # Python program to find the factorial of a number provided by the user.
num = 7
# To take input from the user
factorial = 1
if num < 0:
elif num == 0:
else:
factorial = factorial*i
while(y):
x, y = y, x % y
return x
Example 11: # Python Program to find the L.C.M. of two input number
if x > y:
greater = x
else:
greater = y
while(True):
lcm = greater
break
greater += 1
return lcm
num1 = 54
num2 = 24
def print_factors(x):
if x % i == 0:
print(i)
num = 320
print_factors(num)
""""This function prints the resolution of the jpeg image file passed into it"""
img_file.seek(163)
a = img_file.read(2)
# calculate height
a = img_file.read(2)
# calculate width
jpeg_res("img1.jpg")
X = [[12,7,3],
[4 ,5,6],
[7 ,8,9]]
Y = [[5,8,1],
[6,7,3],
[4,5,9]]
for r in result:
print(r)
def convertToBinary(n):
if n > 1:
convertToBinary(n//2)
# decimal number
dec = 34
convertToBinary(dec)
print()