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
A standard for compressing music into computer files that can be easily exchanged on the Internet is called a(n) ______. A. musi
Sophie [7]

Answer:

The correct answer is E. MP3

Explanation:

MP3 (formally MPEG-1 Audio Layer III or MPEG-2 Audio Layer III) is a coding format for digital audio. MP3 as a file format commonly designates files containing an elementary stream of MPEG-1 audio and video encoded data, without other complexities of the MP3 standard. The MP3 format makes it possible to compress a song into a file small enough to be uploaded, downloaded, emailed, and stored on a hard drive.

4 0
3 years ago
Your isp connects to the core routers of the internet via a _____. cable mode spine backbone satellite
melisa1 [442]

fairly certain its backbone

5 0
3 years ago
Dns uses udp instead of tcp. if a dns packet is lost, there is no automatic recovery. does this cause a problem, and if so, how
grandymaker [24]
Packet loss is typically resolved by time-outs and retries. For applications where a duplicate operation doesn't matter this is acceptable.
7 0
2 years ago
Why would a network administrator want to filter certain ports when capturing data such as FTP traffic
hjlf

Answer:

To avoid receiving malware-infected files like spam.

Explanation:

Hackers use malware to gain unauthorized access to company files and information for personal gain. Files infected by the malware can infect other systems or files. There are various types of malware namely; virus, trojan horse, worm, spyware, ransomware, adware etc.

5 0
2 years ago
A company has a popular gaming platform running on AWS. The application is sensitive to latency because latency can impact the u
AysviL [449]
Yetwywywywywywyyw would
8 0
2 years ago
Other questions:
  • Calculated fields can be entered in queries. What row should you type a calculated field in?
    13·1 answer
  • Which protocol can be used to send ipv6 packets over an ipv4 network?
    5·1 answer
  • What best compares potrait and landscape orientations
    6·1 answer
  • Which of the following are characteristics of global variables? Check all that apply.
    5·2 answers
  • What is boolean rules​
    12·1 answer
  • Candy Kane Cosmetics (CKC) produces Leslie Perfume, which requires chemicals and labor. Two production processes are available:
    14·1 answer
  • Which important aspect of the Roman Empire did the barbarians destroy?
    14·2 answers
  • Is there a way for me to play a .mp3 file from my computer using Atom?
    10·1 answer
  • Help please match them if you just put a link or say “I don’t know but thanks for the points” I’ll report your answer and you wo
    10·1 answer
  • I will give brainyest
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!