Write a function that takes two lists as input, a list L1 containing characters and a list L2 containing numbers. For each of the number n contained in L2, the function will display the first n character of the list L1. For example: L1 '("h" "e" "l" "l" "o" "w" "o" "r" "l" "d") L2 '(2 3 1 5 10) Output: he hel h he l l o h e l l o w o r l d.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question
Write a function that takes two lists as input, a list L1 containing characters and a list L2 containing numbers. For each of the number n contained in L2, the function will display the first n character of the list L1. For example: L1 '("h" "e" "l" "l" "o" "w" "o" "r" "l" "d") L2 '(2 3 1 5 10) Output: he hel h he l l o h e l l o w o r l d.
SOB 35 – (Block 2 – material covered in Week 13)
Write a function that takes two lists as input, a list L1 containing characters and a list L2
containing numbers. For each of the number n contained in L2, the function will display the first
n character of the list L1. For example:
(""י" " "" "w" "ס" "ו" "ן" "e" "חי)' L1
L2 '(2 3 15 10)
Output:
he
hel
h
hello
helloworl d.
Please make sure to test your function and to explain how your code works.
Transcribed Image Text:SOB 35 – (Block 2 – material covered in Week 13) Write a function that takes two lists as input, a list L1 containing characters and a list L2 containing numbers. For each of the number n contained in L2, the function will display the first n character of the list L1. For example: (""י" " "" "w" "ס" "ו" "ן" "e" "חי)' L1 L2 '(2 3 15 10) Output: he hel h hello helloworl d. Please make sure to test your function and to explain how your code works.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Lists
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
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