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
murzikaleks [220]
3 years ago
12

Write an expression that will print "in high school" if the value of user_grade is between 9 and 12 (inclusive). Sample output w

ith input: 10 in high school

Computers and Technology
1 answer:
Strike441 [17]3 years ago
7 0

Answer:

Here is the expression:

user_grade = 10 #assigns 10 to the value of user_grade

if user_grade >=9 and user_grade <=12:  #checks if the user_grade is between 9 and 12 inclusive

   print('in high school')  # prints in high school if above condition is true

else:  #if user_grade is not between 9 and 12 inclusive

   print('not in high school') # prints not in high school if user_grade is not between 9 and 12 inclusive

This can also be written as:

user_grade = 10  # assigns 10 to user_grade

if 9<=user_grade<=12:  #if statement checks if user_grade is between 9 and 12 inclusive

   print('in high school')  #displays this message when above if condition is true

else:  #when above if condition evaluates to false

   print('not in high school')#displays this message

Explanation:

If you want to take the user_grade from user as input then:

user_grade = int(input("Enter user grade: "))

if user_grade >=9 and user_grade <=12:

   print('in high school')

else:

   print('not in high school')

The expression

if user_grade >=9 and user_grade <=12:  

contains an if statement that checks a condition that can either evaluate to true or false. So the if condition above checks if the value of user_grade is between 9 and 12 inclusive.

Here the relational operator >= is used to determine that user_grade is greater than or equals to 9. relational operator <= is used to determine that user_grade is less than or equals to 12.

The logical operator and is used so both user_grade >=9 and user_grade <=12 should hold true for the if condition to evaluate to true. This means the user_grade should be between 9 and 12 (inclusive).

For example is user_grade = 10 then this condition evaluates to true as 10 is between 9 and 12 (inclusive). Hence the message: in high school is displayed on output screen.

But if user_grade= 13 then this condition evaluates to false because 13 is greater than 12. Hence the message: not in high school is displayed on output screen.

If user_grade = 8 then this condition evaluates to false because 8 is less than 9. Notice here that 8 is less than 12 so one part of the condition is true i.e. user_grade <=12 but we are using logical operator and so both the parts/expressions of the if condition should evaluate to true. This is why this condition evaluates to false. Hence the message: not in high school is displayed on output screen.

The screenshot of program and its output is attached.

You might be interested in
In its entirety, the CCM process reduces the risk that ANY modifications made to a system result in a compromise to system or da
Tom [10]

Answer: True

Explanation: CCM process is the process which basically watches over any change or modification that is being made in the data and it will only be implemented when there is no adverse effect of the change.It procedure helps in reducing the risk due to any modification made in data of a system. CCM process also take care of the confidentiality of data and integrity as well and helps inn maintaining it.Therefore the given statement is true.

8 0
3 years ago
Under the Gramm-Leach-Bliley-Act (GLBA), banks must protect customer privacy. A given bank has just implemented its online banki
d1i1m1o1n [39]

Answer:

System/Application Domain and LAN-to-WAN Domain.

Explanation:

The Gramm-Leach-Bliley-Act is also referred to as the Financial Services Modernization Act of 1999. It was enacted by the 106th Congress of the United States of America and it requires that financial institutions explain to their customers the information sharing policies and ensure that customer sensitive data (privacy) is safeguarded.

This, under the Gramm-Leach-Bliley-Act (GLBA), banks must protect customer privacy.

In this scenario, a given bank has just implemented its online banking solution that allows customers to access their accounts and perform transactions via their computers or personal digital assistant (PDA) devices.

Hence, online banking servers and their public Internet hosting would fall within the System/Application Domain and LAN-to-WAN Domain.

In an IT infrastructure, there are seven main domains and these are the: User Domain, Workstation Domain, LAN Domain, LAN-to-WAN Domain, Remote Access Domain, WAN Domain, and System/Application.

3 0
3 years ago
Sara is having a tough time finding the cause of a problem on a computer she is troubleshooting. She found a possible problem bu
sp2606 [1]

<u>I will advise Sara to do research about the problem on the Internet.</u>

<u>Explanation</u>:

Internet is a network that helps in connecting one computer with other globally. Communication between the computers is possible until the computers are connected with to the Internet. Internet helps in getting information from any computer and interacts with the users of the computer.

Sara finds some issue with her computer. She was troubleshooting, but she could not find the exact problem. She was not sure with the problem that she found. It is better for Sara to do research about her problem on Internet and find the solution.

7 0
3 years ago
Google uses what strategy for matching web pages to your search request
OleMash [197]
It uses boolean operators and key words to match the correct web pages to the search request.
6 0
3 years ago
What is the hamming distance between the following bits? Sent
kirill115 [55]

I think

the hamming distance between the following bits its 5

8 0
3 years ago
Other questions:
  • How can social media be used in "child-driven" education? What benefits can students around the world gain from social media?
    12·1 answer
  • is family mobile and boost mobile the same? if not whats the difference? (btw this is a random question)
    12·2 answers
  • How can you print a mailing label in word
    13·1 answer
  • Which is the most effective manner to deliver a speech inmost business settings?extemporaneous presentationmemorizationreadingvi
    9·1 answer
  • #Write a function called alter_list. alter_list should have#two parameters: a list of strings and a list of integers.##The list
    11·1 answer
  • A security policy is a?
    11·2 answers
  • What game is the best for racing and modifying cars
    10·1 answer
  • Which statement about routers is !!!FALSE!!!
    10·1 answer
  • What is the best description of an unbound control?
    12·1 answer
  • Assume you have written a method with the header num yourMethod(string name, num code). The method's type is ____ .
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!