Contains python codes that I wrote when learning to code.
These programs were written some time ago, and as I was in the learning process, the style is not uniform. It would not be a good use of my time currently to make the style uniform.
The code here is not too interesting for Python experts, but they are for my reference and could be a source of inspiration for beginners.
- Straight-forward code examples such as returning the mean, deciding whether a point is on a given line, testing primality, returning the smallest from a list, return a string in its proper case, check if two strings are anagrams, and many more...
- Determining Arithmetic or Geometric Seq for four numbers
- Consume two lists of integers of the same length: source, and maximums. Mutates source so that every number it contains is smaller than or equal to the number at the same index in maximums.
- Simple guessing game that consumes a hidden number and number of tries available, then interacts with the player by indicating whether their input is higher, lower, or correct (or game over if all lives lost).
- Combinatorially determine how many sides can be equal in a quadrilateral form from four given points.
- A few ways to compute the intersection of two given lists.
- Compute moving averages.
- Number of loafs of bread that can be baked from given ingredients and recipe.
- Simulate a point-of-sales machine.
- Password requirement enforcer.
- Luhn's Algorithm.
- Converting base system for numbers.
- Simulate scoring system of a league.
- Represent date as a number.
- Use run-length encoding to simulate compressing data.
- Check if a sudoku has been solved.
- Determine the number of times a target string occurs in a give grid of text.
- A version of rock-paper-scissors game.
- Simple file manipulation in python.
- Manipulating csv files with csv.reader, csv.DictReader(), and csv.writer and csv.DictWriter().
- Creating a simple plot in matplotlib.
- Computing the largest edge group in a graph.
- Given the file currentMem, Remove each member with a 'no' in their inactive column. Keep track of each of the removed members and append them to the exMem file. Make sure the format of the original files in preserved.
- Use the concept of an iterator to iterate through the Fibonacci sequence.
- Setting up a LinkedList class and implementing method to reverse a linked list.
- Setting up the board for minesweeper. Allocates mines, and computes the number of safe neighbors for each square.
- Split a given array into multiple arrays of a fixed size.
- Simulates a vending machine which takes coins (Canadian denomination: nickels, dimes, quarters, loonies and toonies only -no pennies) and dispenses drinks, chips and candies. The products have different prices.
- Bubble sort, nest sort, and implementing a search function.
- Implement a Date class that can be initialized with fields day, month, and year. This can then check if two dates are equal, determine the day of the week, and whether a give year is a leap year. Can also add number of days to a date to get a new date.
- Create a Course class that takes in information about the term and the grade, and can then be used to compute term average, highest grade, etc.
- Code the game 6Nimmmt! Involes a Player class and a SixNimmt class that interacts with each other in order to simulate the game.
- Adjust a given time from one timezone to another.
- Preprocess a given text and create n-grams. Then compute the Jaccard similarity score between two n-grams. Useful for catching plagiarisms.