Question
Write a Python program that takes a string as an input where multiple numbers are separated by hashes(#). Your first task is to create a
Write a Python program that takes a string as an input where multiple numbers are separated by hashes(#). Your first task is to create a list of numbers and print it. Your second task is to create a dictionary that will have the index of the list as key, and for the even indices, multiplication from start to that index as value, while for the odd indices, summation from start to that index as value. Finally, print the dictionary.
================================================
Sample Input 1: 1#2#3#4 Sample Output 1: [1, 2, 3, 4] {0: 1, 1: 3, 2: 6, 3: 10} Explanation 1: key 0 value 1 key 1 value 1+2 = 3 key 2 value 1x2x3 = 6 key 3 value 1+2+3+4 = 10 ================================================
Sample Input 2: 5#6#7 Sample Output 2: [5, 6, 7] {0: 5, 1: 11, 2: 210} Explanation 2: key 0 value 5 key 1 value 5+6 = 11 key 2 value 5x6x7 = 210
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started