The function below takes two parameters: a string parameter: CSV_string and an integer index. This string parameter will hold a comma-separated collection of integers: '111,22,3333,4'. Complete the function to return the indexth value (counting from zero) from the comma-separated values as an integer. For example, your code should return 3333 (not '3333') if the example string is provided with an index value of 2. Hint: you should consider using the split() method and the int() function.

Respuesta :

Answer:

Check the explanation

Explanation:

to complete the function that is to return the indexth value from the comma-separated values as an integer.

and since we've been hinted to consider using the split() method and the int() function.

we'll have to execute the below function which you can also see the screenshot in the attached image.

def get_nth_int_from_CSV(CSV_string,index):

l = CSV_string.split(',')

n = int(l[index])

return n

print(get_nth_int_from_CSV('111,22,3333,4',2))

Ver imagen temmydbrain