Skip to content

Instantly share code, notes, and snippets.

@khuyentran1401
Last active June 7, 2021 19:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khuyentran1401/259c326aaadd1c7c69a3a733072d83bf to your computer and use it in GitHub Desktop.
Save khuyentran1401/259c326aaadd1c7c69a3a733072d83bf to your computer and use it in GitHub Desktop.
from itertools import combinations
def division(num1: int, num2: int):
return num1/num2
def divide_numbers(num_list: list):
"""Division of 2 numbers in the number list """
for comb in combinations(num_list, 2):
num1, num2 = comb
res = division(num1, num2)
print(f"{num1} divided by {num2} is equal to {res}.")
if __name__ =='__main__':
num_list = [2, 1, 0]
divide_numbers(num_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment