Preview

01 - Indentation, Syntax and Intro

 1. What is Python?

  An operating system

  An assembly code scripting code

  A high level programming language

  A snake

 2. In Python, syntax and indentation matter. In the code below, what is an example of INCORRECT syntax?
def main():
	PRINT("Hello World")

main()

  Line 2 - PRINT should be print

  Line 4 - main() should be MAIN(())

  Line 3 - there should never be blank space

  Line 1 - def should be DEFINITELY

 3. In the code below, where has the indentation been applied? (Where do you notice an indent?) Note: In Python subroutines are also called 'functions'.
def main():
	print("Welcome to the main function")
	print("Nice to meet you!")
main()

  Nothing has been indented in the example shown

  Line 2 and 3 are indented inside the "main" subroutine/function.

  Line 1 has been indented to create the def statement

  Line 4 is indented to call the main subroutine

 4. What will the below code do?
print("Print this")

  save the words "print this" to a PDF document

  print the words "print this" to the printer installed in your room

  print the words "print this" to the screen as output

  crash the computer, as it is not possible to print

 5. What does using print(""" """), as shown below, achieve?
print("""

===MAIN MENU===
1. Press P to Play
2. Press Q to Quit

""")

  Triple quotes ensure that the text entered inside can definitely be seen

  There is no such feature in Python so it will do nothing!

  It allows you to print multiple lines of text to the screen

  It prints the text entered between the triple quotes three times

 6. Python is a language that is growing fast in popularity. Huge companies including facebook, youtube and google use python in their backend systems.

  True

  False

 7. There is an error in the code below. Can you point it out?
def main():
x=2
y=3
print(x+y)
main()

  Syntax error - Line 1 should not have the colon at the end

  Assignment error - Line 2 and 3 should have a == instead of a single =

  Indentation error - Line 2 and 3 inside the main function/subroutine should be indented

  Call error - Line 5 should have a colon at the end (e.g. main(): )

 8. It was a Dutch programmer, Guido Van Rossum, who wrote Python as a hobby programming project back in the late 1980s. Since then it has grown hugely in popularity

  False

  True

 9. Python is NOT free to use. Users (like you) can NOT use it to create commercial apps.

  True

  False

 10. Finally, fill in the blanks: Python is an o__________ source programming language that was made to be easy to read. It was created by a programmer named Guido van Rossum in 1991. The language is named after a t__________ show, and not the snake.

  operation | transatlantic snake

  opaque | turtle

  open | television

  outstanding | teleportation