Guest User

Untitled

a guest
Jan 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.61 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "raw",
  5. "metadata": {},
  6. "source": []
  7. },
  8. {
  9. "cell_type": "raw",
  10. "metadata": {},
  11. "source": []
  12. },
  13. {
  14. "cell_type": "code",
  15. "execution_count": 1,
  16. "metadata": {},
  17. "outputs": [
  18. {
  19. "name": "stdout",
  20. "output_type": "stream",
  21. "text": [
  22. "3.6.6 | packaged by conda-forge | (default, Oct 12 2018, 14:43:46) \n",
  23. "[GCC 7.3.0]\n"
  24. ]
  25. }
  26. ],
  27. "source": [
  28. "import sys\n",
  29. "print(sys.version)"
  30. ]
  31. },
  32. {
  33. "cell_type": "code",
  34. "execution_count": 2,
  35. "metadata": {},
  36. "outputs": [],
  37. "source": [
  38. "#print(Hi)"
  39. ]
  40. },
  41. {
  42. "cell_type": "code",
  43. "execution_count": 3,
  44. "metadata": {},
  45. "outputs": [
  46. {
  47. "name": "stdout",
  48. "output_type": "stream",
  49. "text": [
  50. "Hello,Python!\n"
  51. ]
  52. }
  53. ],
  54. "source": [
  55. "print(\"Hello,Python!\")"
  56. ]
  57. },
  58. {
  59. "cell_type": "code",
  60. "execution_count": 4,
  61. "metadata": {},
  62. "outputs": [
  63. {
  64. "name": "stdout",
  65. "output_type": "stream",
  66. "text": [
  67. "Hello,Python!\n"
  68. ]
  69. }
  70. ],
  71. "source": [
  72. "print('Hello,Python!')"
  73. ]
  74. },
  75. {
  76. "cell_type": "code",
  77. "execution_count": 5,
  78. "metadata": {},
  79. "outputs": [
  80. {
  81. "ename": "NameError",
  82. "evalue": "name 'frint' is not defined",
  83. "output_type": "error",
  84. "traceback": [
  85. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  86. "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
  87. "\u001b[0;32m<ipython-input-5-92b84426a1cf>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfrint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Hello, Python!\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  88. "\u001b[0;31mNameError\u001b[0m: name 'frint' is not defined"
  89. ]
  90. }
  91. ],
  92. "source": [
  93. "frint(\"Hello, Python!\")"
  94. ]
  95. },
  96. {
  97. "cell_type": "code",
  98. "execution_count": 6,
  99. "metadata": {},
  100. "outputs": [
  101. {
  102. "ename": "SyntaxError",
  103. "evalue": "EOL while scanning string literal (<ipython-input-6-c10a1b330477>, line 1)",
  104. "output_type": "error",
  105. "traceback": [
  106. "\u001b[0;36m File \u001b[0;32m\"<ipython-input-6-c10a1b330477>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m print(\"Hello, Python!)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m EOL while scanning string literal\n"
  107. ]
  108. }
  109. ],
  110. "source": [
  111. "print(\"Hello, Python!)"
  112. ]
  113. },
  114. {
  115. "cell_type": "code",
  116. "execution_count": 7,
  117. "metadata": {},
  118. "outputs": [
  119. {
  120. "name": "stdout",
  121. "output_type": "stream",
  122. "text": [
  123. "This will be printed\n"
  124. ]
  125. },
  126. {
  127. "ename": "NameError",
  128. "evalue": "name 'frint' is not defined",
  129. "output_type": "error",
  130. "traceback": [
  131. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  132. "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
  133. "\u001b[0;32m<ipython-input-7-aa3f0d14d353>\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;34m\"This will be printed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mfrint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"This will cause an error\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"This will NOT be printed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
  134. "\u001b[0;31mNameError\u001b[0m: name 'frint' is not defined"
  135. ]
  136. }
  137. ],
  138. "source": [
  139. "print(\"This will be printed\")\n",
  140. "frint(\"This will cause an error\")\n",
  141. "print(\"This will NOT be printed\")"
  142. ]
  143. },
  144. {
  145. "cell_type": "code",
  146. "execution_count": 8,
  147. "metadata": {},
  148. "outputs": [
  149. {
  150. "ename": "SyntaxError",
  151. "evalue": "invalid syntax (<ipython-input-8-8954e8d01321>, line 1)",
  152. "output_type": "error",
  153. "traceback": [
  154. "\u001b[0;36m File \u001b[0;32m\"<ipython-input-8-8954e8d01321>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m <p>Generations of programmers have started their coding careers by simply printing \"Hello, world!\". You will be following in their footsteps.</p>\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
  155. ]
  156. }
  157. ],
  158. "source": [
  159. "<p>Generations of programmers have started their coding careers by simply printing \"Hello, world!\". You will be following in their footsteps.</p>\n",
  160. "<p>In the code cell below, use the <code>print()</code> function to print out the phrase: <code>Hello, world!</code></p>"
  161. ]
  162. },
  163. {
  164. "cell_type": "code",
  165. "execution_count": 9,
  166. "metadata": {},
  167. "outputs": [
  168. {
  169. "data": {
  170. "text/plain": [
  171. "int"
  172. ]
  173. },
  174. "execution_count": 9,
  175. "metadata": {},
  176. "output_type": "execute_result"
  177. }
  178. ],
  179. "source": [
  180. "type(12)"
  181. ]
  182. },
  183. {
  184. "cell_type": "code",
  185. "execution_count": 10,
  186. "metadata": {},
  187. "outputs": [
  188. {
  189. "data": {
  190. "text/plain": [
  191. "float"
  192. ]
  193. },
  194. "execution_count": 10,
  195. "metadata": {},
  196. "output_type": "execute_result"
  197. }
  198. ],
  199. "source": [
  200. "type(20.0)"
  201. ]
  202. },
  203. {
  204. "cell_type": "code",
  205. "execution_count": 11,
  206. "metadata": {},
  207. "outputs": [
  208. {
  209. "data": {
  210. "text/plain": [
  211. "bool"
  212. ]
  213. },
  214. "execution_count": 11,
  215. "metadata": {},
  216. "output_type": "execute_result"
  217. }
  218. ],
  219. "source": [
  220. "type(True)"
  221. ]
  222. },
  223. {
  224. "cell_type": "code",
  225. "execution_count": 12,
  226. "metadata": {},
  227. "outputs": [
  228. {
  229. "data": {
  230. "text/plain": [
  231. "sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)"
  232. ]
  233. },
  234. "execution_count": 12,
  235. "metadata": {},
  236. "output_type": "execute_result"
  237. }
  238. ],
  239. "source": [
  240. "sys.float_info"
  241. ]
  242. },
  243. {
  244. "cell_type": "code",
  245. "execution_count": 13,
  246. "metadata": {},
  247. "outputs": [
  248. {
  249. "data": {
  250. "text/plain": [
  251. "sys.int_info(bits_per_digit=30, sizeof_digit=4)"
  252. ]
  253. },
  254. "execution_count": 13,
  255. "metadata": {},
  256. "output_type": "execute_result"
  257. }
  258. ],
  259. "source": [
  260. "sys.int_info"
  261. ]
  262. },
  263. {
  264. "cell_type": "code",
  265. "execution_count": 14,
  266. "metadata": {},
  267. "outputs": [
  268. {
  269. "ename": "AttributeError",
  270. "evalue": "module 'sys' has no attribute 'bool_info'",
  271. "output_type": "error",
  272. "traceback": [
  273. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  274. "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
  275. "\u001b[0;32m<ipython-input-14-9875766140e1>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbool_info\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  276. "\u001b[0;31mAttributeError\u001b[0m: module 'sys' has no attribute 'bool_info'"
  277. ]
  278. }
  279. ],
  280. "source": [
  281. "sys.bool_info"
  282. ]
  283. },
  284. {
  285. "cell_type": "code",
  286. "execution_count": 15,
  287. "metadata": {},
  288. "outputs": [
  289. {
  290. "ename": "AttributeError",
  291. "evalue": "module 'sys' has no attribute 'boolean_info'",
  292. "output_type": "error",
  293. "traceback": [
  294. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  295. "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
  296. "\u001b[0;32m<ipython-input-15-60ff8a929852>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mboolean_info\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  297. "\u001b[0;31mAttributeError\u001b[0m: module 'sys' has no attribute 'boolean_info'"
  298. ]
  299. }
  300. ],
  301. "source": [
  302. "sys.boolean_info"
  303. ]
  304. },
  305. {
  306. "cell_type": "code",
  307. "execution_count": 16,
  308. "metadata": {},
  309. "outputs": [
  310. {
  311. "data": {
  312. "text/plain": [
  313. "2.0"
  314. ]
  315. },
  316. "execution_count": 16,
  317. "metadata": {},
  318. "output_type": "execute_result"
  319. }
  320. ],
  321. "source": [
  322. "float(2)"
  323. ]
  324. },
  325. {
  326. "cell_type": "code",
  327. "execution_count": 17,
  328. "metadata": {},
  329. "outputs": [
  330. {
  331. "data": {
  332. "text/plain": [
  333. "float"
  334. ]
  335. },
  336. "execution_count": 17,
  337. "metadata": {},
  338. "output_type": "execute_result"
  339. }
  340. ],
  341. "source": [
  342. "type(float(2))"
  343. ]
  344. },
  345. {
  346. "cell_type": "code",
  347. "execution_count": 18,
  348. "metadata": {},
  349. "outputs": [
  350. {
  351. "data": {
  352. "text/plain": [
  353. "1"
  354. ]
  355. },
  356. "execution_count": 18,
  357. "metadata": {},
  358. "output_type": "execute_result"
  359. }
  360. ],
  361. "source": [
  362. "int('1')"
  363. ]
  364. },
  365. {
  366. "cell_type": "code",
  367. "execution_count": 19,
  368. "metadata": {},
  369. "outputs": [
  370. {
  371. "data": {
  372. "text/plain": [
  373. "'1.2'"
  374. ]
  375. },
  376. "execution_count": 19,
  377. "metadata": {},
  378. "output_type": "execute_result"
  379. }
  380. ],
  381. "source": [
  382. "str(1.2)"
  383. ]
  384. },
  385. {
  386. "cell_type": "code",
  387. "execution_count": 20,
  388. "metadata": {},
  389. "outputs": [
  390. {
  391. "data": {
  392. "text/plain": [
  393. "bool"
  394. ]
  395. },
  396. "execution_count": 20,
  397. "metadata": {},
  398. "output_type": "execute_result"
  399. }
  400. ],
  401. "source": [
  402. "type(True)"
  403. ]
  404. },
  405. {
  406. "cell_type": "code",
  407. "execution_count": 21,
  408. "metadata": {},
  409. "outputs": [
  410. {
  411. "ename": "NameError",
  412. "evalue": "name 'true' is not defined",
  413. "output_type": "error",
  414. "traceback": [
  415. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  416. "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
  417. "\u001b[0;32m<ipython-input-21-6f4d8242c3d0>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  418. "\u001b[0;31mNameError\u001b[0m: name 'true' is not defined"
  419. ]
  420. }
  421. ],
  422. "source": [
  423. "type(true)"
  424. ]
  425. },
  426. {
  427. "cell_type": "code",
  428. "execution_count": 22,
  429. "metadata": {},
  430. "outputs": [
  431. {
  432. "data": {
  433. "text/plain": [
  434. "1"
  435. ]
  436. },
  437. "execution_count": 22,
  438. "metadata": {},
  439. "output_type": "execute_result"
  440. }
  441. ],
  442. "source": [
  443. "int(True)"
  444. ]
  445. },
  446. {
  447. "cell_type": "code",
  448. "execution_count": 23,
  449. "metadata": {},
  450. "outputs": [
  451. {
  452. "data": {
  453. "text/plain": [
  454. "1.0"
  455. ]
  456. },
  457. "execution_count": 23,
  458. "metadata": {},
  459. "output_type": "execute_result"
  460. }
  461. ],
  462. "source": [
  463. "float(True)"
  464. ]
  465. },
  466. {
  467. "cell_type": "code",
  468. "execution_count": 24,
  469. "metadata": {},
  470. "outputs": [
  471. {
  472. "data": {
  473. "text/plain": [
  474. "float"
  475. ]
  476. },
  477. "execution_count": 24,
  478. "metadata": {},
  479. "output_type": "execute_result"
  480. }
  481. ],
  482. "source": [
  483. "type(6/2)"
  484. ]
  485. },
  486. {
  487. "cell_type": "code",
  488. "execution_count": 25,
  489. "metadata": {},
  490. "outputs": [],
  491. "source": [
  492. "a=160/60"
  493. ]
  494. },
  495. {
  496. "cell_type": "code",
  497. "execution_count": 26,
  498. "metadata": {},
  499. "outputs": [
  500. {
  501. "name": "stdout",
  502. "output_type": "stream",
  503. "text": [
  504. "2.6666666666666665\n"
  505. ]
  506. }
  507. ],
  508. "source": [
  509. "print(a)"
  510. ]
  511. },
  512. {
  513. "cell_type": "code",
  514. "execution_count": 27,
  515. "metadata": {},
  516. "outputs": [
  517. {
  518. "data": {
  519. "text/plain": [
  520. "2.6666666666666665"
  521. ]
  522. },
  523. "execution_count": 27,
  524. "metadata": {},
  525. "output_type": "execute_result"
  526. }
  527. ],
  528. "source": [
  529. "160/60"
  530. ]
  531. },
  532. {
  533. "cell_type": "code",
  534. "execution_count": 28,
  535. "metadata": {},
  536. "outputs": [
  537. {
  538. "data": {
  539. "text/plain": [
  540. "4.333333333333333"
  541. ]
  542. },
  543. "execution_count": 28,
  544. "metadata": {},
  545. "output_type": "execute_result"
  546. }
  547. ],
  548. "source": [
  549. "x=26/6\n",
  550. "x"
  551. ]
  552. },
  553. {
  554. "cell_type": "code",
  555. "execution_count": 29,
  556. "metadata": {},
  557. "outputs": [
  558. {
  559. "data": {
  560. "text/plain": [
  561. "40"
  562. ]
  563. },
  564. "execution_count": 29,
  565. "metadata": {},
  566. "output_type": "execute_result"
  567. }
  568. ],
  569. "source": [
  570. "y=36+2*2\n",
  571. "y"
  572. ]
  573. },
  574. {
  575. "cell_type": "code",
  576. "execution_count": 30,
  577. "metadata": {},
  578. "outputs": [
  579. {
  580. "data": {
  581. "text/plain": [
  582. "44.333333333333336"
  583. ]
  584. },
  585. "execution_count": 30,
  586. "metadata": {},
  587. "output_type": "execute_result"
  588. }
  589. ],
  590. "source": [
  591. "z=x+y\n",
  592. "z"
  593. ]
  594. },
  595. {
  596. "cell_type": "code",
  597. "execution_count": null,
  598. "metadata": {},
  599. "outputs": [],
  600. "source": []
  601. }
  602. ],
  603. "metadata": {
  604. "kernelspec": {
  605. "display_name": "Python 3",
  606. "language": "python",
  607. "name": "python3"
  608. },
  609. "language_info": {
  610. "codemirror_mode": {
  611. "name": "ipython",
  612. "version": 3
  613. },
  614. "file_extension": ".py",
  615. "mimetype": "text/x-python",
  616. "name": "python",
  617. "nbconvert_exporter": "python",
  618. "pygments_lexer": "ipython3",
  619. "version": "3.6.6"
  620. }
  621. },
  622. "nbformat": 4,
  623. "nbformat_minor": 2
  624. }
Add Comment
Please, Sign In to add comment