Update for second event

This commit is contained in:
Ceda EI 2023-06-11 15:29:07 +05:30
parent 6f39367173
commit 6a9ae661b4
6 changed files with 157 additions and 12 deletions

BIN
asm-example.mp4 Normal file

Binary file not shown.

BIN
asm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 KiB

View File

@ -4,3 +4,32 @@ table, th, td {
padding: 6px 15px;
margin: auto;
}
.text-qr {
display: flex;
flex-wrap: none;
width: 100%;
align-content: space-between;
align-items: center;
}
.text-qr :first-child {
flex-grow: 1;
}
a {
text-decoration: none;
color: hsl(321, 100%, 29%);
font-style: italic;
}
.asm {
width: 100%;
align-content: space-between;
}
.asm img, .asm video {
height: 400px;
}

BIN
qr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

140
slides.md
View File

@ -1,7 +1,7 @@
class: center, middle
# Introduction to Programming
## Irene - Dec 24, 2022
## Irene - Jun 11, 2023
---
@ -44,17 +44,11 @@ binary.
- English: `marker`
- Binary: ` 01101101 01100001 01110010 01101011 01100101 01110010`
--
???
## ASCII Codes
DO NOT dive into binary conversion.
| Letter | Decimal | Binary |
|:------:|:-------:|----------|
| A | 65 | 01000001 |
| a | 97 | 01100001 |
| B | 66 | 01000010 |
| b | 98 | 01100010 |
| . | 46 | 00101110 |
Simply use electric signals as two states - hence 1, 0.
---
@ -65,9 +59,16 @@ binary.
- The number tells the computer what to do.
- The computer executes this and then moves on to the next instruction.
<div class="asm">
<img src="./asm.png">
<video controls muted>
<source src="./asm-example.mp4">
</video>
</div>
???
Use the menu analogy. We visited a restaurant some time ago.
Build a hypothetical machine. Create ASM for it.
```
@ -211,8 +212,123 @@ total = num1 + num2
print(total)
```
---
# Operators
There are various types of operators in python.
--
- Arithmetic
- `+ - * / % **`
--
- Comparison
- `== > >= < <=`
--
- Logical
- `and or not`
---
## Out of today's scope
- Assignment
- `= += -= *= /= //= %= **=` etc
- Bitwise
- `| & ^ >> << ~`
- Membership
- `in, not in`
- Identity
- `is, is not`
---
# Conditionals
We can branch our code based on the result of conditions.
```python
if condition:
some_statements
elif condition_2:
some_statements
elif condition_3:
some_statements
else:
some_statements
```
---
# Small example to tie it all together
Write a program that asks the user to enter a number
- If the number is divisible by 3 and 5, print `"divisible by 3 and 5"`
- If the number is divisible by 3, print `"divisible by 3"`
- If the number is divisible by 5, print `"divisible by 5"`
- Else print the number
--
## Solution
```python
number = int(input("Enter a number: "))
if number % 3 == 0 and number % 5 == 0:
print("divisible by 3 and 5")
elif number % 3 == 0:
print("divisible by 3")
elif number % 5 == 0:
print("divisible by 5")
else:
print(number)
```
---
# Some questions to try
- Write a program to check if the user entered a vowel or a consonant
- Write a program to print out the signum value of a function. If the number is negative, print -1, if it is zero, print 0, if it is positive, print 1.
- (Math heavy) Take the x, y coordinates for two points and calculate whether the line through them touches the y-axis and where?
---
# Thank you
Slides: [webionite.com/agatsu/](https://webionite.com/agatsu/)
<div class="text-qr">
<p>
Slides: <a href="https://webionite.com/agatsu2/">webionite.com/agatsu2/</a>
</p>
<img src="./qr.png">
</div>
## Reach out to me at
<div class="text-qr">
<p>
<a href="https://webionite.com/">webionite.com</a>
</p>
<img src="./webionite-qr.png">
</div>

BIN
webionite-qr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B