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
topjm [15]
2 years ago
12

In python, Create a conditional expression that evaluates to string "negative" if user_val is less than 0, and "non-negative" ot

herwise.
Computers and Technology
1 answer:
marshall27 [118]2 years ago
6 0

I am assuming that user_val is an inputted variable and a whole number (int)...

user_val = int(input("Enter a number: "))

if user_val < 0:

   print("negative")

else:

   print("non-negative")

You might be interested in
Write a program that reads numbers from scanf (keyboard) and then sums them, stopping when 0 has been entered. Construct three v
almond37 [142]

Answer:

For loop Version:

#include <stdio.h>

int main()

{

   int number, sum = 0;

   printf("Enter a positive integer: ");

   scanf("%d", &number);

   

   for (int i = 0; i <= number; i++) {

       if(number == 0)

           break;

       sum += number;

       

       printf("Enter a positive integer: ");

       scanf("%d", &number);

   }

   printf("Sum is: %d", sum);

   return 0;

}

- - - - -

While Loop Version:

#include <stdio.h>

int main()

{

   int number, sum = 0, i = 0;

   printf("Enter a positive integer: ");

   scanf("%d", &number);

   

   while (number != 0) {

       sum += number;

       

       printf("Enter a positive integer: ");

       scanf("%d", &number);

   }

   printf("Sum is: %d", sum);

   return 0;

}

Do-while Loop Version:

#include <stdio.h>

int main()

{

   int number, sum = 0, i = 0;

   

   do {

       printf("Enter a positive integer: ");

       scanf("%d", &number);

       

       sum += number;

       

   } while (number != 0);

   printf("Sum is: %d", sum);

   return 0;

}

Explanation:

- Initialize the variables

- Ask the user for the numbers until the user enters 0

-  Calculate and print the sum

4 0
2 years ago
Web client software, such as Chrome, Firefox, Internet Explorer, Safari, and Opera, that are used to view Web pages are known as
evablogger [386]

Answer: Web Browsers

Explanation: The application software that works on the World Wide Web(www) is known as the web browser. Web browsers are the application must be installed on the user's system so that the accessing of the web server can be done.

There are different types of web browsers, out of which the most popular is Chrome and other examples are Internet Explorer, Opera, Firefox etc.

8 0
2 years ago
Read 2 more answers
What considerations should you make when deciding on the size of a table?
Kisachek [45]

Answer:

You should consider the number of cells needed for data, labels, titles, and formulas.

Explanation:

4 0
2 years ago
Aiming high means???
Llana [10]

Answer:

in what context is it in? it could be aim high for goals set limits that are hard to reach but not impossible

Explanation:

5 0
3 years ago
Louis wrote a check of $100 to the electricity company. After a few days he received a Notice of Dishonor from the bank regardin
diamong [38]

the checked bounced because he didn’t have any money.

mark me brainliest please!!!!!

4 0
2 years ago
Other questions:
  • Assume that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 month
    13·1 answer
  • Angle, oblique, regular, demi, roman, heavy, extra bold, expanded, and compressed are ___________ . Select one: A. type styles B
    10·1 answer
  • Generate an array x that has n=100 random numbers that are uniformly distributed over the interval [0,1) . Look up how to use th
    8·1 answer
  • Our readings so far explored computer hardware and software, in particular operating systems and application software. There are
    11·1 answer
  • Use the Windows ________ to check on a nonresponsive program. Select one: A. Backup utility B. Task Manager C. System Restore D.
    10·1 answer
  • What does an operating system do?
    12·1 answer
  • Porque es importante la tecnología?​
    8·1 answer
  • Table Setting in any occasion can add to the beauty and significance of the event. It may
    6·1 answer
  • What year does futurist ray kurzweil believe ai will meet human intelligence?.
    7·2 answers
  • if we intend to include a servo motor as an actuator, what feature should we include when selecting a microcontroller?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!