PYTHON
  • PYTHON v3
  • Python IDE Setup
  • Python Programming
    • Python for ABS
      • Resources
      • Ch1 - Getting Started
      • Ch2 - Types, Variables and Simple I/O
  • Python For Network Engineers-Kirk Beyers
    • Resources
    • Python Fundamentals
  • Python Inststitute (PCAP)
    • Resources
    • Course Introduction
    • Python Essentials (Part 1)
      • Module 1
        • Fundamentals
        • What is Python
        • Starting your work with Python
      • Module 2
        • The Print Function
          • Section Summary
        • Literals
          • Section Summary
        • Operations- Data Manipulation Tools
          • Section Summary
        • Variables
          • Leaving Comments in Code
          • The input () Function
  • 100 Days Of Code
    • Resources
    • What You Have To Do !!
    • 100 DAY's
      • DAY 1: Working with Variables
      • Day 2: Data Types & String Manipulation
      • Day 3: Control Flow and Operators
      • Day 4: Randomisation and Lists
      • Day 5: For Loops, Range & Code Blocks
      • Day 6: Python Functions and Karel
      • Day 7: Hangman
      • SUMMARY
  • {Pirple}
    • Resources
Powered by GitBook
On this page
  • Key Takeaways
  • What we have learnt today

Was this helpful?

  1. Python Inststitute (PCAP)
  2. Python Essentials (Part 1)
  3. Module 2
  4. The Print Function

Section Summary

PreviousThe Print FunctionNextLiterals

Last updated 4 years ago

Was this helpful?

Key Takeaways

What we have learnt today

  • The print() function is a built-in function. It prints/outputs a specified message to the screen/console window

  • Built-in functions, contrary to user-defined functions are always available and dont have to be imported. Python 3.8 comes with 69 built-in functions. You can find the full list in alphabetical order in the

  • To call a functions (function invocation) you need to use the function name followed by parentheses. You can pass arguments into a function by placing them inside the parentheses. You must separate arguments with a comma. print ("Hello" , "world!") . An "empty" print () function outputs an empty line to the screen

  • Python strings are delimited with quotes (single or double) "I am a string" or 'I am a string'

  • Computer programs are collections of instructions. An instruction is a command to perform a specific task when executed. eg. to print a certain message to a screen

  • In Python strings, the backslash (\) is a special character which announces the next character has a different meaning. eg \n (the newline character) starts a new output line

  • Positional arguments are the ones whose meaning is dictated by their position. eg, the second argument is outputted after the first, the third is outputted after the second etc

  • Keyword arguments are the ones who's meaning is not dictated by their location, but by a special word (keyword) used to identify them

  • The end and sep parameters can be used for formatting the output of the print () function. The sep parameter specifies the separator between the outputted arguments.

    • eg. print ("H", "E", "L", "L", "O", sep="-") H-E-L-L-O

    • eg print ("Game over", "Want to Play Again?" , end=" ") print ("Select", "Yes or No")

    • Game over Want to Play Again? Select Yes or No

Python Standard Library