Answer to Question #265035 in Python for Raj

Question #265035

An e-commerce application wants to give discounts to its customers. The discount is

calculated as the product of the sum of even numbers and the sum of odd numbers

present in the bill. Print the discount that a customer can get.

a. Input: 2345, Output: 48

Explanation: even_sum = 2+4 = 6.

Odd_sum = 3+5 = 8.

Product = 6*8 = 48.


1
Expert's answer
2021-11-13T12:41:03-0500
def dis_app(list1):
    r = 0
    s = 0
    for i in list1:
        if i % 2 == 0:
            r = r + i
        else:
            s = s + i
    return r * s
dis_app([2,3,4,5])
48

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS