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
sashaice [31]
2 years ago
5

Write an expression that executes the loop body as long as the user enters a non-negative number.

Computers and Technology
2 answers:
Orlov [11]2 years ago
8 0

Answer:

user_num >= 0 or 0 <= user_num

Explanation:

You want to use one of the comparison operators, to solve this problem, and in this case you're going to specifically use: >= or <=, which is "greater than or equal to" and "less than or equal to", either can be used, it just depends where you place the numbers, kind of like how 10 >= 3 and 3 <= 10 are both true.

So in this case it says "non negative" number, this means that the number is greater than or equal to 0, The reason the equal to is included is because 0 is not negative. this means that you want to include it as well. So don't do user_num > 0, since that would exclude 0, which is not negative. So you're solution for the while loop will be:

while user_num >= 0:

   # code

or you can do

while 0 <= user_num:

   # code

Although I would probably go with user_num >= 0, since it seems to be the most understandable at a glance, although both should work.

Grace [21]2 years ago
7 0

Answer:

user_num = 9

while user_num > -1:

 print("Body")

 user_num = int(input())

print("Done")

If this answer helped consider rating and marking brainliest :)

You might be interested in
What areas do you need to grow your knowledge in to understand your financial future?
lubasha [3.4K]

Answer:

hi…

Explanation:

I would develop my knowledge in business, financial economics, financial mathematics, and practical finance

8 0
3 years ago
a term to describe article that can be displayed in their entirety as opposed to abstract and reference only?​
Maurinko [17]

Answer:

would it be term and tequnique?

Explanation:

oooooooo

7 0
3 years ago
Does Windows 7 support secure boot in UEFI? Windows eight? Linux UBUNTU version 14?
Anni [7]
Yes, windows 7 does support secure boot in UEFI. UEFI allows for backward compatibility. IT can boot a MBR hard drive and provides a BIOS boot through its Compatibility Support Module (CSM) feature.
4 0
3 years ago
In python please:
Vikki [24]

Answer:

"

if 'marsupial' in dictionary:

   del dictionary['marsupial']

else:

   print("The key marsupial is not in the dictionary")

"

Explanation:

So you can use the keyword "in" to check if a certain key exists.

So the following code:

"

if key in object:

   # some code

"

will only run if the value of "key" is a key in the object dictionary.

So using this, we can check if the string "marsupial' exists in the dictionary.

"

if 'marsupial' in dictionary:

   # code

"

Since you never gave the variable name for the variable that references a dictionary, I'm just going to use the variable name "dictionary"

Anyways, to delete a key, there are two methods.

"

del dictionary[key]

dictionary.pop(key)

"

Both will raise the error "KeyError" if the key doesn't exist in the dictionary, although there is method with pop that causes an error to not be raised, but that isn[t necessary in this case, since you're using the if statement to check if it's in the dictionary first.

So I'll just use del dictionary[key] method here

"

if 'marsupial' in dictionary:

   del dictionary['marsupial']

else:

   print("The key marsupial is not in the dictionary")

"

The last part which I just added in the code is just an else statement which will only run if the key 'marsupial' is not in the dictionary.

3 0
2 years ago
The length of a pencil would most likely be measured in:
Nataliya [291]
The length of the pencil would most likely be measured in centimeters.
6 0
3 years ago
Read 2 more answers
Other questions:
  • In the U.S. highway numbering system, north-south routes have
    9·2 answers
  • How has science fiction influenced technology
    7·2 answers
  • I will upvote....
    10·1 answer
  • Study the sentences below. A.Changing the properties of characters in a sentence or paragraph in a Word document helps increase
    5·2 answers
  • This is for career exploration, I need help please! &lt;3 HELPPPP
    8·2 answers
  • O Why was the Internet originally constructed? Oto enable researchers to communicate
    6·2 answers
  • Assume that you have the business data in various sources such as Excel, .csv, text files and Access, Oracle databases. Write th
    9·1 answer
  • What is computer give definition ​
    14·2 answers
  • MR. Tom asked her students could they plant a flower and bring it to class. Sarah brought his flower and said it was a rose. Jam
    6·1 answer
  • What is another term used for next generation firewalls
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!