Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Trace and write the ouptut of each Python script: def func(x, y=2): num = 1 for i in range(y): num = num*x return

 

1. Trace and write the ouptut of each Python script: def func(x, y=2): num = 1 for i in range(y): num = num*x return num print (func(4)) min (lambda x, y: x if x < y else y) print(min(101.99, 102*98)) myList [lambda x: x** 2, lambda x: x** 3, lambda x: x** 4] for fin myList: print(f(3)) def func(): x=1 print(func()) Question 2 2. Write a Python script that evaluates polynomails. The function takes two parameters, number x with default value as 1 and the list of coefficients ordered from highest to lowest. Input: x-4, cofficients [1,2,3] -> Output: 41+42+43 - 84 %23%23 Question 3 #2 #2 3. Write a Python script that creates a dictionary to find the location(s) of each word in an input sentence with spaces between words. Then print the location of an input word. sentence: hi you how are you? d (hi:0, you: 1,4, how:2, are: 3,2:5} word huda -> not found word you at locations 1 and 4

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_2

Step: 3

blur-text-image_3

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

Computer Systems A Programmers Perspective

Authors: Randal E. Bryant, David R. O'Hallaron

3rd Global Edition

1292101768, 978-1292101767

More Books

Students also viewed these Programming questions

Question

2x2+6x+6 If f(x) = then: f'(x) = f'(4) = Moccase instructor

Answered: 1 week ago

Question

=+d) Which car would you produce and why?

Answered: 1 week ago

Question

Please put the name as ( NOURA )

Answered: 1 week ago

Question

Question 2 For an n x n matrix A = form) via (aij)

Answered: 1 week ago