Please, i need help with this coding question in python 1. lst1 = ['1', '2', [3]] 2. lst2 = [('3', 4), '5', 6] 3

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Please, i need help with this coding question in python 1. lst1 = ['1', '2', [3]] 2. lst2 = [('3', 4), '5', 6] 3

Post by answerhappygod »

Please, i need help with this coding question in python
1. lst1 = ['1', '2', [3]]
2. lst2 = [('3', 4), '5', 6]
3. Join lst1 and lst2 soonly unique string or integer values remain in a newlist, lst3.(i.e., ['1', '2', 3, '3', 4, 5, 6])
4. Create an empty dictionarycalled odds_evens. Next, iteratethrough lst3. If a number (regardless of datatype) iseven, add the value to a list that will be stored as a value forthe key even in thedictionary, odds_evens. Do the same for the oddsnumbers. When you printthe odds_evens dictionary the output should looklike this: {'evens': ['2', 4, 6], 'odds': ['1', '3', 3, '5']}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply