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
When elements are placed on the page so that text and graphic elements are evenly distributed you have:
Mashcka [7]
When elements are placed on the page so that text and graphic elements are evenly distributed you have: balance.
6 0
3 years ago
Customer A with a Bronze service level package calls in a Critical System Failure at 9:00 AM. Customer B with a Silver service l
inysia [295]
This question depends on what the service level packages have to offer as an agreement. Does this question come with a list of what the service levels have to offer?
4 0
3 years ago
Paragraph talking about why i chose bill gates
AlekseyPX

Answer:

Bill Gates

Explanation:

Bill Gates is known as one of the richest entrepreneurs in the world. He is responsible for creating the largest computer and technology business in the world, Microsoft. In the company's early days, no one would have thought that it would change both America and the world from that point on.

When Gates first created Microsoft,

Middle class Americans could now purchase a personal computer that would not put a set back in their bank account.As soon as personal computers started hitting the mainstream market, the demand for improvement began. People wanted their machines to boot up faster, have larger memory, have improved programming, and be easier to use. Luckily Gates already knew the people would have these needs, so development was already underway.

7 0
3 years ago
What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
Tomtit [17]

The answer is Tablets. It is a portable personal computer, generally with a mobile operating system and LCD touchscreen display processing circuitry, and a rechargeable battery in a single thin, flat package. It is bigger than smartphones.

7 0
3 years ago
This is your code. >>> A = ['dog''red'] >>> B = [' cat', 'blue']>>>C = ['fish', 'green'] You can impl
natima [27]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The given Python code is:

>>> A = ['dog''red']

>>> B = [' cat', 'blue']

>>>C = ['fish', 'green']

We can implement an array of this data by using the dictionary in Python.

Dictionary in python:

A dictionary in python stores (key-value) pairs. For example, we can implement the -given arrays A, B, and C in the dictionary as given below:

d={'dog : red', 'cat : blue', 'fish : green'}

print(d['dog']) # Get an entry from a dictionary; prints "red"

print('cat' in d)    # Check if a dictionary has a given key; prints "True"

d['fish'] = 'black'    # Set an entry in a dictionary

print(d['fish'])      # Prints "black"

# print(d['elephant'])  # KeyError: 'elephant' not a key of d

print(d.get('elephant', 'N/A'))  # Get an element with a default; prints "N/A"

print(d.get('fish', 'N/A'))   # Get an element with a default; prints "black"

del d['dog']        # Remove an element from a dictionary

print(d.get('dog', 'N/A')) # "dog" is no longer a key; prints "N/A"

3 0
2 years ago
Read 2 more answers
Other questions:
  • For a color display using 8 bits for each of the primary colors (red, green, blue) per pixel, what should be the minimum size in
    6·1 answer
  • Can someone tell me how to get all A's with no effort?
    5·1 answer
  • How do you increase the amount of data in a sampled Google Analytics report?
    8·1 answer
  • Ruby is creating a presentation. She wants each slide displayed at intervals of five seconds. Which feature in the presentation
    6·2 answers
  • Customers access the internet through what usually for a monthly fee
    14·1 answer
  • A beginning driver may tend to oversteer. This means the driver what? Btw Cars are technology so that is why it is under Compute
    11·1 answer
  • The practice of using similar but not identical domain names is called _____. domain spoofing domain masquerading domain tasting
    13·1 answer
  • Some numbers are formed with closed paths. the digits 0, 4, 6 and 9 each have 1 closed path and 8 has 2. None of the other numbe
    6·1 answer
  • Help giving points mark BRAINLEST
    5·1 answer
  • How does a Cloud-first strategy approach a client's migration to the Cloud?by removing outside ecosystem partners from the Cloud
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!