Student Summer Sprint
  • Welcome to Hackathons for Schools Student Summer Sprint!
  • Event Information
  • What is the Student Summer Sprint?
  • Useful Event Information and Links
  • Schedule
  • Our Organisers, Panelists and Mentors
    • Organisers
    • Panelists and Speakers
    • Mentors
  • Project Details
    • Themes
    • Judging Criteria and Winning Teams
    • Presentation Advice
    • Submission Checklist and FAQs
  • Coding Platform and GitLab
  • Technical Workshops
    • How to Use Git
      • Git and the Terminal
      • How to use Git - The Basics
      • Branching, Merging and Other Useful Commands
      • How to use Git - Further Resources
    • Web Development
      • HTML
      • CSS
      • JavaScript
      • Web Development - Resources
    • Introduction to Python
      • Variables
      • Data Types and String Formatting
      • Input and Output
      • Conditional Statements
      • Functions
      • Libraries
      • CHALLENGES
        • Solutions
      • Learning Python - Resources
    • Discord Bots in Python
      • Discord Bots - Resources
    • Web Scraping in Python
  • Careers Advice and Opportunities
    • University Advice
      • University Advice - Further Resources
    • CV, Applications and Interviews
      • Creating a Great CV
      • UCAS Personal Statement Advice
      • Interview Hints and Tips
      • Ultimate LinkedIn Guide
      • Applications - Further Resources
    • Different routes into a tech career
      • Different Routes into Tech - Further Resources
    • What Now?
      • More Opportunities!
Powered by GitBook
On this page
  • Challenge 1: String Formatting
  • Challenge 2: Conditional Statements
  • Extension
  • Challenge 3: Using Libraries
  • Extension

Was this helpful?

  1. Technical Workshops
  2. Introduction to Python

CHALLENGES

It's time to put what you've learned in the workshop to the test!

Challenge 1: String Formatting

You'll have 2 minutes to write a program that does the following:

  1. Using string formatting, write a program that outputs a string with your name and age to the console, e.g.:

    "Hi! My name is Rob and I'm 19 years old."

  2. You MUST use variables to store the values of your name and age.

Solutions will be handed out to all participants at the end of the session.

Challenge 2: Conditional Statements

You'll have 10 minutes to write a program that does the following:

  1. Gives the user an option to pick between three flavours of ice cream.

  2. If the user doesn't select anything, the program will select a different flavour.

  3. Outputs which flavour the user selected as a string, for example:

    "You chose chocolate flavoured ice cream."

The == operator can be used to check equivalence of values!

Extension

  1. Let the user select more than one flavour of ice cream, by entering a string such as "1 & 3" or "2 & 1".

  2. Parse the inputted string, extracting the two numbers, and output a sentence informing the user of their flavour selections, for example:

    "You chose chocolate and strawberry flavoured ice cream."

You can use the .split() function to split the string into a list at the '&' symbol.

Solutions will be handed out to all participants at the end of the session.

Challenge 3: Using Libraries

You'll have the remaining time in the workshop to write a program that does the following:

  1. Gives the user an option to pick between drawing three shapes, e.g. a triangle, square and circle.

  2. Draw the selected shape.

  3. If the user doesn't select anything, the program will draw a straight line.

To draw a perfect circle easily, there's a single function that does it for you! Try and find it in the Turtle documentation linked in the Resources section.

Extension

  1. Give the user another option to draw the first letter of your name!

PreviousLibrariesNextSolutions

Last updated 4 years ago

Was this helpful?