Code samples for AP COmputer Science Principles exam
https://www.geeksforgeeks.org/python/how-to-install-python-on-windows/
From command line:
python filename.pyFrom IDE:
- Install an IDE like PyCharm, VSCode, or Jupyter Notebook.
- Open the IDE and create a new Python file.
- Write your Python code in the file.
- Run the code using the IDE's run feature.
-
mystery.py - A simple function that checks if a number is negative and prints the result. Example for Q3 Behavior of mystery procedure with if statement from Initial test exam
-
swapListElements.py - A function that swaps two elements in a list and returns the new list. Example for Q6 Documentation for procedure with lists
-
guessNumber.py - A simple number guessing game where the user has to guess a randomly generated number between 1 and 100. Example for Q7 Guessing a secret number
-
listExamples.py - Examples of basic list operations such as creating a list, accessing elements, and modifying elements. Example for Q5 List operations
-
wordList.py - A function that removes specific words from a list. Example for Q8 Error in wordList traversal
-
smallest.py - A function that finds the smallest number in a list. Q9 Test cases for procedure Smallest
-
isPrime.py - A function that checks if a number is prime and counts the number of prime numbers in a list. Example for Q11 Use of isPrime procedure
-
rgb.py - S simple CLI game that generates random RGB values, converts them to binary, and allows the user to guess the color. Example for Q13 Color represented by binary triplet
A simple simulation of a robot moving on a grid based on user commands. Features:
- Multiple maze levels with walls and paths.
- Command-based movement of the turtle: up, down, left, right.
- Coombined GUI and CLI interface.
- Hints and instructions for each level.
- Simple animations for collisions and celebrations.
- Maze and UI rendering using turtle graphics.