Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LDN Question 1 Describe the building blocks of computers and programs based on your understanding and answer this question. You are given the following code

image text in transcribed

image text in transcribed

LDN Question 1 Describe the building blocks of computers and programs based on your understanding and answer this question. You are given the following code segments: (a) 1- def addi(a, b): 2 a = a + b 3 print('In addi: , a, b) 4 5- def add2(a, b): 6 a.append(b) 7 print('In add2: ', a, b) 9-def main(): 10 a = [1] 11 b = [2] 12 addi(a, b) print("In main: ', a, b) a = [1] b = [2] 16 add2(a, b) print('In main: ', a, b) 18 19 main() 8 13 14 15 17 (i) What is the output of the code segment when it is executed? (4 marks) Explain in terms of assignment statements and mutability, the output you gave for part (1) (4 marks) (b) 1 a, b = 1,9 2 while True: 3 if abs(a * a - b)

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago