I'm trying to write a function that turns a string of digits into an integer, the same as int(, for numbers zero or bigger. So, k ('0') should return 0, k ('1') should return 1, k ( '75') should return 75, k ('999') should return 999, and so on. So far, I have the following function: def k(d): a = 0 for n in d: a = return a But I don't know what to put instead of What should I replace with?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question
Select one:
O a.
a / 10 + int (n)
O b. a % 10 + n
О с. а // 10 +
int(n)
O d. (a « 1) | n
O e. (a « 1) | int(n)
Of.
a // 10 + n
a| int(n)
g.
a * 10 +
int(n)
Oi.
a * 10 + n
O j.
int(n)
a % 10 +
Ok.
int(n)
a +
OI.
a / 10 + n
O m. aln
n.
а + n
Transcribed Image Text:Select one: O a. a / 10 + int (n) O b. a % 10 + n О с. а // 10 + int(n) O d. (a « 1) | n O e. (a « 1) | int(n) Of. a // 10 + n a| int(n) g. a * 10 + int(n) Oi. a * 10 + n O j. int(n) a % 10 + Ok. int(n) a + OI. a / 10 + n O m. aln n. а + n
Question 28
I'm trying to write a function that turns a string of digits into an integer, the same as int(), for numbers zero or bigger.
Not yet
So, k ('0') should return 0, k ('1') should return 1, k ('75') should return 75, k ('999') should return 999, and so on.
answered
So far, I have the following function:
Marked out of
def k(d):
1.00
P Flag
a = 0
for n in d:
question
a =
return a
But I don't know what to put instead of
What should I replace
with?
Transcribed Image Text:Question 28 I'm trying to write a function that turns a string of digits into an integer, the same as int(), for numbers zero or bigger. Not yet So, k ('0') should return 0, k ('1') should return 1, k ('75') should return 75, k ('999') should return 999, and so on. answered So far, I have the following function: Marked out of def k(d): 1.00 P Flag a = 0 for n in d: question a = return a But I don't know what to put instead of What should I replace with?
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning