Preview

01 - Indentation, Syntax and Intro

 1. What is Python?

  An operating system

  A high level programming language

  An assembly code scripting code

  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 3 - there should never be blank space

  Line 1 - def should be DEFINITELY

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

  Line 2 - PRINT should be print

 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 1 has been indented to create the def statement

  Nothing has been indented in the example shown

  Line 4 is indented to call the main subroutine

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

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

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

  save the words "print this" to a PDF document

  crash the computer, as it is not possible to print

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

 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

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

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

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

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

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

 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.

  False

  True

 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.

  open | television

  operation | transatlantic snake

  opaque | turtle

  outstanding | teleportation