Guest User

Untitled

a guest
Dec 11th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.50 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "data": {
  10. "text/plain": [
  11. "'Michael Jackson'"
  12. ]
  13. },
  14. "execution_count": 1,
  15. "metadata": {},
  16. "output_type": "execute_result"
  17. }
  18. ],
  19. "source": [
  20. "\"Michael Jackson\""
  21. ]
  22. },
  23. {
  24. "cell_type": "code",
  25. "execution_count": 2,
  26. "metadata": {},
  27. "outputs": [
  28. {
  29. "data": {
  30. "text/plain": [
  31. "'Michael Jackson'"
  32. ]
  33. },
  34. "execution_count": 2,
  35. "metadata": {},
  36. "output_type": "execute_result"
  37. }
  38. ],
  39. "source": [
  40. "'Michael Jackson'"
  41. ]
  42. },
  43. {
  44. "cell_type": "code",
  45. "execution_count": 3,
  46. "metadata": {},
  47. "outputs": [
  48. {
  49. "data": {
  50. "text/plain": [
  51. "' 1 2 3 4 5 6 '"
  52. ]
  53. },
  54. "execution_count": 3,
  55. "metadata": {},
  56. "output_type": "execute_result"
  57. }
  58. ],
  59. "source": [
  60. "' 1 2 3 4 5 6 '"
  61. ]
  62. },
  63. {
  64. "cell_type": "code",
  65. "execution_count": 4,
  66. "metadata": {},
  67. "outputs": [
  68. {
  69. "data": {
  70. "text/plain": [
  71. "' @#$%$@2123 '"
  72. ]
  73. },
  74. "execution_count": 4,
  75. "metadata": {},
  76. "output_type": "execute_result"
  77. }
  78. ],
  79. "source": [
  80. "\" @#$%$@2123 \""
  81. ]
  82. },
  83. {
  84. "cell_type": "code",
  85. "execution_count": 5,
  86. "metadata": {},
  87. "outputs": [
  88. {
  89. "name": "stdout",
  90. "output_type": "stream",
  91. "text": [
  92. "hello!\n"
  93. ]
  94. }
  95. ],
  96. "source": [
  97. "print(\"hello!\")"
  98. ]
  99. },
  100. {
  101. "cell_type": "code",
  102. "execution_count": 6,
  103. "metadata": {},
  104. "outputs": [
  105. {
  106. "data": {
  107. "text/plain": [
  108. "'Michael Jackson'"
  109. ]
  110. },
  111. "execution_count": 6,
  112. "metadata": {},
  113. "output_type": "execute_result"
  114. }
  115. ],
  116. "source": [
  117. "Name = \"Michael Jackson\"\n",
  118. "Name"
  119. ]
  120. },
  121. {
  122. "cell_type": "code",
  123. "execution_count": 7,
  124. "metadata": {},
  125. "outputs": [
  126. {
  127. "data": {
  128. "text/plain": [
  129. "'M'"
  130. ]
  131. },
  132. "execution_count": 7,
  133. "metadata": {},
  134. "output_type": "execute_result"
  135. }
  136. ],
  137. "source": [
  138. "Name[0]"
  139. ]
  140. },
  141. {
  142. "cell_type": "code",
  143. "execution_count": 8,
  144. "metadata": {},
  145. "outputs": [
  146. {
  147. "name": "stdout",
  148. "output_type": "stream",
  149. "text": [
  150. "M\n"
  151. ]
  152. }
  153. ],
  154. "source": [
  155. "print(Name[0])"
  156. ]
  157. },
  158. {
  159. "cell_type": "code",
  160. "execution_count": 9,
  161. "metadata": {},
  162. "outputs": [
  163. {
  164. "name": "stdout",
  165. "output_type": "stream",
  166. "text": [
  167. "l\n"
  168. ]
  169. }
  170. ],
  171. "source": [
  172. "print(Name[6])"
  173. ]
  174. },
  175. {
  176. "cell_type": "code",
  177. "execution_count": 10,
  178. "metadata": {},
  179. "outputs": [
  180. {
  181. "name": "stdout",
  182. "output_type": "stream",
  183. "text": [
  184. "o\n"
  185. ]
  186. }
  187. ],
  188. "source": [
  189. "print(Name[13])"
  190. ]
  191. },
  192. {
  193. "cell_type": "code",
  194. "execution_count": 11,
  195. "metadata": {},
  196. "outputs": [
  197. {
  198. "name": "stdout",
  199. "output_type": "stream",
  200. "text": [
  201. "n\n"
  202. ]
  203. }
  204. ],
  205. "source": [
  206. "print(Name[-1])"
  207. ]
  208. },
  209. {
  210. "cell_type": "code",
  211. "execution_count": 12,
  212. "metadata": {},
  213. "outputs": [
  214. {
  215. "data": {
  216. "text/plain": [
  217. "15"
  218. ]
  219. },
  220. "execution_count": 12,
  221. "metadata": {},
  222. "output_type": "execute_result"
  223. }
  224. ],
  225. "source": [
  226. "len(Name)"
  227. ]
  228. },
  229. {
  230. "cell_type": "code",
  231. "execution_count": 14,
  232. "metadata": {},
  233. "outputs": [
  234. {
  235. "name": "stdout",
  236. "output_type": "stream",
  237. "text": [
  238. "Mich\n",
  239. "Jack\n"
  240. ]
  241. }
  242. ],
  243. "source": [
  244. "print(Name[0:4])\n",
  245. "print(Name[8:12])"
  246. ]
  247. },
  248. {
  249. "cell_type": "code",
  250. "execution_count": 15,
  251. "metadata": {},
  252. "outputs": [
  253. {
  254. "data": {
  255. "text/plain": [
  256. "'Michael Jackson'"
  257. ]
  258. },
  259. "execution_count": 15,
  260. "metadata": {},
  261. "output_type": "execute_result"
  262. }
  263. ],
  264. "source": [
  265. "Name[:]"
  266. ]
  267. },
  268. {
  269. "cell_type": "code",
  270. "execution_count": 16,
  271. "metadata": {},
  272. "outputs": [
  273. {
  274. "data": {
  275. "text/plain": [
  276. "'McalJcsn'"
  277. ]
  278. },
  279. "execution_count": 16,
  280. "metadata": {},
  281. "output_type": "execute_result"
  282. }
  283. ],
  284. "source": [
  285. "Name[::2]"
  286. ]
  287. },
  288. {
  289. "cell_type": "code",
  290. "execution_count": 18,
  291. "metadata": {},
  292. "outputs": [
  293. {
  294. "data": {
  295. "text/plain": [
  296. "'Mh'"
  297. ]
  298. },
  299. "execution_count": 18,
  300. "metadata": {},
  301. "output_type": "execute_result"
  302. }
  303. ],
  304. "source": [
  305. "Name[0:5:3]"
  306. ]
  307. },
  308. {
  309. "cell_type": "code",
  310. "execution_count": 22,
  311. "metadata": {},
  312. "outputs": [],
  313. "source": [
  314. "Statement = Name + \" is the best\""
  315. ]
  316. },
  317. {
  318. "cell_type": "code",
  319. "execution_count": 23,
  320. "metadata": {},
  321. "outputs": [
  322. {
  323. "data": {
  324. "text/plain": [
  325. "'Michael Jackson is the best'"
  326. ]
  327. },
  328. "execution_count": 23,
  329. "metadata": {},
  330. "output_type": "execute_result"
  331. }
  332. ],
  333. "source": [
  334. "Statement"
  335. ]
  336. },
  337. {
  338. "cell_type": "code",
  339. "execution_count": 24,
  340. "metadata": {},
  341. "outputs": [
  342. {
  343. "data": {
  344. "text/plain": [
  345. "'Michael JacksonMichael JacksonMichael Jackson'"
  346. ]
  347. },
  348. "execution_count": 24,
  349. "metadata": {},
  350. "output_type": "execute_result"
  351. }
  352. ],
  353. "source": [
  354. "3 * Name"
  355. ]
  356. },
  357. {
  358. "cell_type": "code",
  359. "execution_count": 25,
  360. "metadata": {},
  361. "outputs": [],
  362. "source": [
  363. "Name = Name + \" is the best\""
  364. ]
  365. },
  366. {
  367. "cell_type": "code",
  368. "execution_count": 26,
  369. "metadata": {},
  370. "outputs": [
  371. {
  372. "data": {
  373. "text/plain": [
  374. "'Michael Jackson is the best'"
  375. ]
  376. },
  377. "execution_count": 26,
  378. "metadata": {},
  379. "output_type": "execute_result"
  380. }
  381. ],
  382. "source": [
  383. "Name"
  384. ]
  385. },
  386. {
  387. "cell_type": "code",
  388. "execution_count": 27,
  389. "metadata": {},
  390. "outputs": [
  391. {
  392. "name": "stdout",
  393. "output_type": "stream",
  394. "text": [
  395. "Michael Jackson \n",
  396. " is the best\n"
  397. ]
  398. }
  399. ],
  400. "source": [
  401. "print(\"Michael Jackson \\n is the best\")"
  402. ]
  403. },
  404. {
  405. "cell_type": "code",
  406. "execution_count": 28,
  407. "metadata": {},
  408. "outputs": [
  409. {
  410. "name": "stdout",
  411. "output_type": "stream",
  412. "text": [
  413. "Michael Jackson \t is the best\n"
  414. ]
  415. }
  416. ],
  417. "source": [
  418. "print(\"Michael Jackson \\t is the best\")"
  419. ]
  420. },
  421. {
  422. "cell_type": "code",
  423. "execution_count": 30,
  424. "metadata": {},
  425. "outputs": [
  426. {
  427. "name": "stdout",
  428. "output_type": "stream",
  429. "text": [
  430. "Michael Jackson \\ is the best\n"
  431. ]
  432. }
  433. ],
  434. "source": [
  435. "print(\"Michael Jackson \\\\ is the best\")"
  436. ]
  437. },
  438. {
  439. "cell_type": "code",
  440. "execution_count": 31,
  441. "metadata": {},
  442. "outputs": [
  443. {
  444. "name": "stdout",
  445. "output_type": "stream",
  446. "text": [
  447. "before upper: Thriller is the sixth studio album\n",
  448. "After upper: THRILLER IS THE SIXTH STUDIO ALBUM\n"
  449. ]
  450. }
  451. ],
  452. "source": [
  453. "A = \"Thriller is the sixth studio album\"\n",
  454. "print(\"before upper:\", A)\n",
  455. "B = A.upper()\n",
  456. "print(\"After upper:\", B)"
  457. ]
  458. },
  459. {
  460. "cell_type": "code",
  461. "execution_count": 32,
  462. "metadata": {},
  463. "outputs": [
  464. {
  465. "data": {
  466. "text/plain": [
  467. "'Janet Jackson is the best'"
  468. ]
  469. },
  470. "execution_count": 32,
  471. "metadata": {},
  472. "output_type": "execute_result"
  473. }
  474. ],
  475. "source": [
  476. "A = \"Michael Jackson is the best\"\n",
  477. "B = A.replace('Michael', 'Janet')\n",
  478. "B"
  479. ]
  480. },
  481. {
  482. "cell_type": "code",
  483. "execution_count": 33,
  484. "metadata": {},
  485. "outputs": [
  486. {
  487. "data": {
  488. "text/plain": [
  489. "5"
  490. ]
  491. },
  492. "execution_count": 33,
  493. "metadata": {},
  494. "output_type": "execute_result"
  495. }
  496. ],
  497. "source": [
  498. "Name = \"Michael Jackson\"\n",
  499. "Name.find('el')"
  500. ]
  501. },
  502. {
  503. "cell_type": "code",
  504. "execution_count": 34,
  505. "metadata": {},
  506. "outputs": [
  507. {
  508. "data": {
  509. "text/plain": [
  510. "-1"
  511. ]
  512. },
  513. "execution_count": 34,
  514. "metadata": {},
  515. "output_type": "execute_result"
  516. }
  517. ],
  518. "source": [
  519. "Name.find('Jasdfasdasdf')"
  520. ]
  521. },
  522. {
  523. "cell_type": "code",
  524. "execution_count": 35,
  525. "metadata": {},
  526. "outputs": [],
  527. "source": [
  528. "D = \"ABCDEFG\""
  529. ]
  530. },
  531. {
  532. "cell_type": "code",
  533. "execution_count": 36,
  534. "metadata": {},
  535. "outputs": [
  536. {
  537. "data": {
  538. "text/plain": [
  539. "'ABC'"
  540. ]
  541. },
  542. "execution_count": 36,
  543. "metadata": {},
  544. "output_type": "execute_result"
  545. }
  546. ],
  547. "source": [
  548. "D[0:3]"
  549. ]
  550. },
  551. {
  552. "cell_type": "code",
  553. "execution_count": 38,
  554. "metadata": {},
  555. "outputs": [
  556. {
  557. "name": "stdout",
  558. "output_type": "stream",
  559. "text": [
  560. "coklll\n"
  561. ]
  562. }
  563. ],
  564. "source": [
  565. "E ='clockrlelclt'\n",
  566. "print(E[::2])"
  567. ]
  568. },
  569. {
  570. "cell_type": "code",
  571. "execution_count": 39,
  572. "metadata": {},
  573. "outputs": [
  574. {
  575. "name": "stdout",
  576. "output_type": "stream",
  577. "text": [
  578. "\\\n"
  579. ]
  580. }
  581. ],
  582. "source": [
  583. "print(\"\\\\\")"
  584. ]
  585. },
  586. {
  587. "cell_type": "code",
  588. "execution_count": 40,
  589. "metadata": {},
  590. "outputs": [],
  591. "source": [
  592. "F = \"You are wrong\""
  593. ]
  594. },
  595. {
  596. "cell_type": "code",
  597. "execution_count": 41,
  598. "metadata": {},
  599. "outputs": [
  600. {
  601. "name": "stdout",
  602. "output_type": "stream",
  603. "text": [
  604. "YOU ARE WRONG\n"
  605. ]
  606. }
  607. ],
  608. "source": [
  609. "print(F.upper())"
  610. ]
  611. },
  612. {
  613. "cell_type": "code",
  614. "execution_count": 42,
  615. "metadata": {},
  616. "outputs": [
  617. {
  618. "name": "stdout",
  619. "output_type": "stream",
  620. "text": [
  621. "95\n"
  622. ]
  623. }
  624. ],
  625. "source": [
  626. "G = \"Mary had a little lamb Little lamb, little lamb Mary had a little lamb \\\n",
  627. "Its fleece was white as snow And everywhere that Mary went Mary went, Mary went \\\n",
  628. "Everywhere that Mary went The lamb was sure to go\"\n",
  629. "print(G.find(\"snow\"))"
  630. ]
  631. },
  632. {
  633. "cell_type": "code",
  634. "execution_count": null,
  635. "metadata": {},
  636. "outputs": [],
  637. "source": []
  638. }
  639. ],
  640. "metadata": {
  641. "kernelspec": {
  642. "display_name": "Python 3",
  643. "language": "python",
  644. "name": "python3"
  645. },
  646. "language_info": {
  647. "codemirror_mode": {
  648. "name": "ipython",
  649. "version": 3
  650. },
  651. "file_extension": ".py",
  652. "mimetype": "text/x-python",
  653. "name": "python",
  654. "nbconvert_exporter": "python",
  655. "pygments_lexer": "ipython3",
  656. "version": "3.6.6"
  657. }
  658. },
  659. "nbformat": 4,
  660. "nbformat_minor": 2
  661. }
Add Comment
Please, Sign In to add comment