University Coursework Repository – contains Python programs from assignments.
This repository includes four Python scripts, each solving a different problem: file processing, Fibonacci numbers & primality, API data fetching, and a random SOS game simulation.
- Reads a text file given by the user.
- Reverses words and their characters.
- Creates a “mirror” transformation of the text using ASCII codes.
- Computes the n-th Fibonacci number.
- Tests if it is prime using Fermat’s primality test (20 iterations).
- Prints whether the number is prime or not.
- Fetches lottery draw results from the OPAP API.
- Iterates from the start of the month to the current day.
- Prints the first winning draw of each day.
- Asks user for rectangle dimensions.
- Fills a grid randomly with "S" and "O".
- Counts horizontal, vertical, and diagonal "SOS" patterns.
- Repeats 100 times and calculates the average number of “SOS” found.
-
Python 3
-
Libraries Used:
random
,math
,datetime
,urllib
,json
Run any script with:
python filename.py
Example:
python 2.py
Each script runs independently and prompts user input or prints results.