Answered step by step
Verified Expert Solution
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
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