Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 and 2 both in python please! 1) Write a function called scaler_multiplication (k,li) that takes an integer and a list containing at least one

image text in transcribed

1 and 2 both in python please!

1) Write a function called scaler_multiplication (k,li) that takes an integer and a list containing at least one integer as arguments and multiplies each element in the list by k. For example, if li=[4,2,3,6] and k=4, li should be modified to [16,8,12,24]. Note: Your function should not create or return a new list. Instead, it should modify the list that is passed to it. For example \[ \begin{array}{l} >1 i=[7,6,4,3,-3] \\ >\text { scalar_multiplication }(4,1 i) \\ >1 i \\ {[28,24,16,12,-12]} \end{array} \] 2) Write a function called add(li1, li2) that takes two lists of integers of the same length as arguments, and returns a new list with the elements of li1 and li2 added together. For example if li1=[3,4,2] and li2=[4,6,1], then the call to add( ) should return the list [7,10,1]. li1 and li2 should not be modified. 1) Write a function called scaler_multiplication (k,li) that takes an integer and a list containing at least one integer as arguments and multiplies each element in the list by k. For example, if li=[4,2,3,6] and k=4, li should be modified to [16,8,12,24]. Note: Your function should not create or return a new list. Instead, it should modify the list that is passed to it. For example \[ \begin{array}{l} >1 i=[7,6,4,3,-3] \\ >\text { scalar_multiplication }(4,1 i) \\ >1 i \\ {[28,24,16,12,-12]} \end{array} \] 2) Write a function called add(li1, li2) that takes two lists of integers of the same length as arguments, and returns a new list with the elements of li1 and li2 added together. For example if li1=[3,4,2] and li2=[4,6,1], then the call to add( ) should return the list [7,10,1]. li1 and li2 should not be modified

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions