---
# System prepended metadata

title: 'Week 4: Vim, Introduction To Python'

---

# WEEK 4: MORE ON VIM AND INTRODUCTION TO PYTHON

> By Akinlade Temitope Victory

In the beginning of the week, i was firstly shown how to navigate the text editor vim better by switching between it's different modes which are the:

1. Insert mode
2. Visual mode
3. Command line mode
4. Normal mode

Afterwards, the instructor directed us on how to use the keyboard to navigate the interface swiftly with commands like:

1. gg (to go the uppermost part of your text content)
2. G (to do the opposite of gg)
3. j (to go below to just the next line at the bottom)
4. k(to go upward to just the next line above)
5. l (to go right)
6. h(to go left)

7. To copy and paste text content, you have to switch back to normal mode with escape key (esc) then use the upward,downward,left and right key to highlight the text content you which to copy, then press the letter y to yank(copy) and then p to put(paste) at the desired location

8. Escape(esc) to normal mode then type in **split** and filenames to have two documents horizontally while using control(ctrl) and ww to swicth between documents. 

9. Escape(esc) to normal mode then type in **vsplit** and filenames to have multiple documents vertically while using control(ctrl) and ww to switch between documents.

10. We were then introduced to the concept of MACRO which is the process of recording text patterns and playing the record to get same pattern in desired areas and it start by using the command **qa** to start recording desired text pattern while the command **q** to quit recording then typing the line numbers you wish to replicate same text pattern then normal and the at symbol then the alphabet a to get result e.g

> 2,10 normal @a 

After wrapping things up with the basics on how to navigate vim, we were introduced to the programming language called python. The instructor started by stating that python is an interpreted language in the sense that it executes line by line unlike a compiled language that compiles every line of code before executing all at once. 

He told us to run the below commands on the terminal to install python3: 

> sudo apt update 
> sudo apt install python3

Then afterwards we were introduced to the two modes in which we can write our python syntax which are:

1. Interactive mode which you can enter by just typing python3 on your terminal 
2. Scriptive mode which you can enter by creating a file with the .py extention and editing the file on a text editor

You can enter python syntax in both modes but the interactive mode does not save codes to be reused as it all dissappears whenever one exits it.

The instructor went further to introduce us to some data types in python which are: 

1. Strings (text)
2. integers (whole numbers)
3. float (Decimal numbers)
4. List (a collection of orderly arranged values that can be duplicates)
5. set (a set is a collection of unique items that can't have duplicates)
6. Dictionary (A dictionary is a collection of key value pairs)


In the above, we have worked with the first three which are strings, integers and floats and as tradition demands, we wrote out first python syntax by creating a file with the extention .py and printing to the screen HELLO WORLD by entering the syntax:


> print("Hello World")


After writing the above syntax on vim which we used as our text editor, we saved and quit back to the terminal and used the syntax: 

> python3 (name of the file with the extention .py) to execute and get "Hello World" printed to the screen. 

We were later on introduced **variables** and from his explanations, i deduced that they are containers that stores data that can be reused and then the **input** command which is collect data from the user preceeding it with the exact data type we want from the user if it's not the default data type which is a string. We were later given a task to collect the following datas from the user: 

1. Users should enter full name 
2. Users should enter thier height 
3. Users should enter thier age
4. Users should enter their marital status which should be a boolean value of true or false
5. Then print out each data type of the values entered by the user


I did the above but the boolean part was quite tricky as it was taking any input from the user as true until i created a variable that directly compares the user's input to the value "true" before printing out the output. 


**CONCLUSION**
It was a thrilling experience getting to see the things that could be done with python and i am excited to see what the new week holds. 

Thanks for reading! 
See you soon!