Skip to content

Weekly python scripting tasks of escalating scope and difficulty.

Notifications You must be signed in to change notification settings

CianGallagher/pands-weekly-tasks

Repository files navigation

pands-weekly-tasks

Weekly Scripting Tasks

Spring Semester 2024 - Programming and Scripting

Weekly task 02

bank.py

- This code takes two user inputs representing amounts in cents, adds them together, converts the sum to euros by dividing by 100, and then prints the result in a formatted string displaying the total amount in euros.

Weekly task 03

accounts.py

- This code defines a function that redacts an account number by replacing all but the last four digits with 'X'. It then prompts the user to input an account number, calls the function with this input, and prints the redacted account number.

Weekly task 04

collatz.py

- This code defines a function that redacts an account number by replacing all but the last four digits with 'X'. It then prompts the user to input an account number, calls the function with this input, and prints the redacted account number.

Weekly task 05

weekday.py

- This code defines a function that checks if the current day is a weekday or a weekend. It retrieves the current day of the week as an integer (0 for Monday through 6 for Sunday) and prints a message indicating whether it is a weekday or the weekend.

Weekly task 06

squareroot.py

- This code defines a function to approximate the square root of a number using the Newton-Raphson method. The function iteratively refines the guess for the square root based on a specified tolerance and maximum number of iterations. It then tests the function with a sample number and prints the approximated square root.

Weekly task 07

es.py

- This code reads a text file specified as a command-line argument, counts the occurrences of the letter 'e' (case insensitive) in the file, and prints out the count. It utilizes the sys.argv to capture the filename passed as an argument when running the script.

Weekly task 08

plottask.py

- This code generates 1000 random numbers following a normal distribution with a mean of 5 and a standard deviation of 2 using NumPy. It then plots a histogram of these random numbers with 50 bins. Additionally, it plots the function h(x)=x3h(x)=x3 over the interval [0, 10] using Matplotlib. Finally, it adds labels, a title, and a legend to the plot and displays it.

About

Weekly python scripting tasks of escalating scope and difficulty.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages