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.
SOLUTION:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def find_number_of_combination(number_of_flavours): | |
total_combination=0 | |
#logic | |
total_combination=pow(2,number_of_flavours) | |
return total_combination | |
number_of_combination=find_number_of_combination(6) | |
print(number_of_combination) |
0 Comments