
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Please answer in python

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.](https://content.bartleby.com/qna-images/question/efd607aa-6776-4e28-838c-67fa22c2e02e/9f4873e1-911a-4161-b28a-2d71b86b8574/0fmlbhs_thumbnail.jpeg)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
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.Similar questions
- Subject: Numerical method convert the decimal number 456.7893 to IEEE -754 32 bit floating point value.arrow_forwardLet R be the relation R= ((a, c), (a, d), (b, a), (c, a), (c, b),.(d.b). What is the matrix representation of this relation, given that the labels on the matru rows and on the matrix columns are in alphabetical order? ATE 10 01 1 100 0 1 100 10 1 0 0 p VTEarrow_forwardComputer programming use the binary number system.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education