What are Strings in Python

It’s a Sequence, a Sequence of Characters Can access the characters using the braket operator >>> fruit = 'banana' >>> letter = fruit[1] >>> print(letter) a You get that fruit[1] is a, the second letter in the string. Remeber counting starts from 0 in Python. the number inside the bracket is called the index. Indeces can be negative. But index $\in [-length+1, length -1]$. len is the built-in function which gives the length of a string....

March 7, 2021 · 4 min · Harsh Kumar

How to Iterate in Python

The while loop It allows you to repeat a set of actions until a statement is true. Eg: n = 5 while n > 0: print(n) n = n - 1 print('Blastoff!') This is executed as follows Creates and sets n to 5. Goes to the while statement and checks if n is greater than 0. Right now it’s true, so we move inside the loop. Prints n, ie outputs 5....

March 4, 2021 · 3 min · Harsh Kumar

Learning Python: Functions

What is a Function A function takes a set of inputs and produces an output. Eg: >>>type(32) <class 'init'> Here type is a function that takes 32 as an input and produces its class. Some Built-in functions max : gives the “largest character” in the string >>>max('Hello world') 'w' min : gives the “smallest character” in the string >>>min('Hello world') ' ' len : gives the number of characters in the string...

March 3, 2021 · 3 min · Harsh Kumar

Creating This Website Using Hugo on Windows 10

This post describes the creation process of this website. I have used the popular static site generator Hugo. Hugo is based on the language go. Disclaimer: this is the second time I am creating my website using Hugo. But the last time I created this was in 2015, so a lot has changed. Installing Hugo on Windows 10 My recommendation is to use Chocolatey to install Hugo although there are binaries available at github for direct installation....

February 28, 2021 · 3 min · Me

FranklinFail

My Failed Attempt at Setting Up This Website Using Franklin (On Windows) I will be using Franklin based on Julia because I wanted to learn Julia I wanted to use markdown (or somethng similar) with LaTeX support automatically I wanted to see if the promises of KaTeX rendering hold water Code highlighting was another bonus Installing Julia on Windows 10 To do this I first installed Julia using Chocolatey with the command...

February 27, 2021 · 3 min · Me