Orwell Park Hackathon

ictmagic.co/orwell

Greetings Coders 7.0!

Today you will take part in a hackathon.

This hackathon will focus on the use of inputs.

You will also use ‘if‘, ‘elif‘ and ‘else‘ statements.

Where to get hacking help?

In your code you WILL make mistakes. Computers (and teachers) are fussy about the code they accept). So try:

  1. Save often and save well. Name your saved versions using the v1… v2… v3 system so you can go back to a version that does work.
  2. Read your code REEAALLYY carefully all the way through, referring back to examples. In Python the error message will tell you where the error is. You might encounter a syntax or logic errors. Common errors include not indenting with spaces, not using “quotation marks”, or forgetting a colon(:), or writing ‘Print’ instead of ‘print’.
  3. Ask a friend to read your code, admire your code, and say “That’s nice code, but have you checked this bit.”
  4. Only after trying all the above and pondering for a while, ask your friendly AI for help using a prompt like “What’s wrong with my code?” and then copy/paste your code into the AI dialogue. Try using ChatGPT, Microsoft Copilot or Google Gemini.
  5. If you get help from a friend or AI, write that you did using a #hashtag note within your code to say where. White hat hackers are always honest!

What do visitors to Orwell Park School need to know?

Everyone knows that if you want to know something about the school, you ask Year 7.

You will create a chatbot which could go on the Orwell Park School website to answer simple common questions.

What are the most important things visitors may want to know when using a chatbot about Orwell Park School?

Scratch around for an example here.

Important note: Computers like certainty (don’t we all!). Because the user’s answers need to be exactly what the computer is ‘expecting’, including the correct spelling, punctuation and capitals in all the right places, guide the user towards the inputs you want.

EduBlocks page.

Trinket Python

Jdoodle Python

Tip: Using \n starts a new line in your string text, which keeps the options neat and clear.

question = input("What do you want to know? \n The school phone number (type a)? \n what day do Year 7 have PE (b)? \n what is Year 7's homework (c)? \n")
if question == "a":
  print("You chose option a.")
elif question == "b":
  print("You chose option b.")
elif question == "c":
  print("You chose option c.")

AI-generated Flow Diagram

Use an ‘else’ function to help the user make a better choice next time by catching all of the user’s bad inputs. Try to guess what mistakes and typos they might make. ‘Else’ is used at the end of if/elif statements and does not need a condition.

else:
  print("another answer, including invalid inputs")

Extension:

  1. Try adding a ‘while True:’ statement to repeatedly ask your question?
  2. Use AI to suggest improvements to your code.
  3. Can you prompt AI to generate a flow diagram of your code?
  4. Begin to design a chatbot for a new purpose that interests you, including a ‘while True:’ statement. This could be about a hobby or interest, a chatbot of a celebrity you like, or a quiz with feedback about whether the user is correct. (You will likely run out of time in this lesson, so save it somewhere so you can continue later).
  5. Can you write ‘pseudocode’ AI prompts to create the python code for you?