1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Veronika [31]
3 years ago
12

HW7.24. Return nth integer from CSV string The function below takes two parameters: a string parameter: CSV_string and an intege

r 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.
Computers and Technology
1 answer:
kotykmax [81]3 years ago
8 0

Answer:

The solution code is written in Python 3.

  1. def processCSV(CSV_string, index):
  2.    data = CSV_string.split(",")
  3.    result = data[index]
  4.    return int(result)
  5. processCSV('111,22,3333,4', 2)

Explanation:

Firstly, create function and name it as <em>processCSV()</em> with two parameters, <em>CSV_string</em> and <em>index</em> (Line 1).

Since the CSV_string is a collection of integers separated by comma, we can make use of Python String built-in method <em>split() </em>to convert the <em>CSV_string </em>into a list of numbers by using "," as separator (Line 2).

Next, we can use the <em>index</em> to extract the target value from the list (Line 3).

Since the value in the list is still a string and therefore we shall use Python built-in method int() to convert the target value from string type to integer and return it as output of the function (Line 4)

We can test our function by using the sample test case (Line 6) and we shall see the expected output: 3333.

You might be interested in
State and explain five misused of science and technology​
kap26 [50]

Answer:

Science and technology is the major key of life cycle.

Explanation:

Any five misused of science and technology are:-

•Guns and weapons to clash.

•Phishing sites

•Scamming online or on online shopping.

•Misusing social media and our phones.

•Crazy addictive online games.

6 0
3 years ago
I need help please :((((<br> I need it in python
Bezzdna [24]
Take this one step at a time. Your teacher has given you the code for step 1. Now write step 2. Then 3, and so on.

For step 2: if you're using Python v2.x you'd use a line like

guess = int( raw_input( "Take another guess: " ) )

For Python v3.x it would be:

guess = int( input( "Take another guess: " ) )

Break it down into small pieces, it's not a complicated assignment.
7 0
3 years ago
scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU
dexar [7]

SJF scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU bursts.

<h3>What is SJF in operating system?</h3>

SJF is a term that connote Shortest Job First. It is said to be a type of CPU scheduling whose algorithm is linked with each as it is said to process the length of the next CPU burst.

Note that for one to be able to know the time for the next CPU burst to take place, one need to take the SJF into consideration as that is its function.

Hence, SJF scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU bursts.

See options below

A) Multilevel queue

B) RR

C) FCFS

D) SJF

Learn more about scheduling from

brainly.com/question/19309520

#SPJ1

3 0
2 years ago
There is one clear definition of IT. True False
Elenna [48]

Answer:

That is False. it has more definitions not only one.

8 0
3 years ago
Qual è la differenza tra variabile semplice e variabile strutturata? <br>​
Mrrafil [7]

Answer:

Sia la variabile semplice che la variabile strutturata possono avere il diverso set di valori, ma entrambi differiscono poiché la variabile semplice può contenere solo i valori di un tipo di dati. Tuttavia, la variabile strutturata può contenere la variabile di diversi tipi di dati come la struttura in c ++ ed elencare in Python. Ci sono anche molti altri esempi.

Ad esempio in c ++:

int num;  è una variabile semplice

e   struct class

        {

             int roll;

             string name;

        } class[25];

è una variabile strutturata che può memorizzare i dettagli dei 26 studenti.

Explanation:

Si prega di controllare la sezione di risposta.

6 0
4 years ago
Other questions:
  • ___________is a security strategy that applies multiple layers of defense because there is an assumption that any single protect
    12·1 answer
  • Which type of word processing programs enables us to include illustrations within the program?
    6·1 answer
  • Andy is trying to put together a holiday gift knapsack (with W=8) for Sarah. He has n items to choose from, each with infinitely
    15·1 answer
  • Using ______ capabilities, network managers can connect VOIP phones directly into a VLAN switch and configure the switch to rese
    6·1 answer
  • Every modern nation has a Central Bank. Which of the following is the Central Bank for these United States?
    14·2 answers
  • Explain Text align , Text Decoration, colour, Text shadow..​
    11·1 answer
  • QN, 3. Write the working principle of computer.<br>​
    8·1 answer
  • From few sometime I am unable to answer any question. Whenever I am clicking on Answer button it is taking me to logging page. B
    15·1 answer
  • Give five example of a dedicated device ​
    9·2 answers
  • Which blu-ray standard defines rewritable disks?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!