Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions