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
Several people work with data at Erica’s office. She enters data. One of her coworkers enters new product numbers. Another cowor
Dvinal [7]

Answer:

a software program for storing, managing, and retrieving information

Explanation:

8 0
3 years ago
A gamer typing their name into the computer is an example of:
vova2212 [387]

user input I think I'm not sure though

3 0
3 years ago
Read 2 more answers
Hãy giúp tôi giảiiii​
Kazeer [188]

Answer:

fiikslid wugx uesbuluss wuz euzsbwzube

8 0
3 years ago
What savings account has the best rate of return on his interest
NeX [460]

Ally.com is a great savings account.

8 0
3 years ago
Editing tool for quickly making a repeated change throughout a document
riadik2000 [5.3K]
Find and Replace will work great
7 0
3 years ago
Other questions:
  • Helen has no experience in security. She would like to earn a certification that demonstrates that she has the basic knowledge n
    15·1 answer
  • An output device is any device that displays, prints, or plays content stored on a computer. from the list below, identify the d
    14·1 answer
  • The combination of two or more technologies or data feeds into a single, integrated tool is referred to as a _____.
    7·1 answer
  • You are going to be installing a videoconferencing system. One of the requirements of the system is that only workstations that
    10·1 answer
  • The Joint Photographic Experts Group developed the ___________ graphic format.
    12·2 answers
  • In the SQL environment, a _____________ is a logical group of database objects – such as tables and indexes – that are related t
    11·1 answer
  • What is the most likely cause of a print job rendering the wrong colors on the output?
    14·1 answer
  • Write a CashRegister class that can be used with the RetailItem class that you wrote in Chapter 6's Programming Challenge 4. The
    15·1 answer
  • 1 punto
    11·1 answer
  • (Java) Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!