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
Readme [11.4K]
2 years ago
8

Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe

r even number. Hint: Use an if statement and the % operator to detect if n is odd, decrementing n if so. Enter an integer: 7 Sequence: 64 20 (2) If n is negative, output 0, Hint: Use an if statement to check if n is negative. If so, just set n = 0. Enter an integer: -1 Sequence: 0 Show transcribed image text (1) Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lower even number. Hint: Use an if statement and the % operator to detect if n is odd, decrementing n if so. Enter an integer: 7 Sequence: 64 20 (2) If n is negative, output 0, Hint: Use an if statement to check if n is negative. If so, just set n = 0. Enter an integer: -1 Sequence: 0
Computers and Technology
1 answer:
seropon [69]2 years ago
7 0

Answer:

The program in Python is as follows:

n = int(input("Enter an integer: "))

if n < 0:

   n = 0

print("Sequence:",end=" ")

for i in range(n,-1,-1):

   if i%2 == 0:

       print(i,end = " ")

Explanation:

This gets input for n

n = int(input("Enter an integer: "))

This sets n to 0 if n is negative

<em>if n < 0:</em>

<em>    n = 0</em>

This prints the string "Sequence"

print("Sequence:",end=" ")

This iterates from n to 0

for i in range(n,-1,-1):

This check if current iteration value is even

   if i%2 == 0:

If yes, the number is printed

       print(i,end = " ")

You might be interested in
_________________: informal messages that are passed on from person to person
sasho [114]

Answer:

Grapevine is the answer

4 0
3 years ago
Which of the following are screen objects used to maintain, view, and print data from a database
amid [387]

Answer:

The correct answer to the following question will be "A spreadsheet".

Explanation:

  • A spreadsheet is a software device used to access and stores data from such a database. The interaction between separate entities (in separate tables) is controlled by their specific columns.
  • It's a programming program for arranging, evaluating and storing data in tabular format.
  • The spreadsheets have been developed as computer-controlled analogs to paper reporting worksheets. The system runs on data decided to enter in table cells.

Therefore, a Spreadsheet is the right answer.

8 0
3 years ago
Write a function called min that returns the minimum of the two numbers passed in as parameters.
Kitty [74]

def min(x,y):

   smallest = x

   if y < smallest:

       smallest = y

   return smallest

x = min(2,1)

print("The min is "+str(x))

Although I wouldn't recommend using the name min for a function because min is the name of an existing function. Best of luck.

4 0
3 years ago
Many PC operating systems provide functionality that enables them to support the simultaneous execution of multiple applications
guapka [62]
The answer is multitasking. This is when the OS always programs to share resources to run at the same time.

If the applications were running on separate CPUs, then it would be multiprocessing.
3 0
3 years ago
Adam receives an email from his bank telling him there is a problem with his account. The email provides instructions and a link
Georgia [21]

Answer:

2 and 3

Explanation:

fill out all details because the email looks authentic

call the bank to determine if he email is authentic

hope this helps

8 0
2 years ago
Read 2 more answers
Other questions:
  • On a DTP project, Morgan is preparing digital files to be sent to a printer. Which word describes the activity that Morgan is pe
    5·2 answers
  • MATLAB graphics user interface:<br> Describe what Folder, Command Window and Workspace are.
    5·1 answer
  • An internet connection is required to access which type of software?
    5·1 answer
  • Why must a mobile application be easily customized and personalized?
    14·2 answers
  • Ayuda necesito 7 objetos que se utilizan en la vida diaria
    8·1 answer
  • I need a solution for this problem asap.
    7·1 answer
  • When you are typing data that is in a series, such as days of the week or months of the year, you can use this tool to complete
    11·1 answer
  • How are most databases organized?
    15·1 answer
  • True or Fale A criminal defense attorney's main focus is to convict the accused of a crime, and a state prosecutor is to defend
    12·2 answers
  • Hiding/masking personal identifiers from a data set, so that the data set can never identify an individual, even if it is correl
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!