1. Create a variable num and assign it an integer value. a) Implement some 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.

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
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.
   ```
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.
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
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
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