Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

b. [10] What is the output of the following code? def partstring(astr, newstr = '' i = 0 while i < num: newstr=newstr+astr[i+2] i=i+1

 

b. [10] What is the output of the following code? def partstring(astr, newstr = '' i = 0 while i < num: newstr=newstr+astr[i+2] i=i+1 return (newstr) print (partstring('1:NYCity', 2)) print (partstring('4: Houston', 3)) num): c. [10] Consider the following code def simple (a, b): tempa = 2*a b = 2*b d = tempa+b return d alpha = 11 beta = 7 delta simple (alpha, beta) print (alpha, beta, delta) print(a, b) For the two print statements in the code, state what will be printed. If an error will occur, state that and the reason for the error. i) print (alpha, beta, delta) ii) print (a, b)

Step by Step Solution

3.35 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

Lets analyze the code provided For part b def partstringastr num newstr i 0 while i num newstr newst... 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

Signals and Systems using MATLAB

Authors: Luis Chaparro

2nd edition

123948126, 978-0123948120

More Books

Students also viewed these Programming questions