---
# System prepended metadata

title: Collaboratory Notes for Programming

---

# Collaboratory Notes for Programming

## 2/15 

- floating point number, string, literal, variable,
- associative array / dictionary / hash, 

**Keywords**:
- concatenation
- operands 
- operator (+,*,etc)
- overloaded operator 
- assignment ('='), (storing the result to the left side of the operands)
- type casting (str, int, etc..)
- empty string (example: a = '')
- comments (#)(''')
- newline character (\n)

**Resources**:
- python3 replit: https://replit.com/languages/python3
- hexadecimal numbers: https://www.techtarget.com/whatis/definition/hexadecimal
- w3schools python: https://www.w3schools.com/python/
- Python cheat sheet:https://www.pythoncheatsheet.org/cheatsheet/basics

## 2/22

**Keywords**:
- literals 
- bitwise operators (&, |)
    1. & operator means AND
    2. | operator means OR
- shell (bash, tcsh, ksh, zsh) (ctrl+d to exit)

<b><i><u>Putty Login</b></u></i>
hostname: v.im.cyut.edu.tw
port: 22 => 2203

<i><b><u>HOMEWORK</b></u></i>:
Upload a picture to home directory under public_html

## 3/01

**Keywords**
- comparison operator (>, <)
- logical operator (e.g. "and" "or")
- logical expression (something that evaluates to True or False)
- indentation
- nested statement 
- half-closed, half-open interval example: [5,7)
- iteration
- function definition
- function invocation
- formal parameter/argument
- actual parameter/argument
- positional parameter/argument
- optional parameter/argument (e.g. end='' in print statement)
- default value (for optional parameter/argument)
- format integer
- nested list: A list with lists within it.
-  

**Code**
```python
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('N', help='up to which integer', type=int)
parser.add_argument('K', help='raised to which power', type=int)
args = parser.parse_args()

def sum_of_powers(n, k):
  s = 0
  for i in range(1, n+1):
    x = 1
    
    for j in range(k)
      x *= i
        
    s += x
    
  return s

# x = int(input('N: '))
# y = int(input('K: '))

x = args.N
y = args.K

print('N: ' + str(x))
print('K: ' + str(y))


print('sum of powers of K up to N: ')
print(sum_of_powers(x, y))
```
aboba

## 3/08

**Keywords**

## 3/22

**Keywords**

- nested list
- iterate over (some list)
- list comprehension
- array slice

## 4/12

**Keywords**

- ansi escape sequences

## 4/19

**Keywords**

- dictionary
- hash (in some other languages)
- associative array (in some other languages)
- output redirection

**Homework**

- change the number which is a string into a floating number before putting it into a dictionary

# 4/26

- variable['key'] = value # adding key value to a variable
- del variable['key'] # for deleting key value
- {mm:fcu[mm][::-1] for mm in fcu }


# 5/10


## UMap Links:

- [bike api](https://tdx.transportdata.tw/api-service/swagger/basic/2cc9b888-a592-496f-99de-9ab35b7fb70d#/Bike/BikeApi_Station_2180)
- [206 Jav](https://umap.openstreetmap.fr/en/map/untitled-map_912224)
- [222 Myk](https://umap.openstreetmap.fr/en/map/untitled-map_912223#19/24.06827/120.69976)
- [221 Bil](https://umap.openstreetmap.fr/en/map/untitled-map_912221#16/24.0670/120.6975) Chaoyang second Dormitory
- [207 said](https://umap.openstreetmap.fr/en/map/untitled-map_912217)
- [228 mawar](https://umap.openstreetmap.fr/en/map/new/#19/24.06846/-599.28399)
- [226 Annisa](https://umap.openstreetmap.fr/en/map/untitled-map_912228) 
- [227 bagas](https://umap.openstreetmap.fr/en/map/untitled-map_912235)
- [018 Leon](https://umap.openstreetmap.fr/en/map/untitled-map_912231)
- [214 kart](https://umap.openstreetmap.fr/id/map/untitled-map_912225) 
- [087 Iris](https://umap.openstreetmap.fr/zh/map/iris-map_912233#13/24.1541/120.6967)
- [ibra](https://umap.openstreetmap.fr/en/map/untitled-map_912215)

- [219 Bema](https://umap.openstreetmap.fr/en/map/untitled-map_912241)

# 5/10

# Regular Expressions

- \d = [0-9] = [0123456789]

- {3} = repeat for 3 times - u put number like [4] in the front i.e: [5]{3} which will repeat 5 three times.

- . is everything

- \. is i'm only looking for dot

- \d{1,3} is atleast repeated once or twice or atleast three times.

- (\d{1,3}\.){3}\d{1,3} is for finding numbers that look like an IP adress.

- *? don't go further

- $1 pattern must occur at the end of a line 

- ^ except

- \s = [*space*\t\n]


# Who is who

- Chao-Kuei Hung: Greg
