Skip to content

Instantly share code, notes, and snippets.

@hvnsweeting
Created July 1, 2021 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hvnsweeting/a4b071f86178add2799a442739a84baa to your computer and use it in GitHub Desktop.
Save hvnsweeting/a4b071f86178add2799a442739a84baa to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "further-render",
"metadata": {},
"source": [
"# Welcome to Pymi.vn\n"
]
},
{
"cell_type": "markdown",
"id": "adopted-buyer",
"metadata": {},
"source": [
"Chuẩn bị gì trước khi tới lớp học Python http://pymi.vn ? 🤔\n",
"\n",
"\n",
"- Cài đặt Python 3.8 (hoặc mới hơn)\n",
"- Tải tài liệu về máy để xem offline\n",
"- Tham gia Slack\n"
]
},
{
"cell_type": "markdown",
"id": "bridal-source",
"metadata": {},
"source": [
"## Lesson 1"
]
},
{
"cell_type": "markdown",
"id": "crude-hawaiian",
"metadata": {},
"source": [
"## bật tắt"
]
},
{
"cell_type": "markdown",
"id": "continuous-forth",
"metadata": {},
"source": [
"## Prompt"
]
},
{
"cell_type": "markdown",
"id": "excited-christian",
"metadata": {},
"source": [
"```\n",
">>> \n",
"```"
]
},
{
"cell_type": "markdown",
"id": "convinced-constraint",
"metadata": {},
"source": [
"```py\n",
" python3 [0]\n",
"Python 3.8.5 (default, May 27 2021, 13:30:53) \n",
"[GCC 9.3.0] on linux\n",
"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n",
">>> 1 + 5\n",
"6\n",
">>> 100 - 1\n",
"99\n",
">>> exit()\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "increased-damage",
"metadata": {},
"source": [
"https://docs.python.org/3/tutorial/introduction.html"
]
},
{
"cell_type": "markdown",
"id": "matched-latino",
"metadata": {},
"source": [
"## Number"
]
},
{
"cell_type": "markdown",
"id": "suspended-morgan",
"metadata": {},
"source": [
"## add (`+`)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "occasional-chemical",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 + 1"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "assured-toyota",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 + 2"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "wired-subscription",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 + (2 + 1)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "eleven-retreat",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2876348723164871397817159961629609760"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"71329847312897431298 + 2876348723164871326487312648732178462"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "opened-competition",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"123421341234123123412341221341324123412341234123416482468255835483546653646473473736527564736475537373745464773"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"123421341234123123412341221341324123412341234123413241234123412341412341234132132412213441324132413241324123431 + 3241234132423142134312412341341324314123412343124132421341342"
]
},
{
"cell_type": "markdown",
"id": "previous-transmission",
"metadata": {},
"source": [
"## CỘNG: THOẢI MÁI "
]
},
{
"cell_type": "markdown",
"id": "formal-somerset",
"metadata": {},
"source": [
"### trừ (subtract - )"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "eight-numbers",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-17293473918247329847829347892317489321"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0- 17293473918247329847829347892317489321"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "diagnostic-quebec",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0 - -1"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "final-candle",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"--1"
]
},
{
"cell_type": "markdown",
"id": "centered-clinic",
"metadata": {},
"source": [
"## TRỪ THOẢI MÁI"
]
},
{
"cell_type": "markdown",
"id": "convinced-agreement",
"metadata": {},
"source": [
"## PHÉP NHÂN: MULTIPLY (`*`)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "manufactured-madagascar",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"42"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 * 21"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "celtic-airport",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"69"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"23 * 3"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "quantitative-lender",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 * (2 + 1)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "polished-pressure",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"57248126726668222293310792476180589905999333329119273345864199301724049636068975171984808906697747073800785396296048870890902892287890611463692636115930404636637059015157954907700054900305426548875"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"7534398257342875893275948759823475842375489237598275982743958472359872983475983475928435798243752498375 * 7598234758943798524375982473598743895729835798342758943758943759837454893758974358972489572893"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "matched-truth",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "executive-least",
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/plain": [
"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 * 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999"
]
},
{
"cell_type": "markdown",
"id": "settled-pennsylvania",
"metadata": {},
"source": [
"### NHÂN: THOẢI MÁI"
]
},
{
"cell_type": "markdown",
"id": "neither-friday",
"metadata": {},
"source": [
"## chia: division (`/`)"
]
},
{
"cell_type": "markdown",
"id": "outside-hanging",
"metadata": {},
"source": [
"## `/` - slash \n",
"- xoẹt\n",
"- xẹc\n",
"- xuyệt\n",
"- xoạc\n",
"\n",
"## `\\` - backslash"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "another-submission",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.0"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4 / 2"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "contained-mission",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4 - 2"
]
},
{
"cell_type": "markdown",
"id": "measured-wagner",
"metadata": {},
"source": [
"## data type/ type"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "endangered-customs",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"int"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(2)"
]
},
{
"cell_type": "markdown",
"id": "junior-commissioner",
"metadata": {},
"source": [
"## integer - số nguyên \n",
"- uk /ˈɪn.tɪ.dʒər/\n",
"- us /ˈɪn.tə.dʒɚ/"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "honey-emergency",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"float"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(2.0)"
]
},
{
"cell_type": "markdown",
"id": "proper-brooks",
"metadata": {},
"source": [
"## float \n",
"- uk /fləʊt/\n",
"- us /floʊt/"
]
},
{
"cell_type": "markdown",
"id": "pregnant-documentation",
"metadata": {},
"source": [
"## float - số thực "
]
},
{
"cell_type": "markdown",
"id": "split-absence",
"metadata": {},
"source": [
"## tập số gồm 2 tập ghép lại:\n",
"- số hữu tỷ: có tỉ lệ / tỷ số -> phân số\n",
"- số vô tỷ: không viết được ở dạng phân số: căn 2, pi "
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "crude-minutes",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.4"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2/5"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "finite-calculator",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3333333333333333"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1/3"
]
},
{
"cell_type": "markdown",
"id": "impressive-national",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 21,
"id": "furnished-premium",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.14"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3.14"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "effective-france",
"metadata": {},
"outputs": [],
"source": [
"import math"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "crucial-advisory",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.141592653589793"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"math.pi"
]
},
{
"cell_type": "markdown",
"id": "black-settlement",
"metadata": {},
"source": [
"## thấy float: thấy giá trị GẦN ĐÚNG"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "organic-bearing",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0.1"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "satisfactory-initial",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1.0"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "juvenile-permit",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 + 1 == 2"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "forced-destiny",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1 + 1 == 3"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "wrong-arcade",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0.1 + 0.1 == 0.2"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "sporting-billy",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0.1 + 0.1 + 0.1 == 0.3"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "acute-circumstances",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.30000000000000004"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"0.1 + 0.1 + 0.1"
]
},
{
"cell_type": "markdown",
"id": "behavioral-gregory",
"metadata": {},
"source": [
"https://en.wikipedia.org/wiki/IEEE_754"
]
},
{
"cell_type": "markdown",
"id": "photographic-reverse",
"metadata": {},
"source": [
"https://pymi.vn/blog/why-not-float/"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "recreational-rwanda",
"metadata": {},
"outputs": [],
"source": [
"x = 0.1"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "seeing-insight",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(3602879701896397, 36028797018963968)"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x.as_integer_ratio()"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "corporate-webcam",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"3602879701896397/36028797018963968"
]
},
{
"cell_type": "markdown",
"id": "lightweight-chance",
"metadata": {},
"source": [
"## không so sánh == với kiểu float"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "wrong-argentina",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.0"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4 / 2"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "chicken-project",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.5"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 / 2"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "systematic-matrix",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4.6921214510638284e-11"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1/21312321312"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "floral-exhibition",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.0"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4/2 + 1"
]
},
{
"cell_type": "markdown",
"id": "nominated-simple",
"metadata": {},
"source": [
"4 chia 2 trả về 2.O"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "funky-helmet",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 44,
"id": "sudden-trace",
"metadata": {},
"outputs": [
{
"ename": "ZeroDivisionError",
"evalue": "division by zero",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-44-9e1622b385b6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m1\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mZeroDivisionError\u001b[0m: division by zero"
]
}
],
"source": [
"1/0"
]
},
{
"cell_type": "markdown",
"id": "twelve-colorado",
"metadata": {},
"source": [
"1 chia 0 XẢY RA exception ZeroDivisionError"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "indirect-compiler",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 48,
"id": "continent-wrist",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.703346416033108e-28"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1/1298137128973821978392173891"
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "confident-latest",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1000.0"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1e3"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "answering-cholesterol",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1000"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"int(1e3)"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "golden-windsor",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1000000000000000072531436381529235126158374409646521955518210155479040"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"int(1e69)"
]
},
{
"cell_type": "markdown",
"id": "complete-premises",
"metadata": {},
"source": [
"### floor division"
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "specific-grill",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"5 // 2"
]
},
{
"cell_type": "markdown",
"id": "muslim-alpha",
"metadata": {},
"source": [
"## mũ - power : `**`"
]
},
{
"cell_type": "code",
"execution_count": 56,
"id": "different-bryan",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 ** 2"
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "applicable-bullet",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"81"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"9 ** 2"
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "optimum-description",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"256"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 ** 8 "
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "southeast-expense",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.4142135623730951"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 ** (1/2)"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "recorded-depth",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"18446744073709551616"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"2 ** 64"
]
},
{
"cell_type": "markdown",
"id": "asian-grammar",
"metadata": {},
"source": [
"bấm ctrl C để dừng tính"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "accepting-rainbow",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment