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
Sphinxa [80]
2 years ago
5

The problem below uses the function get_numbers() to read a number of integers from the user. Three unfinished functions are def

ined, which should print only certain types of numbers that the user entered. Complete the unfinished functions, adding loops and branches where necessary. Match the output with the below sample:
Enter 5 integers:

0 5

1 99

2 -44

3 0

4 12

Numbers: 5 99 -44 0 12

Odd numbers: 5 99

Negative numbers: -44
Computers and Technology
1 answer:
AlexFokin [52]2 years ago
4 0
Size=6

def get_numbers(num):
numbers = []
print('Enter %s integers:' % num)

for i in range(0,num):
print(i,end=' ')
user_input = int(input())
numbers.append(user_input) # Add to numbers list
return numbers

def print_all_numbers(numbers):
# Print numbers
print('\nNumbers:',end=' ')
for i in range(0,len(numbers)):
print(numbers[i],end=' ')

def print_odd_numbers(numbers):
# Print all odd numbers
print('\nOdd numbers:',end=' ')
for i in range(0, len(numbers)):
if numbers[i]%2!=0:
print(numbers[i], end=' ')


def print_negative_numbers(numbers):
# Print all negative numbers
print('\nNegative numbers:',end=' ')
for i in range(0, len(numbers)):
if numbers[i] <0:
print(numbers[i], end=' ')

nums = get_numbers(size)
print_all_numbers(nums)
print_odd_numbers(nums)
print_negative_numbers(nums)

You might be interested in
Codehs python 4.7.6 Powers of Two <br> it says I'm wrong because I need
Finger [1]

Following are the program to calculate the power of two:

Program Explanation:

  • Defining an integer variable "i" that hold an integer value.
  • Defining a for loop that checks "i" value in between 20, inside this it calculates power of two.
  • At the last use print method to print its value.

Program:

i=1#holding integer value in i

for i in range(20):#defining a for that starts 1 to 20    

   i = 2 ** i#calculate power of 2 in i variable

   print(i)#print value

Output:

Please find the attached file.  

Learn more:

brainly.com/question/23170807

8 0
3 years ago
Read 2 more answers
Can someone please tell me how to divide 2 columns in Ms excel and put the values in one column.
frozen [14]
Your best bet is to research about it online or watch tutorials on YouTube for a better understanding :) <span />
7 0
4 years ago
What is the most popular genre of video games?
marissa [1.9K]

Explanation: Battle Royale games are currently the market's most popular genre of games. These types of games fall under the action category.

Answer:  

A. Action

6 0
3 years ago
Read 2 more answers
Components of an operating system include process,memory,and file management. what is another component of and operating system
kirza4 [7]

Answer:

Wrong it's actually C.

Explanation:

APEX

4 0
3 years ago
Read 2 more answers
Stacy plans to print her contacts and would like to choose an option that will print select information for each contact in a bu
Gelneren [198K]

Answer: memo style

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • What chage command should you enter at the comman prompt to set the password to jsmith expire after 60 days and gives a warning
    12·1 answer
  • Individuals and businesses have concerns about data security while using Internet-based applications. Which security risk refers
    13·1 answer
  • What is not soured of income
    6·1 answer
  • Which of the following is the key benefit is offered by the Internet channel? Group of answer choices Deeper assortments Immedia
    7·1 answer
  • ___ is a family of data formats that helps people automatically receive feeds anytime there are new postings to their favorite b
    14·1 answer
  • A typical day in programming and software development would involve
    12·1 answer
  • What effect does social media have on teens?
    10·2 answers
  • What kind of network connection do you think is used to connect most wireless video game controllers to consoles, and why would
    8·1 answer
  • If you have limited means, you...?
    9·1 answer
  • What's a website layout
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!