Preview

01 - Indentation, Syntax and Intro

 1. What is Python?

  A high level programming language

  A snake

  An assembly code scripting code

  An operating system

 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 1 - def should be DEFINITELY

  Line 3 - there should never be blank space

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

 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()

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

  Nothing has been indented in the example shown

  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")

  crash the computer, as it is not possible to print

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

  save the words "print this" to a PDF document

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

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

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

""")

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

  It prints the text entered between the triple quotes three times

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

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

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

  False

  True

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

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

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

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

  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

  True

  False

 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.

  outstanding | teleportation

  open | television

  opaque | turtle

  operation | transatlantic snake