---
# System prepended metadata

title: 'Summary of Week Four Activities at the Blockfuse Labs:'

---

# Summary of Week Four Activities at the Blockfuse Labs:
# Vim and Python3

The week started on a very educative, interactive and busy mode. The courses for the week included a deeper dive into Vim Commands(because we had previously been introduced to the basics).

**VIM**
Vim stands for Vi IMproved; what this means is that it is an improved version of the Vi text editor. 
Vim is "a highly configurable text editor built to make creating and changing any kind of text very efficient" (vim.org) It retains all the powerful features of the Vi text editor but adds many improvements and features. 
We got to understand that there are many features to  vim than just an ordinary text editor and many ways it can be used and accessed. The vim environment is known as a "***buffer***". It is where typing, editing and other related  stuffs happens. 

***Vim Modes and Commands***
***Normal Mode:*** The Normal mode is also known as the navigation. It is the default mode the user encounters when he enters the vim environment. Most text-editing happen in this mode which makes it the primary vim mode. 

***Insert Mode:*** Aside the general use of ***i***  command to start typing and editing content on your vim environment or buffer, we can also achieve the same result using by pressing/clicking the following Alphabet keys: ***a, s, o***, and also the ***insert*** button on our PC to switch to insert mode. To exit this mode to the normal mode, just press the 'esc' key. 

***Command-Line Mode:*** The command-line Mode is used to perform commands such as to save/write (:w), save and quit (:wq), and even to set number (:set number). To enter this mode from the normal mode, just type the column symbol (:) and the command you wish to perform. 

***Visual Mode:*** this mode is used to highlight and edit text in bulk. The user can type ***v*** to set to this mode, ***y*** to yank the highlighted text and ***p*** to paste or put the content on the designated part of the file you wish. 

We also learnt different commands used to navigate the buffer, such as ***ctrl ww*** to navigate between split screens, ***vsp*** to vertically split the screen, ***sort ui*** to sort contents alphabetically, ***gg*** to navigate to the top of your file, ***G*** to navigate to the bottom, ***:edit (fileName)*** to creates a new/ opens a file without exiting your buffer, ***:pwd*** to view your present working directory, and many other such commands. 
    Also, to know the number of files opened by the user, type "buffers" and it will display the number of files opened. The active buffer is denoted by the % symbol, while the preceeding file is denoted by # symbol. 

***In-built Commands and Executable Files:*** 
    
*In-built commands* are functions and are not executable  files. They come by default and are not installed by the user. For instance, in Vim, commands like ***:w*** (write), ***:q*** (quit), ***dd*** (delete), ***yy*** (yank), etc., are in-built. That is, they work right away without any extra setup by the user. Also, commands like ***cd, echo, and help*** in bash are in-built into the shell itself.
    
*Executable files* is a standalone file or program that can be run directly by the operating system. For example, there is the bin, usr, ls etc. It is worth noting that to use a command that is not in-built on the vim environment, it must be preceeded wth an exclamation mark ***!***. For instance, chmod is not  an executable file; so to make a file executable on the buffer, the user should type ***!chmod u+r name_of_file***. 
    
**MACRO**

In simple term Macro means recording (on your text editor -Vim) and playing what you have recorded to others. To enter the record mode, simply type ***qa***. This will start recording @a and to stop recording, click ***q*** to quit. After recording, to play on the other lines of code you want replicated, press the number of the start line with the number of the stop line, then type normal @a and enter to apply (example: ***2,10 normal @a***  -to apply from line 2 to line 10). 
*Example:* 
 Using macro change the dates below to: 
Year: 2025 | Date: | 01 | Month: 07
  2025 30, 06
  2025 15, 05
  2025 01, 04
  2025 02, 03
  2025 01, 02
  2025 28, 01
 The outcome is displayed on this code snippet: ![Macro_](https://hackmd.io/_uploads/SksUzEdHle.png)

**PYTHON**
Python is a programming language that lets you work quickly and integrate systems more effectively. Python is an interpreted, highlevel language. The file a programmer writes his code is called a source code. 
Python language is beginner friendly and canbe written in two ways: 
*   interactive mode whereby the user writes the code on the terminal but it gets deleted as soon as the user exit and the interactive mode takes in valid commands; and 
*   Scripting mode which means writing your Python code in a file and then running that file as a program.
We also learnt that in python, variables are memory locations that stores value. A variable can begin with an underscore  ***_*** or a letter but never numbers. 
Python extension ends with .py (script mode). 

**Uses of Python Language** 
Python language is used in the following: 
*  Web development e.g Django for robost applications, flask and fast API among others.
* To create AI
* Create games e.g py games
* Data analysis etc. 
    
**Data Types in Python**
These includes: 
    Strings
    Integers
    Booleans
    Numbers
    Floating-point numbers
    
Note that any data-type presented as input is automatically a string. To convert to  an integer for instance, wrap it with int(input). To know the data type, do: print(type(data))
    
Example: 
    ![TypeOf](https://hackmd.io/_uploads/rkx9QLS_Hll.png)
    

We were introduced to python list and dictionary. 
The List can take in any data type and is enclosed in a square bracket. Example: [12, True, "Joy", 'James']. While the the dictionary is a key and value pair and is enclosed in curly brackets{}. For example
userName = "John" whereby, the userName is the Key and John is the value. 

**Vital Summary on Python**
Note these Reserved Keywords in Python (that is, words you are not allowed to use in python programming language): print, import, input, if, def, else, elif, type. 
    
* In Python, variable names are case sensitive for example, when you assign a value to 'a', you can't     call on 'A'.
* Always use a good variable name. 
* Always use comments in your codes. For multiple comments, use the '''  ''' while for single line comments, use #
This is presented below: 
    ![Comments](https://hackmd.io/_uploads/ryC1CS_Slx.png)

**CONCLUSION**
The week was indeed an eventful one and full of different activities. The mentor was simply wonderful and very patient and I know that with constant practice and research, these languages will become second nature to me. I look forward to deeper dives into Python language and the possiblities it holds. 