subject

Question 1 (already finished) Extract: "Data" From: "Introduction to Data Science" def question1(text): return (text[16:20], slice(16,20,1)) Notes and hints: 'extract' means return the substring that is to be 'extracted' (i. e. removed) from the 'From' text. if you want to debug your answers, just do the following (in main. py) import lesson as ans result = ans. question1("Introduction to Data Science") print(result[0] == 'Data') # looking for True you can also test each part of your expect = "Data" word = "Introduction to Data Science" s1 = slice(16,20,None) value = word[s1] if (value != expect): print("Bad Slice", expect, value) value = word[16:20] if (value != expect): print("Bad Index", expect, value) In each of your answers, you should ONLY use the slice function as part of the final return and you must use the parameter text in the return statement. do some answer(text): idx = some calculation() return (text[idx:20], slice(idx,20,1)) Bonus: ideally, you should solve each of these without any hardcoded numbers other than the step amount: Extract: "Data" From: "Introduction to Data Science" def question1(text): word = 'Data' wl = len(word) idx = text. find(word) return (text[idx:idx+wl], slice(idx, idx+wl, 1)) Question 2: Extract: "ar" From: "Orange" def question2(text): return (

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:20
Sometimes writers elaborate on the truth when recalling past events so they can enhance their narrative essay with more interesting descriptions. do you feel that published writers should or should not embellish real life events just to make their stories more interesting?
Answers: 2
question
Computers and Technology, 22.06.2019 00:10
How does access indicates that a filter has been applied to a specific column
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 23.06.2019 22:40
22. sata3 allows for data transfer rates of 600 mb/s. explain why you would likely not be able to copy data from one hard drive to another at anywhere close to this speed. also, what could be upgraded on the computer to achieve transfer speeds closer to 600 mb/s
Answers: 1
You know the right answer?
Question 1 (already finished) Extract: "Data" From: "Introduction to Data Science" def question1(tex...
Questions
Questions on the website: 13722360