1 / 8

Programming for GCSE 1.2 Writing Python Scripts

T eaching L ondon C omputing. Programming for GCSE 1.2 Writing Python Scripts. William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London. Aims. Writing Python program Creating files Comments Layout Using ‘print’. Python Program.

Télécharger la présentation

Programming for GCSE 1.2 Writing Python Scripts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TeachingLondon Computing Programming for GCSE1.2 Writing Python Scripts William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London

  2. Aims • Writing Python program • Creating files • Comments • Layout • Using ‘print’

  3. Python Program • Python programs can be very simple • File (best to name it with extension .py) • Much simpler than Java (or C♯) print(”hello”)

  4. Comments • Comment explain a program • Comments can be used to help plan a program # Thisprogram prints a greeting print(”hello”)

  5. Layout • An important feature of Python • Indentation matters! Always start in the same column

  6. The ‘print’ function • The ‘print’ function is used to output a string • In these examples • The print function has two strings or an expression • Note the spaces • Both statements output the same thing print(“hello“, “world“) print(“hello“ + “ hello“)

  7. Printing Numbers • Print can also output a number • Example >>> print("Average is", (30 + 40)/2) Average is 35.0

  8. Summary • A Python program is a file containing statements • Simple! • ‘print’ for output • String and numbers

More Related