|
65 | 65 | "print(\"Hello World\")" |
66 | 66 | ] |
67 | 67 | }, |
| 68 | + { |
| 69 | + "cell_type": "markdown", |
| 70 | + "metadata": {}, |
| 71 | + "source": [ |
| 72 | + "Jupyter notebooks will always print the value of the last line so you don't have to. You can suppress this with a semicolon ';'" |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "cell_type": "code", |
| 77 | + "execution_count": null, |
| 78 | + "metadata": {}, |
| 79 | + "outputs": [], |
| 80 | + "source": [ |
| 81 | + "\"Hello World\"" |
| 82 | + ] |
| 83 | + }, |
| 84 | + { |
| 85 | + "cell_type": "code", |
| 86 | + "execution_count": null, |
| 87 | + "metadata": { |
| 88 | + "collapsed": true |
| 89 | + }, |
| 90 | + "outputs": [], |
| 91 | + "source": [ |
| 92 | + "\"Hello World\";" |
| 93 | + ] |
| 94 | + }, |
68 | 95 | { |
69 | 96 | "cell_type": "markdown", |
70 | 97 | "metadata": {}, |
|
135 | 162 | { |
136 | 163 | "cell_type": "code", |
137 | 164 | "execution_count": null, |
138 | | - "metadata": {}, |
| 165 | + "metadata": { |
| 166 | + "collapsed": true |
| 167 | + }, |
139 | 168 | "outputs": [], |
140 | 169 | "source": [] |
141 | 170 | }, |
|
192 | 221 | "metadata": {}, |
193 | 222 | "outputs": [], |
194 | 223 | "source": [ |
195 | | - "print((3 * 2.1))" |
| 224 | + "print(3 * 2.1)" |
196 | 225 | ] |
197 | 226 | }, |
198 | 227 | { |
|
210 | 239 | "metadata": {}, |
211 | 240 | "outputs": [], |
212 | 241 | "source": [ |
213 | | - "print((5 / 2))" |
| 242 | + "print(5 / 2)" |
214 | 243 | ] |
215 | 244 | }, |
216 | 245 | { |
|
242 | 271 | { |
243 | 272 | "cell_type": "code", |
244 | 273 | "execution_count": null, |
245 | | - "metadata": {}, |
| 274 | + "metadata": { |
| 275 | + "collapsed": true |
| 276 | + }, |
246 | 277 | "outputs": [], |
247 | 278 | "source": [] |
248 | 279 | }, |
|
302 | 333 | { |
303 | 334 | "cell_type": "code", |
304 | 335 | "execution_count": null, |
305 | | - "metadata": {}, |
| 336 | + "metadata": { |
| 337 | + "collapsed": true |
| 338 | + }, |
306 | 339 | "outputs": [], |
307 | 340 | "source": [] |
308 | 341 | }, |
|
320 | 353 | "metadata": {}, |
321 | 354 | "outputs": [], |
322 | 355 | "source": [ |
323 | | - "print(('Hello ' + 'Coding Circle'))" |
| 356 | + "print('Hello ' + 'Coding Circle')" |
324 | 357 | ] |
325 | 358 | }, |
326 | 359 | { |
|
329 | 362 | "metadata": {}, |
330 | 363 | "outputs": [], |
331 | 364 | "source": [ |
332 | | - "print((\"The \" + WHALE + \" lives in the sea.\"))" |
| 365 | + "print(\"The \" + WHALE + \" lives in the sea.\")" |
333 | 366 | ] |
334 | 367 | }, |
335 | 368 | { |
|
345 | 378 | "metadata": {}, |
346 | 379 | "outputs": [], |
347 | 380 | "source": [ |
348 | | - "print((\"My name is\" + \"Charlotte\"))" |
| 381 | + "print(\"My name is\" + \"Charlotte\")" |
349 | 382 | ] |
350 | 383 | }, |
351 | 384 | { |
|
359 | 392 | { |
360 | 393 | "cell_type": "code", |
361 | 394 | "execution_count": null, |
362 | | - "metadata": {}, |
| 395 | + "metadata": { |
| 396 | + "collapsed": true |
| 397 | + }, |
363 | 398 | "outputs": [], |
364 | 399 | "source": [] |
365 | 400 | }, |
|
369 | 404 | "source": [ |
370 | 405 | "## Asking the user for input\n", |
371 | 406 | "\n", |
372 | | - "To get an input for the user we use the built-in function input() and assign it to a variable.\n", |
| 407 | + "To get an input for the user we use the built-in function `input()` and assign it to a variable.\n", |
373 | 408 | "\n", |
374 | 409 | "NOTE: The result is always a string." |
375 | 410 | ] |
|
380 | 415 | "metadata": {}, |
381 | 416 | "outputs": [], |
382 | 417 | "source": [ |
383 | | - "my_name = eval(input())\n", |
| 418 | + "my_name = input()\n", |
384 | 419 | "print(my_name)" |
385 | 420 | ] |
386 | 421 | }, |
|
401 | 436 | "metadata": {}, |
402 | 437 | "outputs": [], |
403 | 438 | "source": [ |
404 | | - "favorite_ocean_animal = eval(input(\"What is your favorite sea creature?\\n\"))\n", |
405 | | - "print((\"The \" + favorite_ocean_animal + \" is so cool!\"))" |
| 439 | + "favorite_ocean_animal = input(\"What is your favorite sea creature?\\n\")\n", |
| 440 | + "print(\"The \" + favorite_ocean_animal + \" is so cool!\")" |
406 | 441 | ] |
407 | 442 | }, |
408 | 443 | { |
|
422 | 457 | "metadata": {}, |
423 | 458 | "outputs": [], |
424 | 459 | "source": [ |
425 | | - "number_of_apples = eval(input(\"How many apples do you want?\\n\"))\n", |
| 460 | + "number_of_apples = input(\"How many apples do you want?\\n\")\n", |
426 | 461 | "number_of_apples_int = int(number_of_apples)\n", |
427 | | - "print((number_of_apples_int * 1.05))" |
| 462 | + "print(number_of_apples_int * 1.05)" |
428 | 463 | ] |
429 | 464 | }, |
430 | 465 | { |
|
438 | 473 | { |
439 | 474 | "cell_type": "code", |
440 | 475 | "execution_count": null, |
441 | | - "metadata": {}, |
| 476 | + "metadata": { |
| 477 | + "collapsed": true |
| 478 | + }, |
442 | 479 | "outputs": [], |
443 | 480 | "source": [] |
444 | 481 | }, |
|
455 | 492 | { |
456 | 493 | "cell_type": "code", |
457 | 494 | "execution_count": null, |
458 | | - "metadata": {}, |
| 495 | + "metadata": { |
| 496 | + "collapsed": true |
| 497 | + }, |
459 | 498 | "outputs": [], |
460 | 499 | "source": [ |
461 | 500 | "# Calculate the price of apples that a user wants\n", |
462 | | - "number_of_apples = eval(input(\"How many apples do you want?\\n\")) # Ask user for quantity of apples\n", |
| 501 | + "number_of_apples = input(\"How many apples do you want?\\n\") # Ask user for quantity of apples\n", |
463 | 502 | "number_of_apples_int = int(number_of_apples) # raw_input returns string, so convert to integer\n", |
464 | | - "print((number_of_apples_int * 1.05)) # multiply by price of apples" |
| 503 | + "print(number_of_apples_int * 1.05) # multiply by price of apples" |
465 | 504 | ] |
466 | 505 | }, |
467 | 506 | { |
|
475 | 514 | { |
476 | 515 | "cell_type": "code", |
477 | 516 | "execution_count": null, |
478 | | - "metadata": {}, |
| 517 | + "metadata": { |
| 518 | + "collapsed": true |
| 519 | + }, |
479 | 520 | "outputs": [], |
480 | 521 | "source": [] |
481 | 522 | }, |
|
497 | 538 | { |
498 | 539 | "cell_type": "code", |
499 | 540 | "execution_count": null, |
500 | | - "metadata": {}, |
| 541 | + "metadata": { |
| 542 | + "collapsed": true |
| 543 | + }, |
501 | 544 | "outputs": [], |
502 | 545 | "source": [ |
503 | 546 | "\n", |
|
521 | 564 | "name": "python", |
522 | 565 | "nbconvert_exporter": "python", |
523 | 566 | "pygments_lexer": "ipython3", |
524 | | - "version": "3.6.1" |
| 567 | + "version": "3.6.3" |
525 | 568 | } |
526 | 569 | }, |
527 | 570 | "nbformat": 4, |
|
0 commit comments