1a and b 3-4 pictures are the templete

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

1a and b 3-4 pictures are the templete

Post by answerhappygod »

1a and b
3-4 pictures are the templete
1a And B 3 4 Pictures Are The Templete 1
1a And B 3 4 Pictures Are The Templete 1 (40.72 KiB) Viewed 48 times
1a And B 3 4 Pictures Are The Templete 2
1a And B 3 4 Pictures Are The Templete 2 (47.5 KiB) Viewed 48 times
1a And B 3 4 Pictures Are The Templete 3
1a And B 3 4 Pictures Are The Templete 3 (58.21 KiB) Viewed 48 times
1a And B 3 4 Pictures Are The Templete 4
1a And B 3 4 Pictures Are The Templete 4 (39.83 KiB) Viewed 48 times
I will carefully check things like L is unaffected by the function call and None is returned. 1. (a) def compare_val_w_idx (L): """Compares each value of a list of numbers with its index... L is unaffected by the function call. The function returns a list M of the same length as L. M is 1 when L is bigger than i, M is -1 when L is less than 1, M[1] is 0 when L is equal to 1. www pass Test: L [4,5,6,3,4,5,2,3,4] print (compare_val_w_idx (L)) should print [1, 1, 1, 0, 0, 0, -1, -1, -1]. 1
(L): "Compares each value of a list of numbers with its index... (b) def compare_val_w_idx_no_obj No new objects (except ints) are created during the function call!! None is returned, but L is mutated by the function call. For any list of numbers L, the following code results in True being printed. M compare_val_v_idx (L) compare_val_w_idx_no_obj (L) print (LM) So L is mutated to the return value of compare_val_w_idx (L). HER pass Test: L [4,5,6,3,4,5,2,3,4] compare_val_v_idx_no_obj (L) print (L) should print (1, 1, 1, 0, 0, 0, -1, -1, -1]. "No new objects" means that you should not be creating any new lists. For example, def compare_val_v_idx_no_obj (L): M L.clear() compare_val_v_idx (L) L. extend (M) is NOT an okay solution. (For the pedantic, I'm not counting range (len (L)) as an object even though it is. You're fine to use this.)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- |||||| Created on Sun Mar 27 00:00:00 2022 @author: sarahburnett #%% 1A def compare_val_w_idx (L): """Compares each value of a list of numbers with its index... L is unaffected by the function call. The function returns a list M of the same length as L. M is 1 when L is bigger than i, M is -1 when L is less than i, M is 0 when L[i] is equal to 1. 111111 pass #%% 1B def compare_val_w_idx_no_obj (L): """Compares each value of a list of numbers with its index... No new objects (except ints) are created during the function call!! None is returned, but L is mutated by the function call. For any list of numbers L, the following code results in True being printed. M = compare_val_w_idx (L) compare_val_w_idx_no_obj (L) print (L == M)
M[i] is 1 when L[i] is bigger than i, M[i] is -1 when L[i] is M[ij is o when L[ij is less than i, equal to i. HR pass # % % 1B def compare_val_w_idx_no_obj (L): """Compares each value of a list of numbers with its index... nin No new objects (except ints) are created during the function call!! None is returned, but L is mutated by the function call. For any list of numbers L, the following code results in True being printed. M compare_val_w_idx (L) compare_val_w_idx_no_obj (L) print (L == M) So L is mutated to the return value of compare_val_w_idx(L). |||||| pass
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply