Created
March 2, 2024 20:19
-
-
Save 0xAungkon/9c2748ca1e134f8c91062c404d7272ed to your computer and use it in GitHub Desktop.
multiplication 2 lists (just sample)
This file contains hidden or 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
| 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