Computer Science, asked by vikranth98h, 10 months ago

We have ‘N’ flavors of toppings that can be added to a coffee. For example chocolate, hazelnut, vanilla, Irish and so on. Write a python program that takes the number of available flavors as input and returns the total number of different ways we can have our coffee. Note that we can have coffee without any toppings or with different combination of toppings.

Answers

Answered by rishabhdeshwal947
20

Answer:

Import math

Def Find_number_of_combination(number_of_flavours):

Total_combination=pow(2,number_of_flavours)

Return total_combination

Number_of_combination=find_number_of_combination(4)

Print(number_of_combination)

Explanation:

Combination for number of flavours is 2 to the power of number of flavours, so we use power function to calculate number of combination.

In this case output is 16 as 2 to the power 4 is 16.

Answered by dablu8970choubay
3

Answer:

def find_number_of_combination(number_of_flavours):

   total_combination=0

   #write your logic here

   total_combination=2**number_of_flavours

   return total_combination

#Provide different values for number_of_flavours and test your program

number_of_combination=find_number_of_combination(6)

print(number_of_combination)

Explanation:

We have ‘N’ flavors of toppings that can be added to a coffee. For example chocolate, hazelnut, vanilla, Irish and so on.

Write a function that takes the number of available flavors as input and returns the total number of different ways we can have our coffee. Note that we can have coffee without any toppings or with different combination of toppings.

#SPJ3

Similar questions