## Week 6: Git and Github, Assignment Operators And Comparison Operator in Python
> By *Akinlade* *Temitope* *Victory*
This past week kicked off with an introduction to version control with git and remote repository using github.
Git was defined a tool that helps you track changes on project overtime while Github is a website where you can store and share your Git tracked projects online
The instructor directed the class on how to install git, set it up and have it synched to github. It started off by installing git for ubuntu linux from the url(Unified resource locator) below:
>https://git-scm.com/downloads
Then, from the terminal, we typed the command "git --version" to see the current version of git installed
Had git set up locally for the first time by running the below commands:
>git config --global user.name "Your Name" git config --global user.email "your@email.com"
Ran the command:
>git config --list
to confirm your inputted details which are username and email.
Generated a new SSH key pair with the command the below:
>ssh-keygen -t ed25519 -C "email"
Managed the SSH private keys with the below command:
>eval "$(ssh-agent -s)"
The above is needed so you don't have to type your SSH key passphrase everytime you use the key
We then added a private key to the running ssh-agent with the below command:
>ssh-add ~/.ssh/id_ed25519
Next we were instructed to run the below command:
>cat ~/.ssh/id_ed25519.pub
The above prints out user's ssh key which was copied manually from the terminal.
Proceeded to creating a remote repository account using Github via the url(Unified resource locator) below:
>https://github.com
Signed up with email, verified it, then set up a username and password
Afterwards, went to the settings section then to SSH and GPG keys sub section, clicked on "New SSH key", on the title input, gave it a name e.g Ubuntu Desktop and then pasted the previously copied SSH key and finally click "Add SSH key"
Then proceeded to create a repository to push our first project and named it while giving no spaces but with underscores and dash e.g "my-first-project", "my_first_project"
Afterwards, we uploaded our local codes to github by firstly initializing git with running the command:
>cd your-project-folder
>git init
Afterwards, we added and committed our files by running the commands:
>git add . (adds all files in current working directory)
>git commit -m "My first commit"
Checked the states of the files added by running the command:
>git status
Added remote Github repository by running the command:
>git remote add origin git@github.com:your-username/your-repo.git
Pushed to Github by running the command:
>git push -u origin main (to push to the main branch)
or
>git push -u origin master(to push to the master branch)
Those were the steps we took to push our first project successfully to github
### ASSIGNMENT OPERATOR
Later in the week, we fell back to python after Git and Github class and was introduced to assignment operators even though we have been using the equal to(=) sign to assign values to variables before now.
The new assignment operators we were introduced to performs arithmectic operations on a variable and assign value from that operation to same variable. The idea was to simplify something like the syntax below:
```python=
number = 7
number = 7 + 1
print(number)
OUTPUT: 8
```
to a more simpler syntax like the below:
```python=
number = 7
number += 1
print(number)
OUTPUT: 8
```
The above adds 1 and to the intial value of 7 and store it in the variable named number unlike the previous that had to state the value of number first before adding 1 to it.
You can do same for substraction, multiplication, division, floor division, modulo, exponential and the syntax goes like this:
```python=
number = 6
number -= 1 # substraction
print(number)
OUTPUT: 5
number = 6
number /= 2 # division
print(number)
OUTPUT: 3.0
number = 6
number *= 2 # multiplication
print(number)
OUTPUT: 12
number = 6
number //= 2 # floor division(to the nearest integer)
print(number)
OUTPUT: 3
number = 6
number **= 2 # exponential
print(number)
OUTPUT: 36
number = 6
number %= 2 # modulo
print(number)
OUTPUT: 0
```
### COMPARISON OPERATORS
After assignment operators, we moved further to comparison operators which basically returns a boolean(True or False) and it is a preparation for our conditionals and loop class that will be kicking off in the new week. These operators compares the value of the left to the value on the right and the syntax is something like the below:
```python=
number = 1 > 2 # greater than
print(number)
OUTPUT: False
number = 1 == 1 # equal to
print(number)
OUTPUT: True
number = 1 < 2 # lesser than
print(number)
OUTPUT: True
number = 6 >= 6 # greater and equal to
print(number)
OUTPUT: False
```
### CONCLUSION
It was thrilling working with git and github as it's really resourceful and looking to do more with it while being introduced to assignment operators makes working with integers and floats more easier. The week was well spent and i am looking forward to i will learn in the new week. Thanks for sticking till end of this article! See you soon.