# My note Week 1 ## module operator toan tu kiem tra chia het cho 1 so VD: score = 10 z = score % 2 print (z) # z se co gia tri la 0, vi 10 chia het cho 2 ## Choose all the character before the 5th character ```python film = 'american_movie' print(film[:4]) house = "onthebeach" print(house[:4]) ``` # Get a range of characters name[0:5] #name[:5] hoac name[5:] print (house[2:7]) print (house[6:]) # Step 2 buoc name[0:5:2] numbers = '12345678987654321' print(numbers[0::2]) # Get all name[:] print (film[:]) # if else condition x = int(input("number 1: ")) y = int(input("number 2: ")) if x > y: print (x) else : print (y) # user input, and cast a string to an integer number # cách nhận input của người dùng, và ép kiểu từ chuổi sang số nguyên x = int(input("number 1: ")) y = int(input("number 2: ")) # Để in 1 văn bản xuống nhiều dòng thì sử dụng dấu ''' 3 lần print (''' students at coderschool are super cool ''') # hàm làm tròn lên # cách import 1 thư viện trong python; ở đây chúng ta import thư viện math, đây là thư viện hỗ trợ các phép tính toán số học e.g: import math n = int(input('km per day: ')) m = int(input('covering length km: ')) days = m/n print (math.ceil(days)) e.g math.ceil(2.1) # 3 math.ceil(2.9) # 3 math.ceil(1.2) # 2