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
Direct connections provide continuous access to the Internet. Many bandwidth options are associated with direct connections. Whi
Murljashka [212]

Answer:

Option B i.e, T1.

Explanation:

The T1 seems to be the licensed electronic transmission connection efficient for delivering the following bits each sec. T1 lines are required to transmit that server information of such an organization to both the Web or to link to such an ISP.

  • Option A is incorrect because their transmission is different as compared to the T1.
  • Option C is incorrect because consumers are equipped with a high rates broadband link from such a mobile wall socket over an installed telecommunications line.
  • Option D is incorrect because it seems to be a circuit-switched telecommunications line infrastructure that communicates both information as well as voice across a wire cable.
6 0
3 years ago
Please help me please please
Leya [2.2K]
The light is shining on the left side of his face because the shadow is on the other side
6 0
2 years ago
Read 2 more answers
In which step of writing a program does a programmer first use a<br> compiler?<br> documentin
Allisa [31]

A compiler is often used when you want to test your code; that would often be your second step.

6 0
3 years ago
How many times is the body of the loop executed?
Flura [38]

Answer:

The loop will run 5 times.

3 0
2 years ago
What is TCP/IP's Transport layer's primary duty?
lorasvet [3.4K]

Answer:

 The TCP/IP is the transmission control protocol and internet protocol and in the TCP/IP model the transport layer is the second layer.

The primary responsibility of this layer is that it is basically used to deliver messages to the host and that is why it is known as end to end layer.

It basically provide the point to point connection between the destination to server host for delivering the various types of the services efficiently and reliably.

In the TCP/IP model the transport layer are basically responsible for transferring the data or service error free between the server to destination host.

3 0
3 years ago
Other questions:
  • Theâ ______ is a large worldwide collection of networks that use a common protocol to communicate with one another.
    5·1 answer
  • Suppose two hosts, A and B, are separated by 7,500 kilometers and are connected by a direct link of R = 10 Mbps. Suppose the pro
    7·1 answer
  • Siva added a "Contact Form" to her website.
    10·1 answer
  • C++ CODE
    6·1 answer
  • Air circulation is caused by ... A Earth's rotation around the sun B winds that move vertically C moving air between hot and col
    11·1 answer
  • What is your favorite food
    11·2 answers
  • What is the output of the following program?
    10·1 answer
  • Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is
    14·1 answer
  • Identify two real-world examples of problems whose solutions do scale well
    13·1 answer
  • Write a program asks the user for an integer N and then adds up the first N odd integers. For example, if the user asks the sum
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!