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
Inessa05 [86]
3 years ago
13

In python please!! Write the definition of a function named countPos that needs integer values from standard input until there a

re none left and returns the number that are positive. The function must not use a loop of any kind.
Computers and Technology
1 answer:
jek_recluse [69]3 years ago
8 0

Answer:

Explanation:

The following code is written in Python it doesn't use any loops, instead it uses a recursive function in order to continue asking the user for the inputs and count the number of positive values. If anything other than a number is passed it automatically ends the program.

def countPos(number=input("Enter number: "), counter=0):

   try:

       number = int(number)

       if number > 0:

           counter += 1

           newNumber = input("Enter number: ")

           return countPos(newNumber, counter)

       else:

           newNumber = input("Enter number: ")

           return countPos(newNumber, counter)

   except:

       print(counter)

       print("Program Finished")

countPos()

You might be interested in
The Quick Access Toolbar cannot be customized and have extra commands added to it
sattari [20]

false

plz mark brainliest


4 0
2 years ago
ANs and WANs can be set up in several different shapes, also known as peripherals.
nika2105 [10]

Answer:

The Answer Is False Because They Aren't Called Peripherals

8 0
2 years ago
Do you think the current system of punishment in the United States works? Why? What would you change?
Simora [160]

Well the fact that jails are overcrowded is one factor that shows it's not working. Some people need help from past traumas, abuse, etc. Not everyone that acts out needs to be incarcerated, they need rehabilitation or counseling. Definitely depends on the crime committed. Therefore substance abuse users would be in rehabilitation. Even Juveniles in detention centers don't benefit from incarceration for certain offenses. There is no rehabilitation in incarceration. There are more criminals in jail and incarceration in my opinion, only for some offenders, is the last option. Now for Sex Offenders, Murderers and Criminals with violent crimes my opinion is completely opposite. Some of those offenders should be dealt with according to their crime. Also, all of the people that have been pardoned and them lessening time for drug traffickers and actual drug dealers (not necessarily users) is just a bad thing to pardon them or let them out because they don't have any violent crimes. Isn't dealing drugs, that are killing people every single day just as bad as a violent crime. In my opinion they can sit and rot for the longevity of their sentence. Some need help and I would fully support that only under some circumstances. Others I would rather not have to live amongst them.

8 0
3 years ago
Sharon's company has written a new computer program, and she has been asked to find a way to prevent people from copying the sof
Tasya [4]

Answer:

Sharon's company has written a new computer program, and she has been asked to find a way to prevent people from copying the software they purchase and giving it to others who have not purchased the software. What can Sharon's company do to make sure a customer who p…

A:

Use DRM.

Explanation:

Use DRM.

8 0
2 years ago
Why is the lack of a sense of humor a serious limitation for AI?
sergejj [24]

Answer:

they arent made to Express emotion? can you be a little more specific with the question?

3 0
3 years ago
Other questions:
  • What are the advantages of homogenation
    5·1 answer
  • Studying MyMagic+ helps one understand the costs associated with information systems deployment at scale. According to your read
    12·1 answer
  • The site is not allowing me to purchase the subscription. Please help?
    12·1 answer
  • What means the data is still saved even if you turn the computer off or unplug it?​
    5·1 answer
  • Join each of the follwing sentences using unless
    14·2 answers
  • OI MINHA PRIMEIRA VEZ AQUI
    7·1 answer
  • When using the Photo Album dialog box, a picture
    13·2 answers
  • 8. The cell reference for a range of cells that starts in cell A1 and goes over to column G and down to row 10 is, a. A1-G10 b.
    7·1 answer
  • How to add a legend to a graph in excel?
    7·2 answers
  • ____ uses a computer to design and test new products and modify existing ones. Computer-aided manufacturing Just-in-time design
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!