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
12345 [234]
4 years ago
9

The slice_gen generator takes one iterable and a start, stop and step values (all int, with the same meanings as the values in a

slice: [start:stop:step], except start and stop must be non-negative and step must be positive; raise an AssetionError exception if any is not). It produces all the values in what would be the slice (without every putting all the values in a list and slicing it). For example
Computers and Technology
1 answer:
babunello [35]4 years ago
6 0

Answer:

See Explaination

Explanation:

def slice_gen(iterable, start, stop, step):

it = iter(iterable)

if start < 0 or stop < 0 or step <= 0:

raise AssertionError

count = -1

nextI = start

while True:

count += 1

try:

item = next(it)

if count == stop:

break

elif count == nextI:

nextI = nextI + step

yield item

except:

return

for i in slice_gen('abcdefghijk', 3, 7, 1):

print(i, end='')

print("")

You might be interested in
How to find the next instance of text formatted in bold
yuradex [85]

The Find and Replace option is a very powerful tool for searching for words in a document. It allows for several search options including specifying the format used on the word being searched for. To check the next instance of a specified word, click the next option.

  • The Find and replace functionality is used for searching through texts in a document, it helps find instances of a specified text and simultaneously replacing them with another specified word is possible using the replace option.

  • Using the CTRL+F command on windows opens up this option where one can type in the text to be searched for and an option to specify the format used on the text is also possible by clicking the format option.

  • Once, this is has been done, simply click the next option to find instances of the specified text and formatting used.

Therefore, the find and replace option allows searching for instances of a specified text in a document.

Learn more :brainly.com/question/24850543

4 0
3 years ago
Why is it so important to have employees who can critically think?
kiruha [24]
Its important to have employees who can critically think because if they have to make a crucial decision for the job or project he or she is working on that best suits the situation. 
6 0
3 years ago
Read 2 more answers
The Monte Carlo method is commonly used to approximate areas or volumes of shapes. In this problem, we will use Monte Carlo to f
sdas [7]

Answer:

import numpy as np

import matplotlib.pyplot as plt

def calculate_pi(x,y):

   points_in_circle=0

   for i in range(len(x)):

       if np.sqrt(x[i]**2+y[i]**2)<=1:

           points_in_circle+=1

       pi_value=4*points_in_circle/len(x)

       return pi_value

length=np.power(10,6)

x=np.random.rand(length)

y=np.random.rand(length)

pi=np.zeros(7)

sample_size=np.zeros(7)

for i in range(len(pi)):

   xs=x[:np.power(10,i)]

   ys=y[:np.power(10,i)]

   sample_size[i]=len(xs)

   pi_value=calculate_pi(xs,ys)

   pi[i]=pi_value

 

print("The value of pi at different sample size is")

print(pi)

plt.plot(sample_size,np.abs(pi-np.pi))

plt.xscale('log')

plt.yscale('log')

plt.xlabel('sample size')

plt.ylabel('absolute error')

plt.title('Error Vs Sample Size')

plt.show()

Explanation:

The python program gets the sample size of circles and the areas and returns a plot of one against the other as a line plot. The numpy package is used to mathematically create the circle samples as a series of random numbers while matplotlib's pyplot is used to plot for the visual statistics of the features of the samples.

4 0
3 years ago
What is the role of consumers in determining what is produced in a market economy
gregori [183]

Consumer preferences and resource scarcity determine which goods are produced and in what quantity; the prices in a market economy act as signals to producers and consumers who use these price signals to help make decisions.

(i got this from google btw)

hope this helped :) pls give branliest

3 0
4 years ago
Read 2 more answers
Help please fast
Pachacha [2.7K]
Bookmark because you can go back to it at any given time to re use it
4 0
3 years ago
Read 2 more answers
Other questions:
  • Suppose that cells B1 through B100 of an Excel spreadsheet contain the quantity of units ordered on each of 100 different days.
    13·1 answer
  • Write a complete function called lowestPosition() which takes as array (of double) and the number of elements used in the array
    9·1 answer
  • Which of the following is a scam where perpetrators promise high pay for working on different projects like wooden calendars, pa
    13·1 answer
  • The ____________ deals with the well-being of the EMT, career progression, and EMT compensation. Select one: A. EMS administrato
    9·1 answer
  • At the beginning of Section 5.2, it is stated that multiprogramming and multiprocessing present the same problems, with respect
    8·1 answer
  • 9. Differentiate between bolding and highlighting<br>text.<br>(2 marks)​
    15·2 answers
  • What is MS-Word? Write some versions of MS-Word.
    8·2 answers
  • What is a central idea for 3 Despite this lack of precision, Galileo had constructed a wonderful invention. Yet, he considered i
    5·1 answer
  • Developing algorithms using psuedocode
    15·1 answer
  • Name four successful conversions to an electronic health record system in a medical facility
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!