Classwork 1

Python Basics

Author

Byeong-Hak Choe

Published

February 6, 2024

Modified

February 11, 2024

Part I - Python Basics

Question 1

Using Python operations only, calculate below: \[\frac{2^5}{7 \cdot (4 - 2^3)}\]

Answer




Question 2

For each expression below, what is the value of the expression? Explain thoroughly.

20 == '20'
x = 4.0
y = .5

x < y or 3*y < x

Answer




Question 3

fare = "$10.00"
tip = "2.00$"
tax = "$ 0.80"

Write a Python code that uses slicing and the print() function to print out the following message:

The total trip cost is: $12.80


Answer




Question 4

list_variable = [100, 144, 169, 1000, 8]

Write a Python code that uses print() and max() functions to print out the largest value in the list, list_variable, as follows:

The largest value in the list is: 1000


Answer




Question 5

Import the pandas library as pd

Answer




Part II - Introduction to Markdown

Markdown is a lightweight markup language with plain-text formatting syntax. Its main goal is to be readable and easy to write, even when viewed as plain text. Markdown is widely used for creating formatted text on the web and in various applications such as Jupyter Notebooks in Google Colab.

Basic Syntax

Headings

Headings are created by adding one or more # symbols before your heading text. The number of # symbols indicates the level of the heading.

# Heading 1
## Heading 2
### Heading 3

Emphasis

You can make text bold by wrapping it with two asterisks **, and italic by using one asterisk *.

*italic* or _italic_
**bold** or __bold__

Lists

Unordered lists are created using *, -, or +, while ordered lists are numbered.

- Item 1
- Item 2
  - Subitem 2.1
  - Subitem 2.2
1. First item
2. Second item

Advanced Syntax

Blockquote

> Be yourself. Everyone else is already taken. - Oscar Wilde.

Emojis

Code Blocks

Code blocks are created by using triple backticks (```). Optionally, you can specify the language for syntax highlighting.

```
"string"
```
```python
# Python code block
import numpy as np
```

Question 6

  • Do the following tasks on this Classwork 1 Discussion Board:
    1. Basic Syntax: Write a comment with your name, a heading, an unordered list, an ordered list, a link, and an image.
    2. Advanced Syntax: Write a comment that includes a Python code block, a blockquote, and an emoji.

References


Discussion

Welcome to our Classwork 1 Discussion Board! 👋

This space is designed for you to engage with your classmates about the material covered in Classwork 1.

Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.

If you have any specific questions for Byeong-Hak (@bcdanl) regarding the Classwork 1 materials or need clarification on any points, don’t hesitate to ask here.

Let’s collaborate and learn from each other!

Back to top