Skip to content

Instantly share code, notes, and snippets.

@ischurov
Created January 12, 2022 17:27
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 ischurov/19d944f0bbad98fb98a1db8841339705 to your computer and use it in GitHub Desktop.
Save ischurov/19d944f0bbad98fb98a1db8841339705 to your computer and use it in GitHub Desktop.
Lesson01.ipynb
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "## Наука о данных\n### Совместный бакалавриат ВШЭ-РЭШ, 2021-2022 учебный год\n_Илья Щуров_\n\n[Страница курса](http://math-info.hse.ru/s21/j)"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "### Занятие 1. Первое знакомство. Числа и строки"
},
{
"metadata": {
"trusted": false
},
"id": "square-hello",
"cell_type": "code",
"source": "3 + 5",
"execution_count": 1,
"outputs": [
{
"data": {
"text/plain": "8"
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "communist-emergency",
"cell_type": "code",
"source": "4 * 2",
"execution_count": 2,
"outputs": [
{
"data": {
"text/plain": "8"
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "plain-classic",
"cell_type": "code",
"source": "4 * (2 + 12 + 4)",
"execution_count": 3,
"outputs": [
{
"data": {
"text/plain": "72"
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "incorporated-vacuum",
"cell_type": "code",
"source": "4 / 2",
"execution_count": 4,
"outputs": [
{
"data": {
"text/plain": "2.0"
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "corresponding-sewing",
"cell_type": "code",
"source": "4 / 3",
"execution_count": 5,
"outputs": [
{
"data": {
"text/plain": "1.3333333333333333"
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "micro-cleaning",
"cell_type": "code",
"source": "7 ^ 3",
"execution_count": 6,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "relevant-machinery",
"cell_type": "code",
"source": "6 ^ 2",
"execution_count": 7,
"outputs": [
{
"data": {
"text/plain": "4"
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "adjustable-glenn",
"cell_type": "code",
"source": "7 ** 3",
"execution_count": 8,
"outputs": [
{
"data": {
"text/plain": "343"
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "forbidden-custody",
"cell_type": "code",
"source": "123 ** 30",
"execution_count": 9,
"outputs": [
{
"data": {
"text/plain": "497912859868342793044999075260564303046944727069807798026337449"
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "educated-agreement",
"cell_type": "code",
"source": "123 ** 500",
"execution_count": 10,
"outputs": [
{
"data": {
"text/plain": "8965112003743387866419647784927315243537577398481954222426083437213082039806506048030424592209618147281481074341167358469242828813696226117658531310221797965755925411086710642056316009519024606245548329630777317813054492673354533024816880914142784439169959774982569447995879688436892336648954517815625045635787288678544580242198333451309487282098969575553847754168588229702213908210009653068276533186816286578983934057589912114557823739803553122136891251149430869095850470411287824454929476779456715853189348987119897572775624893196980006690858421664960133893335823124753774907911894859324600049330600073382274253923933783261216102872109864629420380997890966850208568192936114422584937001223854367261989475155137259564459650933295211179377885357289425266265000342435452119689479564310560075474344488487387994286699510907179352086530781243641562154924124017365679503941737178177640751221050271934837510722283542290713096722037822559347346057685252869419712483250626684216370967211443921307689783021524279333909667952729825779105545744391041230001"
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "accessible-beverage",
"cell_type": "code",
"source": "123 ** 5000",
"execution_count": 11,
"outputs": [
{
"data": {
"text/plain": "3353954734396475707723698147460733377738053304136719766739798480111007859208427238255112715362730169443073739141753289658067011871159304415122850743991780589452217979843276276138660608818897602435588404532042870294051329637031601582635076174287885716063257062164342328056137920579594283176582744168415734760243598035658853987112460880217756354230103011034832959258085889222848278471678386703191331954895371241553814151230886275534176424459435030951421974011584987075552755007034429946494522614681275491089030701865169186396702667690340975728930068315592730251845106832810970083269259284180375735520659424665544906136961992250769091740765162241261914402309395944649999570584075254202851005080422430568879516208045357209263195917503368492569788100711114073048586177358632147281782319581521862576532731579777609324822466065118316557587289038292506485479638981829983526021648546775725091817293951580461455384737682079159487079693986908463412125812647350220236295555808817578019314352748365799643808209643563875951734720204121603155788284999158828558906711013783216441108896795603499808540030465980276318406222883014589982378063377710634576614247735480059186377460897925477281745400313110264997352865540289516120950788236610614295010532278933350433610352526168773178711090603912702151883060973208666355443717462905728020481827162478864984139229473145466199017262301418656128488087534231857612844354404937319800987786439671425910765479784434332319502970036046427033788938200575837491605089299789899513079854918957579695066913516471580384590045059800385106750708178205465790247817089460635536430846512498074538155070852176528278406475739065283437188462908418886689806030763943639229716924648754089464484040357899600659206184987579189926762740447890869973750974403636905447584048702308270233674279080235226119859735331308742148816359099817492195372243758898432386776740877310649718180814820334951522324564052735186117530511707361200576155038348792487115600697939641113822513388424166174950300891245957692781023739549436740989044789630817612723143392862564458639351497845564300532828681868481251923971669332596963338091404625042570545319257784355971387373096776438465189156523510368705029456539332215098972486791577164678606708486888991204635826018369548275464923930256597620301690047554992884478827841132306645652758885877862674667799255339474375331382481079765869536351258418641061137257778808275493748285062606711350048001532483054143884612280522748711733328723725593647904964073956974639532743498718504633858704859123259333708465066994510933150600044969103368149032754114748105074267272627318613225721579868259526261606305721866115263893894909378140928856601355239770940326748620713678489002541774811736605626098890564598802220406627497270986524788996202882839916982820371025793346619459577159361359149659779035702141235957167754331353193593868425001806712180763239956840925345742544896160788260437380906465243886882329698999967653759678269717182898494209128988157077130351014279081894716037047217335686652462359720591482555081999242085455349428905856528283843603685962100001620376146714202029166846904999586550146980951837779771606914850057443165054403171063822977061192842794189709441718628854021112282124843306079757393352407212547618657359386856848039826227670181047883428565479448036624960690959525785475363236283572996180652058443608006996373153456897800041346094450839131022452817270404341261596450114991618609937940212083030397583327517652117283577516191342660426597827114478370376017101642578866320016674549397523804074479630599954864305882257697097650706676412870775356505655998158219870366021942852336663446809466084068411853417050688376205732108647423813469626001542162859506447154561111216993610658514046059824255322862601842397111227344090205485092592833616855307606234645543917519159137137633761173678046865494071081560060822700905923191133976407726987033509209220996163437851724799472760547135552314406234251104810725272563002707919513462494441662695620800010881575322755870793096644679748959122713068775301049155135738875799270558214611258875579046670480149067809470537568813692259302462708636536898833395277222923156747987205725931599060777500252414414592107275796894605518172441357512055949832801359865290976153371919527582886784244948430047959073081817388565885212788817720140441324530252779450099718589157542985897607482621591913038043671488724359286237285459835010535918273799390974879385525667160383743367363568470381517215758159872659751475935669958732879737120744988011393995161843642368264818499393835657695602962136609501939888152274431575653260599215966864496401415814003524808162633167892034364675357970881556668592132931841707108657635591748869535366407702673204823988908872685424891969745408351218127480988479167611152326042682184985423953784918166238467029443343739420331504497195989896134622751315190966749105943972519653713442479789333860776425908708190833599728749021610526853954470380387438815215304158776947286340127693781158040083858676917557760840157425376984030819104731325676131757856115004427819078224212513545880082329710111260630591832593940828914134701863565700122042509627950387294560018357459189569069470920532783890945875812996936011583235918564683395880863419304286588270455544825883439309305171883072009681844428841722637741951758041977207245353339531292407971754910065475716752520113214497551880090925032112239759802399529032189201471845890258762133810651985978022276416139281001605952755139258249074471506962583934174962756383727402618073495377224771722987474939439002960057088440763089749337128329366375154369919096211977976334277197548367528013885963021492319467420600551691167712688794021449398081705443274004163118317967868674408083827047708691687244869356546033367245315698020030504155571105614592934078586411552596019007925923620617599059685466725613381623259155245984326829986111543998614378718812404057582089163338315136498803058984977991647681773123159427728624868403079000077509817529061980224334775198486605105265900059064758102340539526723566375263865199788212428922902013338801042507505424086664778221867717082592706747273825380617706122187638928147024558014575402263344459218699090447742570177747791088652153791484254153316601477230062302307754820386082958949141504409489118704623283308465308306055186904390856414300895333971941750864383369970669461340534129900142435859010796934377389314632838906331179963313278733494948521192987720130595968687106130566638544779609841208866974647500677401816562013905403234345180062639057051104035218135077564117902456898651977562682748806042955878458139832696126473500191344147273325861182309455073026712259865415004366603907225392533552318824345538180759169090321492783206743831901002131225484987411607138075171846166313080064872525860010121299112887612624115899751848804739675655952211897848053137777861759537435967085994105504995232643603853380758010244032923461202501257921521987389444264638265580355121006129679584342280619851770970127983904823194047020092524172625686983668470327906774233795895797322061031065772223908936493011256877331404233990204655317081522810037805843225544469950977222744611892465346868755497972452746533406461254052457053737244783339047428528901491826501793879612471975078425821836030497219244833459279932238739455871513729296725228583442390853084010484852723508631600479482070365742820819464910142731304397480606338994226361323616572960099622370169794447635798473486390586281134301814872255063798787440718215080380058260836316253220574713297885983977374899211176331018490169844336249606093090176367721911433322547537641933752143989011950501588080174765331541363228990814190048953055918595560602231513750940196271079274671380686597880298560267308795726931931468476440037879657399195371509095333044875720539512023318066560411933567943377747078700497180447399405373971196355361239014532895725699167536142752710854384169322863367691121034676336263436672845734966509514479879844707055079979212431846943422124559671690781197721383896754251354133839859601250712104841519269771617753557421094111239131749518834486199508998500176698067997688039421727628122021466809031144711686961541236180337088738091236780700314960356822268456599983651946756737445524339957716265249873055616968993909556128452391685450000972659363300286160731026595227554962781559327191091733064906211339241053820137814252659619212146575425458560657315626206306833252321667309523988039476932800038497614021140835955733259516965333787864100871817971694692863895435377964943619940009344411210455907977813986521801734189991005835828065497543191193028963141513479200153513776530677736496400669234531268233335007183332721694436215071671987983370841315279026233764481096524737216905895645316895866447052774196152409185193849262174807381539686204655436832434612266876037942900897102093412991709732740387372419830741966765342547740941954333966798594735511947701870486240861599175835536040272987015992638437755420825254956240013944485469647751412820063397594584847042221108700766995454041791568268741551631405511517867140932438610927248796861322287167639828187608795944177574990988855392012928645313446624474422050091486633713662966777985560501409004887988602063566655689837650911727244987479768030595881178808188626058175021414477375454342593244859980087685827763873375508569977831103597220796437672897306037715207922596090393122506647474519139199827872742513199505416878620739357930330485112192020892505444939577841287725393777383502990275116558637846951623669827995341943202173274878923487034826040033949739493393345667206143943313307005676215850747625876328054004050620923749494134144466311791982496301541226003754338035419387093239714387304613603493415289530183197658023276354892762496925676782974961741015567565376732886652388790260561501948969980524922923882850955432351733283514261941609406991913494542945133890531277941088697479043387422194017157984431423290293059656420034549821911198283833262073982573177407668494341766913101977757587197892313246725098776246179929312367657319225907906665626599986007752288142967333760071941052393296882813971893248015923967921373741520435093034604321708851675166494774265892038841703201749281038756313626195143309130668452791926834078345844788286544724199082481429333319251498800927738458621905162833180954676593043124415736253941302131526457611599091716543550103263353221833017109572256053813741941534850924386033121000733220433420921294281815034984610220457768055063145323908201209434158676831749342306827451381679990912300001"
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "numeric-needle",
"cell_type": "code",
"source": "123.0 ** 5000",
"execution_count": 12,
"outputs": [
{
"ename": "OverflowError",
"evalue": "(34, 'Result too large')",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mOverflowError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-8648ce693b9c>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m123.0\u001b[0m \u001b[0;34m**\u001b[0m \u001b[0;36m5000\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mOverflowError\u001b[0m: (34, 'Result too large')"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "infinite-joseph",
"cell_type": "code",
"source": "x = 10\n10 * x",
"execution_count": 13,
"outputs": [
{
"data": {
"text/plain": "100"
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "subtle-collector",
"cell_type": "code",
"source": "x",
"execution_count": 14,
"outputs": [
{
"data": {
"text/plain": "10"
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "numerical-services",
"cell_type": "code",
"source": "x = x + 1",
"execution_count": 15,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "studied-traffic",
"cell_type": "code",
"source": "x",
"execution_count": 16,
"outputs": [
{
"data": {
"text/plain": "11"
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {},
"id": "strategic-third",
"cell_type": "markdown",
"source": "### Числа Фибоначчи\nЧислами Фибоначчи называется последовательность \n\n$$x_1=x_2=1, \\quad x_{k+1}=x_k+x_{k-1}.$$"
},
{
"metadata": {
"trusted": false
},
"id": "nearby-squad",
"cell_type": "code",
"source": "x_current = 1\nx_previous = 1",
"execution_count": 52,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "later-process",
"cell_type": "code",
"source": "# Задача:\n# Написать ячейку, которая будет выводить при каждом\n# своём запуске очереденое число Фибоначчи",
"execution_count": 37,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "dense-lodge",
"cell_type": "code",
"source": "x_new = x_current + x_previous\nx_previous = x_current\nx_current = x_new\nx_current",
"execution_count": 62,
"outputs": [
{
"data": {
"text/plain": "144"
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "occupational-cornwall",
"cell_type": "code",
"source": "s = \"Hello, World!\"",
"execution_count": 63,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "defined-designation",
"cell_type": "code",
"source": "s",
"execution_count": 64,
"outputs": [
{
"data": {
"text/plain": "'Hello, World!'"
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "tested-jason",
"cell_type": "code",
"source": "'\"'",
"execution_count": 65,
"outputs": [
{
"data": {
"text/plain": "'\"'"
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "handmade-flashing",
"cell_type": "code",
"source": "s",
"execution_count": 66,
"outputs": [
{
"data": {
"text/plain": "'Hello, World!'"
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "biological-kingdom",
"cell_type": "code",
"source": "print(s)",
"execution_count": 67,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Hello, World!\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "sophisticated-building",
"cell_type": "code",
"source": "print(123)",
"execution_count": 68,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "123\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "every-cliff",
"cell_type": "code",
"source": "print(2)\nprint(123)",
"execution_count": 69,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "2\n123\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "compliant-projector",
"cell_type": "code",
"source": "print(2, 14)",
"execution_count": 70,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "2 14\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "concerned-following",
"cell_type": "code",
"source": "print(\"Hello, World!\")",
"execution_count": 71,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Hello, World!\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "difficult-literacy",
"cell_type": "code",
"source": "s",
"execution_count": 72,
"outputs": [
{
"data": {
"text/plain": "'Hello, World!'"
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "common-printer",
"cell_type": "code",
"source": "s = \"123\"",
"execution_count": 73,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "ready-tiffany",
"cell_type": "code",
"source": "s",
"execution_count": 74,
"outputs": [
{
"data": {
"text/plain": "'123'"
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "valued-sydney",
"cell_type": "code",
"source": "y = int(s)",
"execution_count": 76,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "reserved-stevens",
"cell_type": "code",
"source": "y",
"execution_count": 77,
"outputs": [
{
"data": {
"text/plain": "123"
},
"execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "growing-tournament",
"cell_type": "code",
"source": "y",
"execution_count": 78,
"outputs": [
{
"data": {
"text/plain": "123"
},
"execution_count": 78,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "general-sterling",
"cell_type": "code",
"source": "type(y)",
"execution_count": 79,
"outputs": [
{
"data": {
"text/plain": "int"
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "pacific-hudson",
"cell_type": "code",
"source": "type(\"Hello\")",
"execution_count": 80,
"outputs": [
{
"data": {
"text/plain": "str"
},
"execution_count": 80,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "comparable-norwegian",
"cell_type": "code",
"source": "float(12)",
"execution_count": 81,
"outputs": [
{
"data": {
"text/plain": "12.0"
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "labeled-director",
"cell_type": "code",
"source": "int(12.34)",
"execution_count": 82,
"outputs": [
{
"data": {
"text/plain": "12"
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "adaptive-blade",
"cell_type": "code",
"source": "name = input(\"Как тебя зовут? \")\nprint(\"Привет, \" + name + \"!\")",
"execution_count": 1,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Как тебя зовут? 1\nПривет, 1!\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "induced-failure",
"cell_type": "code",
"source": "s = \"Hello\"\nw = \"World\"\ns + w",
"execution_count": 86,
"outputs": [
{
"data": {
"text/plain": "'HelloWorld'"
},
"execution_count": 86,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {},
"id": "civilian-silly",
"cell_type": "markdown",
"source": "## Задача\nНапишите программу, которая просит пользователя ввести число с клавиатуры и потом печатает число, которое будет вдвое больше введённого"
},
{
"metadata": {
"trusted": false
},
"id": "efficient-dietary",
"cell_type": "code",
"source": "s = input (\"Введите число. \")\nnumber = int(s)\nprint(number * 2)",
"execution_count": 3,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Введите число. 12\n24\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "hidden-starter",
"cell_type": "code",
"source": "number = int(input (\"Введите число. \"))\nprint(number * 2)",
"execution_count": 4,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Введите число. 123\n246\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "immune-baptist",
"cell_type": "code",
"source": "number = int(input(\"Введите число. \"))\nnumber * 2",
"execution_count": 22,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Введите число. 12\n"
},
{
"data": {
"text/plain": "24"
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "encouraging-eating",
"cell_type": "code",
"source": "sqrt(4)",
"execution_count": 23,
"outputs": [
{
"data": {
"text/plain": "2.0"
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "packed-cartoon",
"cell_type": "code",
"source": "import math",
"execution_count": 8,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "announced-arthur",
"cell_type": "code",
"source": "math.sqrt(4)",
"execution_count": 9,
"outputs": [
{
"data": {
"text/plain": "2.0"
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "ranging-timothy",
"cell_type": "code",
"source": "import math as m\nm.sqrt(4)",
"execution_count": 10,
"outputs": [
{
"data": {
"text/plain": "2.0"
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "moderate-radical",
"cell_type": "code",
"source": "m.sin(0)",
"execution_count": 11,
"outputs": [
{
"data": {
"text/plain": "0.0"
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "requested-washer",
"cell_type": "code",
"source": "m.cos(0)",
"execution_count": 12,
"outputs": [
{
"data": {
"text/plain": "1.0"
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "leading-intelligence",
"cell_type": "code",
"source": "from math import sqrt",
"execution_count": 13,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "global-notebook",
"cell_type": "code",
"source": "sqrt(4)",
"execution_count": 14,
"outputs": [
{
"data": {
"text/plain": "2.0"
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "wicked-exception",
"cell_type": "code",
"source": "from math import sqrt",
"execution_count": 15,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "occupied-building",
"cell_type": "code",
"source": "print = 10\nprint(\"Hello\")",
"execution_count": 16,
"outputs": [
{
"ename": "TypeError",
"evalue": "'int' object is not callable",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-16-b0f5f40ee1e0>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mprint\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m10\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Hello\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m: 'int' object is not callable"
]
}
]
},
{
"metadata": {
"trusted": false
},
"id": "metropolitan-beginning",
"cell_type": "code",
"source": "print",
"execution_count": 17,
"outputs": [
{
"data": {
"text/plain": "10"
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "graphic-poker",
"cell_type": "code",
"source": "print * 2",
"execution_count": 18,
"outputs": [
{
"data": {
"text/plain": "20"
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "comic-interface",
"cell_type": "code",
"source": "del print",
"execution_count": 19,
"outputs": []
},
{
"metadata": {
"trusted": false
},
"id": "incredible-crisis",
"cell_type": "code",
"source": "print(\"Hello\")",
"execution_count": 20,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Hello\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "neither-death",
"cell_type": "code",
"source": "%whos",
"execution_count": 21,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "Variable Type Data/Info\n--------------------------------------------------------\nblack_reformat function <function black_reformat at 0x7fdb0ff74f70>\nch str 12\njson module <module 'json' from '/Lib<...>hon3.9/json/__init__.py'>\nm module <module 'math' from '/Lib<...>th.cpython-39-darwin.so'>\nmath module <module 'math' from '/Lib<...>th.cpython-39-darwin.so'>\nname str 1\nnumber int 23\ns str 12\nsqrt builtin_function_or_method <built-in function sqrt>\n"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "public-shift",
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.6.10",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "",
"data": {
"description": "Lesson01.ipynb",
"public": false
}
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment