Learning Python

2,241 views
2,170 views

Published on

Brief introduction to the Python programming language, for complete beginners who have never learned a programming language before. Resources and links are included.

Published in: Technology
2 Comments
1 Like
Statistics
Notes
  • Mirko: Small steps can show journalists what's possible, but to really go out on their own, they'll need to learn how programming works. Otherwise, they can't work independently with code.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hey there, good way to frame why and how journalists should start coding. But it is an uphill battle. How can we create positive experiences with coding in newsrooms? Educated guess: Small steps, quick success and future perspectives why coding keeps you in the job.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,241
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
21
Comments
2
Likes
1
Embeds 0
No embeds

No notes for slide
  • CONTACT: Mindy McAdams – http://mindymcadams.com/
  • Source:https://github.com/mjwillson/ProgLangVisualise
  • Resource: http://www.quora.com/Is-it-better-to-learn-Python-or-JavaScript-as-a-first-language
  • Think Python, by Allen B. Downey (O’Reilly Media: 2012), page 3
  • Resource: http://www.tutorialspoint.com/python/python_basic_operators.htm
  • “One of the most important skills you will acquire is debugging.” – Downey, p. 5 Resource: http://docs.python.org/2/tutorial/errors.html
  • CONTACT: Mindy McAdams – http://mindymcadams.com/
  • Learning Python

    1. 1. PYTHONLEARNING TO PROGRAM
    2. 2. WHY LEARN TO PROGRAM?• An important skill in making things for online media: problem solving• Process of learning to program: Practice and improve your problem-solving skills• Thinking in a structured way• Learning how to find answers by a combination of online searching and trial-and-error
    3. 3. WHY PYTHON?Python is one ofthe most-usedprogramminglanguagestoday. Source: https://github.com/mjwillson/ProgLangVisualise
    4. 4. WHY NOT JAVASCRIPT?• JavaScript is a must for Web development today.• If you already knew how to program, you could jump straight into JavaScript and not learn Python.• As a first programming language, Python is easier to learn than JavaScript.• The techniques you learn as you learn Python will help you understand JavaScript more quickly. http://www.quora.com/Is-it-better-to-learn-Python-or- JavaScript-as-a-first-language
    5. 5. USING PYTHON • There are two ways to use Python: • Interactive mode • Script mode • In interactive mode, you type Python programs and the Python interpreter displays the result immediately …Source: Think Python, by Allen B. Downey (O’Reilly Media: 2012), pages 2–3
    6. 6. PYTHONINTERACTIVE MODE
    7. 7. USING PYTHON • There are two ways to use Python: • Interactive mode • Script mode • In script mode, you write code in a text file, save it, and then use the interpreter to execute (or run) the contents of the file (which is called a script) • Python scripts have filenames that end with .pySource: Think Python, by Allen B. Downey (O’Reilly Media: 2012), pages 2–3
    8. 8. PYTHONTHIS IS A SCRIPT, SHOWN IN A TEXT EDITOR
    9. 9. When you run a Python script (left) in the Pythoninterpreter, the output (but not the stored script) isdisplayed onscreen (right).
    10. 10. WHAT A PROGRAM DOES • Input: Get data from the keyboard, a file, or some other device • Output: Display data on the screen, or send data to a file or other device • Math: Perform basic mathematical operations like addition and multiplication • Conditional execution: Check for certain conditions and execute the appropriate code • Repetition: Perform some action repeatedly, usually with some variationSource: Think Python, by Allen B. Downey (O’Reilly Media: 2012), page 3
    11. 11. WHAT A PROGRAM DOES (2)• Input: (1) run a script; (2) raw_input• Output: (1) print; (2) create and write to text files• Math: +, –, /, *, %, >, <, >=, <=, ==• Conditional execution: if, elif, else• Repetition: for, whileYou will learn how to do each of these, which is pretty muchall there is to programming. (I’m lying a little bit.)
    12. 12. ―Every program you’ve ever used, nomatter how complicated, is made up ofinstructions that look pretty much likethese. So you can think of programming asthe process of breaking a large, complextask into smaller and smaller subtasks untilthe subtasks are simple enough to beperformed with one of these basicinstructions.‖Source: Think Python, by Allen B. Downey (O’Reilly Media: 2012), page 4
    13. 13. DEBUGGING Errors are bugs. Finding and fixing them is debugging. • Syntax errors: Structure and rules, such as: ―Parentheses come in pairs‖ • Runtime errors: Appear while the program is running (these are called exceptions) • Semantic errors: Your script runs but does not do what you wanted it to doSource: Think Python, by Allen B. Downey (O’Reilly Media: 2012), pages 4–5
    14. 14. In the practice of programming—of writingprograms—a lot of the work is in thedebugging.Each error becomes a puzzle to be solved.―Why doesn’t it work the way I want it towork?‖The process of learning to program is aprocess of problem-solving.
    15. 15. RESOURCES• Think Python, by Allen B. Downey http://www.greenteapress.com/thinkpython/• Learn Python the Hard Way, by Zed A. Shaw http://learnpythonthehardway.org/• Codecademy: Python http://www.codecademy.com/tracks/python
    16. 16. PYTHON LEARNING TO PROGRAMPresentation by Mindy McAdams, University of Florida [ 2012 ]

    ×