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
Margaret [11]
3 years ago
5

Write an expression that executes the loop body as long as the user enters a non-negative number. note: these activities may tes

t code with different test values. this activity will perform three tests, with usernum initially 9 and user input of 5, 2, -1, then with usernum initially 0 and user input of -17, then with usernum initially -1.
Computers and Technology
2 answers:
Elan Coil [88]3 years ago
3 0
If( usernum >= 0 )
{
   /* do something */
}
Lemur [1.5K]3 years ago
3 0

For the given problem, prompts the user to enter a number and then while loop is used to check whether a number is positive or not. Under the while loop body statement is printed and then input is stored in the user value. Then print the statement as ‘Done’.

Further Explanation:

Code: Following is the python code to that executes the loop body as long as the user enters a non-negative number.

#Prompt and read the input from the user

user_num = int(input('Enter a number:'))

#Loop is used to repeat the values of number

while (user_num>=0):

# If user enters a positive number then display the body statement.

print('Body')

user_num = int(input())

# Display the output.  

print('Done.')

Learn more:

1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011  

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623

Answer details:

Grade: College Engineering

Subject: Computer Science and Engineering

Chapter: Python Programming

Keyword:

python, input, output, programming, statements, if-else, loops, print, body, done, positive, negative, number, display, non negative, prompt, problem, test code, usernum, test, activity

You might be interested in
What is a set of illustrations displayed in a specific sequence to pre-visualize what your mobile app looks like and how it work
sveta [45]

Answer:

'Storyboarding' is the correct answer for the above question.

Explanation:

The mobile pre-visualization is a technique in which mobile phones are get shown about the use of them. The Storyboarding app will be helpful for this. It is an app that is used to display the work and use of mobile phones. It is also used when a student wants to write something creative.

The above question also states the same concept which is described above so the answer is Storyboarding for this question.

6 0
3 years ago
Which statement is used to create a file object that will append data to an existing file? BufferedWriter salesdata =
Temka [501]

Answer:

BufferedWriter salesdata = new BufferedWriter(new FileWriter("out.dat", true);.

Explanation:

  • The statement BufferedWriter salesdata = new BufferedWriter(new FileWriter("out.dat", true); can be used to create a file object that will append data to an existing file.
  • Here, BufferedWriter class is used to create text from an output stream.
  • Here, FileWriter is used to create the file from the text. The constructor for FileWriter is FileWriter (String filename, boolean append).
  • Here, filename is string ("out.dat") is provided and the append is boolean can be either true (if the text has to be appended at the end of the file) or false (if the text hasn't to be appended at the end of the file).
  • So, option (b) is correct.
  • Option (a) is not correct as it indicates the text shouldn't be appended at the end of the file as the boolean is false.
  • Option (c) is not correct as it doesn't mean to append as there is no boolean true indicated in the constructor.
  • Option (d) is not correct as there is not such kind of syntax.

8 0
4 years ago
Read 2 more answers
Here's another question!<br><br> What is some iterative programming structure uses?
inn [45]

Answer

Often in an algorithm, a group of statements needs to be executed again and again until a certain condition is met, this is where we find the need for iteration.

The repeated execution of some groups of code statements in a program is called iteration.

In iteration control structures, a statement or block is executed until the program reaches a certain state, or operations have been applied to every element of a collection. This is usually expressed with keywords such as while, repeat, for, or do..until.

The basic attribute of an iteration control structure is to be able to repeat some lines of code. The visual display of iteration creates a circular loop pattern when flowcharted, thus the word “loop” is associated with iteration control structures. Iteration can be accomplished with test before loops, test after loops, and counting loops. A question using Boolean concepts usually controls how often the loop will execute.

Applications of Iteration

Iteration methodology has various applications in the programming world

  • Problem-solving in arrays, vectors, lists, strings, etc.
  • Problem-solving using Stack, Queue and Priority Queue
  • Bottom-up implementation of Dynamic Programming
  • Implementation of greedy algorithms
  • BFS traversal of tree and graph
  • Problem-solving using Hash Table and BST
  • Iterative Implementation of recursive code using stack

Iteration (Repetition) Control Structures

pseudocode: While

count assigned zero

While count < 5

   Display "I love computers!"

   Increment count

End

pseudocode: Do While

count assigned five

Do

   Display "Blast off is soon!"

   Decrement count

While count > zero

pseudocode: Repeat Until

count assigned five

Repeat

   Display "Blast off is soon!"

   Decrement count

Until count < one

pseudocode: For

For x starts at 0, x < 5, increment x

   Display "Are we having fun?"

End

7 0
3 years ago
What's usually kept in database?
Levart [38]
I think this is the answer. I tried. Databases<span> may be </span>stored<span> on a computer and examined using a programs.</span>
7 0
4 years ago
Read 2 more answers
If you have limited means, you...?
WITCHER [35]

Answer:

You have very little or limited amounts of an item(s).

Explanation:

6 0
3 years ago
Other questions:
  • What term refers to a piece of software that interfaces with the hardware on your computer?
    10·2 answers
  • If you touch a downed power line covered or bare, what’s the likely outcome?
    10·2 answers
  • "The pkill command terminates _________."
    14·1 answer
  • Is main memory fast or slow?
    9·1 answer
  • What are two reasons people work?
    7·2 answers
  • Which of the following skills do employers in any field expect their employees<br> to have?
    5·1 answer
  • What is syntax?
    15·1 answer
  • Consider the following code:
    13·1 answer
  • Subjective Questions
    11·1 answer
  • Your class requires you to use a program you must download on your computer. You have waited until day 5 of the week to download
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!