2/12/2019

python zip test sample code


numberList = [1, 2, 3, 4, 5]
strList = ['one', 'two', 'three', 'five']

# No iterables are passed
result = zip()
print('first zip: {}'.format(result))

# Two iterables are passed
result = zip(numberList, strList)
print('input value to zip: {}'.format(result))

# Converting itertor to list
print('zip to list: {}'.format(list(result)))

# Converting itertor to set
resultSet = set(result)
print('zip to set: {}'.format(resultSet))



result


No comments:

Post a Comment