Learn practical skills, build real-world projects, and advance your career
def filter_odd(number_list):
    li = []
    for num in number_list:
        if num & 1:
            li.append(num)
    return li
odd_list = filter_odd([4, 5, 6, 7, 8, 9, 10, 11])
print(odd_list)
[5, 7, 9, 11]
import math
def emi(money, rate, time, downPayment = 0):
    try:
        EMI = math.ceil(((money - downPayment) * rate * ((1 + rate) ** time))/(((1 + rate) ** time) - 1))
    except:
        EMI = math.ceil((money - downPayment) / time)
    return EMI
emi1 = emi(1260000, 10 / (12 * 100), 8 * 12, 300000)
emi2 = emi(1260000, 8 / (12 * 100), 10 * 12)
print('Option 1 EMI is ${}' .format(emi1))
print('Option 2 EMI is ${}' .format(emi2))
if emi1 == emi2:
    print('You can choose any of It.')
elif emi1 > emi2:
    print('Option 2 is better.')
else:
    print('Option 1 is better.')
Option 1 EMI is $14568 Option 2 EMI is $15288 Option 1 is better.
#shaun's emi calculation
total_emi = emi(800000, 7/(12 * 100), 6 * 12, (800000 * 25) / 100) + emi(60000, 12/(12 * 100), 1 * 12)
print('Total emi = ${}' .format(total_emi))
Total emi = $15561
#my total interest calculation
with_interest = (emi(100000, 9/(12 * 100), 10 * 12)) * 10 * 12
without_interest = (emi(100000, 0/(12 * 100), 10 * 12)) * 10 * 12
print('Total interest = ${}.' .format(with_interest - without_interest))
Total interest = $51960.
help(emi)
Help on function emi in module __main__: emi(money, rate, time, downPayment=0)