Friday, 14 January 2022

Programmes: 12-14th Jan

 #list of items and thier deductions#


def present(salary):

    total = expenditures()

    remaining = salary - total

    print(f'your remaining salary is {remaining}')



def expenditures():

    type = input('enter the type of deduction')

    cutting = input('what is the amount')

    list1 = []

    list2 = []

    while type != '' and cutting != '':

        list1.append(type)

        list2.append(cutting)


        type = input('enter the type of deduction')

        cutting = input('what is the amount')

    deductions = {}

    for i in range(0,len(list1)):

     deductions[list1[i]] = list2[i]



    total = sum(map(int, list2))

    for item,amount in deductions.items():

        print('deduction for an item {} is {}'.format(item,amount))

    return total



present(50000)


#factorial of number#

fact = int(input('enter the item no'))

x = []

x.append(fact)


i = 0

j = 1

k = fact

def single():

      print('factorial of 1 is 1')

if fact == 1:

      single()


else:

    while k != 1:

        p = x[i] * (k - j)

        x.append(p)

        i = i + 1

        k = k - 1

    print(p)


No comments:

Post a Comment

Notes: 16th Jan