Skip to content

Instantly share code, notes, and snippets.

@0xAungkon
Created March 2, 2024 20:19
Show Gist options
  • Select an option

  • Save 0xAungkon/9c2748ca1e134f8c91062c404d7272ed to your computer and use it in GitHub Desktop.

Select an option

Save 0xAungkon/9c2748ca1e134f8c91062c404d7272ed to your computer and use it in GitHub Desktop.
multiplication 2 lists (just sample)
def list_element_multiplection(list_1,list_2): #create a funtion
final='' #taking a empty string
for a in list_1: #run loop 1 (2 and 3)
for b in list_2: # run loop 2 (1,5,6)
final+=f'({a},{b}),' #combine them one by one (2,1),(2,5),(2,6)
return '{'+final[:-1]+'}' #removing the last extra comma and convert into string
a = [2,3] # list one
b = [1,5,6] # list two
print('a*b=',list_element_multiplection(a,b)) # call the function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment