From d2938f6f5a3f03ef4ca58ec1ad73b208d210a907 Mon Sep 17 00:00:00 2001 From: Teodor Muzychuk Date: Wed, 4 Oct 2023 14:34:14 +0300 Subject: [PATCH] add week3 github homework --- homework/github_week3/README.md | 64 ++++++++++++++++++++++++++++++ homework/github_week3/fibonacci.py | 46 +++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 homework/github_week3/README.md create mode 100644 homework/github_week3/fibonacci.py diff --git a/homework/github_week3/README.md b/homework/github_week3/README.md new file mode 100644 index 0000000..73b67a8 --- /dev/null +++ b/homework/github_week3/README.md @@ -0,0 +1,64 @@ +# Week 3 Homework: Git & GitHub + +Welcome to week 3 of Linux Club! This week, your homework is to be done in-class, in teams of 3-4 people. + +## Task + +We have prepared a template of a tiny Python project in this directory, in the file `fibonacci.py`. Your task here is to take a number as input from the user and print the corresponding number of Fibonacci terms. The catch is, you have to use the [nth term formula](https://r-knott.surrey.ac.uk/Fibonacci/fibFormula.html). This formula is to be calculated using the functions defined in the Python file. + +## Steps + +The instuctions for completing the assignment are as follows: + +1. Fork the [Linux Club repo](https://github.com/ucu-computer-science/UCU_Linux_Club) to your GitHub profile. +2. Add collaborators to the repo on GitHub (split into teams of 3-4 people) +2. Clone the repo to your machine + +```{bash} +git clone +``` +3. Each person should create their own branch to make changes + +```{bash} +git branch ; git checkout +``` +4. Split the tasks up between the members of your team +4. Each person navigates to the homework directory and does their task +5. Each person pushes their changes to their branch in the repo + +```{bash} +git add . +``` + +```{bash} +git commit -m "commit name" +``` + +```{bash} +git push origin +``` + +6. Pull the changes made by others from GitHub + +```{bash} +git pull origin master +``` + +6. Checkout to main branch and merge your changes + +```{bash} +git checkout master +``` + +```{bash} +git merge +``` + +7. Push the master branch to GitHub + + +```{bash} +git push origin master +``` + +8. Create a pull request to the main repo. diff --git a/homework/github_week3/fibonacci.py b/homework/github_week3/fibonacci.py new file mode 100644 index 0000000..804f1de --- /dev/null +++ b/homework/github_week3/fibonacci.py @@ -0,0 +1,46 @@ +""" +This is a Python script that takes a number as input from the +user and returns the corresponding number of Fibonacci terms. +It uses the formula for the nth term of the Fibonacci sequence +and functionally decomposes the calculations. +Fill in all the missing code in the functions and in main +""" +import typing + +def get_input() -> int: + """Gets input from the user and returns it as an integer""" + pass + + +def fibonacci_list(n: int) -> typing.List[int]: + """Returns a list of the first n Fibonacci numbers""" + pass + + +def fibonacci_single(n: int) -> int: + """Returns the nth Fibonacci number""" + pass + + +def golden_ratio(n: int) -> float: + """Returns the golden ratio, used in calculations""" + pass + + +def power(num: int, n: int) -> int: + """Raises num to the nth power""" + pass + + +def sqrt(num: int) -> float: + """Returns the square root of num""" + pass + + +def main(): + """Main function""" + pass + + +if __name__ == "__main__": + main()