Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created March 6, 2021 21:24
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 IndhumathyChelliah/d35bd6c56c69082c041ff90865086d22 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/d35bd6c56c69082c041ff90865086d22 to your computer and use it in GitHub Desktop.
even=[2,4,6,8]
odd=[1,3,5,7,9]
num= *even,*odd
print (list(num))
#Output:[2, 4, 6, 8, 1, 3, 5, 7, 9]
#or
num=[*even,*odd]
print (list(num))
#Output: [2, 4, 6, 8, 1, 3, 5, 7, 9]
@khalidmfy
Copy link

Hello,
Do we need to include list() in the second code provided above?
num=[*even,*odd]
print ((num))
print (type(num))
[2, 4, 6, 8, 1, 3, 5, 7, 9]
<class 'list'>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment