Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
Please answer in python
**Week 3 - IT 1613 Assignments**

1. **Task 1:**
   - Create a variable `num` and assign it an integer value.
   - Implement code that prints if `num` is divisible by 5 and/or 3.
     1. `num` is divisible by 3
     2. `num` is divisible by 5

   **Output Example:**
   ```
   15 is divisible by 5.
   15 is divisible by 3.
   ```

2. **Task 2:**
   - Create a variable `num` and assign it an integer value.
   - Implement code that prints **only one** of the following statements based on the value of `num`:
     1. `num` is divisible by 2
     2. `num` is divisible by 4
     3. `num` is not divisible by 2 or 4

   **Output Example:**
   ```
   12 is divisible by 4.
   ```

3. **Task 3:**
   - Create a variable `num` and assign it an integer value.
   - Implement code that prints **only one** of the following statements based on the value of `num`:
     1. `num` is a positive even integer greater than 50
     2. `num` is a negative odd integer

   **Output Example:**
   ```
   52 is a positive even integer greater than 50.
   ```
expand button
Transcribed Image Text:**Week 3 - IT 1613 Assignments** 1. **Task 1:** - Create a variable `num` and assign it an integer value. - Implement code that prints if `num` is divisible by 5 and/or 3. 1. `num` is divisible by 3 2. `num` is divisible by 5 **Output Example:** ``` 15 is divisible by 5. 15 is divisible by 3. ``` 2. **Task 2:** - Create a variable `num` and assign it an integer value. - Implement code that prints **only one** of the following statements based on the value of `num`: 1. `num` is divisible by 2 2. `num` is divisible by 4 3. `num` is not divisible by 2 or 4 **Output Example:** ``` 12 is divisible by 4. ``` 3. **Task 3:** - Create a variable `num` and assign it an integer value. - Implement code that prints **only one** of the following statements based on the value of `num`: 1. `num` is a positive even integer greater than 50 2. `num` is a negative odd integer **Output Example:** ``` 52 is a positive even integer greater than 50. ```
Certainly! Here's a transcription of the text and a description of the exercises as they would appear on an educational website:

---

**Programming Exercises**

4. **Final Grade Calculation**
   - Create a variable `final_grade` and assign it a value between 50 and 100.
   - **Task:**
     1. Print the associated letter grade based on these ranges:
        - Between 96 and 100, the letter grade is A.
        - Between 64 and 95, the letter grade is Passing.
        - Below 64, the letter grade is Not Passing.
     2. Test the program with these values for `final_grade`: 96, 95, 75, 64, 63.

   **Output Example:**
   ```
   75 is a grade of Passing.
   ```

5. **Average of Passing Grades**
   - Create a list `grades`: 95, 63, 80, 53, 90, 56.
   - **Task:**
     1. Compute and print the average of all passing grades (64 or better).

   **Output Example:**
   ```
   Average of the passing grades is 88.
   ```

6. **List Comprehension for Multiples**
   - Create a list comprehension `numbers` which contains 1 to 30 inclusive.
   - **Tasks:**
     1. Horizontally print `numbers` that are multiples of 3 or 5.
     2. Horizontally print `numbers` that are multiples of 3 but not of 5.
     3. Horizontally print `numbers` that are not multiples of 3 or 5.

   **Output Example:**
   ```
   3 5 6 9 10 12 15 18 20 21 24 25 27 30  [Multiples of 3 or 5]
   3 6 9 12 18 21 24 27                [Multiples of 3 but not 5]
   1 2 4 7 8 11 13 14 16 17 19 22 23 26 28 29  [Not multiples of 3 or 5]
   ```

---

These exercises aim to practice basic programming concepts like conditionals, loops, and list comprehensions using practical examples.
expand button
Transcribed Image Text:Certainly! Here's a transcription of the text and a description of the exercises as they would appear on an educational website: --- **Programming Exercises** 4. **Final Grade Calculation** - Create a variable `final_grade` and assign it a value between 50 and 100. - **Task:** 1. Print the associated letter grade based on these ranges: - Between 96 and 100, the letter grade is A. - Between 64 and 95, the letter grade is Passing. - Below 64, the letter grade is Not Passing. 2. Test the program with these values for `final_grade`: 96, 95, 75, 64, 63. **Output Example:** ``` 75 is a grade of Passing. ``` 5. **Average of Passing Grades** - Create a list `grades`: 95, 63, 80, 53, 90, 56. - **Task:** 1. Compute and print the average of all passing grades (64 or better). **Output Example:** ``` Average of the passing grades is 88. ``` 6. **List Comprehension for Multiples** - Create a list comprehension `numbers` which contains 1 to 30 inclusive. - **Tasks:** 1. Horizontally print `numbers` that are multiples of 3 or 5. 2. Horizontally print `numbers` that are multiples of 3 but not of 5. 3. Horizontally print `numbers` that are not multiples of 3 or 5. **Output Example:** ``` 3 5 6 9 10 12 15 18 20 21 24 25 27 30 [Multiples of 3 or 5] 3 6 9 12 18 21 24 27 [Multiples of 3 but not 5] 1 2 4 7 8 11 13 14 16 17 19 22 23 26 28 29 [Not multiples of 3 or 5] ``` --- These exercises aim to practice basic programming concepts like conditionals, loops, and list comprehensions using practical examples.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education