Jump to level 1 Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 3 if user_num2 is greater than 13. Otherwise, print "user_num2 is less than or equal to 13.". End with newline.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
CHALLENGE ACTIVITY
4.7.2: If-else statements.
 
344614.2153518.qx3zqy7
Jump to level 1
Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 3 if user_num2 is greater than 13. Otherwise, print "user_num2 is less than or equal to 13.". End with newline.
 
# 4.7.2: If-else Statements

### Challenge Activity

**Objective:**

Print "user_num1 is negative." if `user_num1` is less than 0. End with a newline.

Assign `user_num2` with `3` if `user_num2` is greater than 13. Otherwise, print "user_num2 is less than or equal to 13." End with newline.

### Code Template:

```python
user_num1 = int(input())
user_num2 = int(input())

''' Your code goes here '''

print('user_num2 is', user_num2)
```

**Instructions:**

1. Use an if-else statement to check if `user_num1` is negative and to assign a value or print a message for `user_num2`.
2. Implement the required logic inside the designated area in the code.

**Example:**

If `user_num1` is `-5` and `user_num2` is `10`, the output should be:

```
user_num1 is negative.
user_num2 is less than or equal to 13.
user_num2 is 10
```

- Make sure to test the code with different inputs to ensure it behaves as expected.

**Note:** There are no graphs or diagrams in this activity.
Transcribed Image Text:# 4.7.2: If-else Statements ### Challenge Activity **Objective:** Print "user_num1 is negative." if `user_num1` is less than 0. End with a newline. Assign `user_num2` with `3` if `user_num2` is greater than 13. Otherwise, print "user_num2 is less than or equal to 13." End with newline. ### Code Template: ```python user_num1 = int(input()) user_num2 = int(input()) ''' Your code goes here ''' print('user_num2 is', user_num2) ``` **Instructions:** 1. Use an if-else statement to check if `user_num1` is negative and to assign a value or print a message for `user_num2`. 2. Implement the required logic inside the designated area in the code. **Example:** If `user_num1` is `-5` and `user_num2` is `10`, the output should be: ``` user_num1 is negative. user_num2 is less than or equal to 13. user_num2 is 10 ``` - Make sure to test the code with different inputs to ensure it behaves as expected. **Note:** There are no graphs or diagrams in this activity.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education