answer.
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
nignag [31]
2 years ago
9

Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only

the expression. Sample output with input: 17 18 or less
Computers and Technology
2 answers:
Tcecarenko [31]2 years ago
7 0

Answer:

user_age = int(input())

if user_age <= 18:

  print('18 or less')

else:

  print('Over 18')

Explanation:

#define user_age with: integer (input(' #from user')

user_age = int(input())

#"if" statement: user_age is less than or equal to 18 than ///

if user_age <= 18:

#Print ('Enter desired output here')

  print('18 or less')

#"else" statement: If above is not true then ///

else:

#Print ('Enter desired output here')

  print('Over 18')

lana [24]2 years ago
6 0

Answer:

if (user_age<=18){

           System.out.println("18 or less");

       }

Explanation:

The above expression in Java will print "18 or less" if the input is less than 18.

Consider a complete java program that request a user to input his/her age below and prints "18 or Less" if the user age is less or equal to 18.

import java.util.Scanner;

public class num2 {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

       System.out.println("enter age:");

       int user_age =in.nextInt();

       if (user_age<=18){

           System.out.println("18 or less");

       }

       else

       {

           System.out.println("greater than 18");

       }

   }

}

You might be interested in
CodeLab Question
castortr0y [4]

Answer:

Idk the language of code but here is how it would be done in python

myAlarm():

   arm = True

   code = "secret message"

myAlarm()

main():

deactivate = input(">>> ")

if deactivate = myAlarm.code:

  arm = False

Im still a little confused on the question.

(I am a game designer and I code daily)

3 0
2 years ago
1⁰=?<br> Is equal to...........
Murrr4er [49]

Answer:

1

Explanation:

Anything to the 0th power is 1. However, 0⁰ is undefined.

5 0
2 years ago
Read 2 more answers
When using the Python shell and code block, what triggers the interpreter to begin evaluating a block of code
finlep [7]

Answer:

The answer is "A blank line".

Explanation:

The blank line initiates the interpreter to start examining the line of statements whenever the Python shell as well as the code block are used.  

  • It is also known as the line that has nothing but spaces or lines without texts or a line.  
  • It prints an empty sheet,  which leaves its performance with such a blank line.

5 0
2 years ago
Using the Sakila database, create a query that displays the film title, description, as well the actor first and last name for a
Alex787 [66]

Answer:

Select title, description , first_name, last_name from film inner join film_actor on film.film_id = film_actor.film_id inner join actor on film_actor.actor_id = actor.actor_id where title LIKE 'zo%';

Explanation:

  • The INNER JOIN keyword selects records that have matching values in both tables.
  • The WHERE clause is used to filter records.
  • The WHERE clause is used to extract only those records that fulfill a specified condition.
7 0
2 years ago
A painting company has determined that for every 115 square feet or wall space, one gallon of paint and eight hours of labor wil
Kay [80]

The program to calculate the total paint cost and other values is given below.

#include <iostream>

using namespace std;

int main() {  

 int rooms, laborChrg = 18;

 float paintChrg;

 float feetPerRoom[rooms];  

 float paintReq, laborHrs, paintCost, laborCost, totalCost, totalsqft=0;  

 cout<<"Enter the number of rooms to be painted "<<endl;

 cin>>rooms;  

 for(int i=0; i <= rooms; i++)

 {

 cout<<"Enter the square feet in room "<<endl;

 cin>>feetPerRoom[i];  

 // shortcut operator which is equivalent to totalsqft = totalsqft +     feetPerRoom[i];

 totalsqft += feetPerRoom[i];

 }  

 cout<<"Enter the cost of the paint per gallon "<<endl;

 cin>>paintChrg;  

 laborHrs = (totalsqft/115)*8;

 laborCost = laborHrs * laborChrg;  

 paintReq = totalsqft/115;

 paintCost = paintReq * paintChrg;  

 totalCost = laborCost + paintCost;  

 cout<<"The number of gallons of paint required "<<paintReq<<endl;

 cout<<"The hours of labor required "<<laborHrs<<endl;

 cout<<"The cost of the paint is "<<paintCost<<endl;

 cout<<"The labor charges are "<<laborHrs<<endl;

 cout<<"The Total cost of the paint job is "<<totalCost<<endl;  

 return 0;

}

Explanation:

The header files for input and output are imported.

#include <iostream>

using namespace std;

All the variables are taken as float except labour charge per hour and number of rooms.

The user is asked to input the number of rooms to be painted. An array holds the square feet in each room to be painted.

cout<<"Enter the number of rooms to be painted "<<endl;

cin>>rooms;  

for(int i=0; i <= rooms; i++)

{

cout<<"Enter the square feet in room "<<endl;

cin>>feetPerRoom[i];  

totalsqft += feetPerRoom[i];

}  

The above code asks for square feet in each room and calculates the total square feet to be painted simultaneously.

All the data to be displayed is calculated based on the values of labor charge per hour and gallons of paint needed, given in the question.

laborHrs = (totalsqft/115)*8;

laborCost = laborHrs * laborChrg;

paintReq = totalsqft/115;

paintCost = paintReq * paintChrg;

totalCost = laborCost + paintCost;

All the calculated values are displayed in the mentioned order.

7 0
2 years ago
Other questions:
  • Why would Network Systems employees be employed by the government?
    12·2 answers
  • A(n) _____ can be used to reveal a competitor’s program code, which can then be used to develop a new program that either duplic
    9·1 answer
  • Modern operating system decouple a process address space from the machine's physical memory. list two advantages of this design.
    6·1 answer
  • Two technicians are discussing lung protection in the shop. Technician A says that respiratory-protection devices can prevent yo
    5·2 answers
  • Edward has started up a new company with his friend, Matthew. Currently, he has only two people working with him. Which type of
    8·1 answer
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • ______ is a statistic that measures how quickly the staff corrected a network problem after they arrived at the problem site. MT
    9·1 answer
  • Please answer this a due tomorrow!!!
    12·1 answer
  • Initialize a list. ACTIVITY Initialize the list short.names with strings 'Gus', Bob, and 'Ann'. Sample output for the given prog
    9·1 answer
  • A bank in your town updates its customers’ accounts at the end of each month. The bank offers two types of accounts: savings and
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!