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