Posts

Alphanumeric Codes

Image
BCD, XS3 and Gray code all are used to code digits. We know that computers today are more advanced and they also deal with alphabets and special characters. But a computer can only understand 0 and 1. So how we use alphabets on screen today? This is possible because of alphanumeric codes.
Codes that represent characters, numbers and symbols using 0s and 1s are called alphanumeric codes. There are many alphanumeric codes like Hollerith code, BAUDOT code, etc. But these are outdated and no longer serve in any computing systems. So, we will see the few which are interesting to learn about and are still in use. Let's check some, together!
Morse Code This is the first telecommunication code which uses electronic signals to identify messages. Morse code is based on pulse width, short pulse (a dot) and long pulse (a dash). It was named after Samuel F. B. Morse.  Letters are represented by combination of dot and dash.
ASCII Code ASCII, American Standard Code for Information Interchange was …

Data Types in Python

What are data types? As the name suggests, it is the type of data. A data type can be defined as the data storage format. To specify what value does a variable holds and how the user wants to manipulate it. Some common data types are Integer, String, Boolean etc.
What are variables? We have seen variables in mathematics; a quantity that is assumed to vary. In programming, variables are names of items whose value may vary through out a program. They are used to store values.  In Python, we do not explicitly declare a variable with its data type. We only assign a value to it. Based on that value, declaration happens automatically.  Values are assigned using equals sign (=). Like this,
>>>a = 10
Let's check out what different data types Python have in stock. Data types in PythonBasic data types available in Python are: NumberStringListTupleDictionaryBesides these, Python also offers Set and Boolean types. I don't like my blog posts getting too long. And I also know you don&…

Saraswati : The Lost River

Image
Triveni Sangam is a Sanskrit word for confluence of three rivers. In Allahabad, there is one such Triveni Sangam. It is one of the most sacred holy places of India. It is believed by many that a bath here flushes away all of one's sins. But surprisingly, only two rivers meet here and they are Ganga and Yamuna. Question arises, which is the third river. “Saraswati, the invisible.” they reply.

Where is Saraswati?Saraswati is mentioned many times in Rig Veda. Initially the word refers to the Saraswati River. It is then described as a river deity. Best of mothers, best of rivers, best of goddesses, SaraswatÄ«.– Rigveda 2.41.16In Vedas composed after Rig Veda, the meaning of word evolves from “water that purifies” to “knowledge that purifies”. Hence, Saraswati remained significant as a goddess of knowledge, music, art, wisdom, learning and anything whose flow purifies the essence and self of a person.
Later Vedic texts mentions that the river dried up in a desert (Thar Desert). Saraswati …

What if...

Image
What if... I'm scared.
What if you judge me
When I show you my flaws.
What if you distrust me
When you see my scars.
What if you hate me
When you know my past.
What if you leave me
When I've made you my Life.
And if you're going to kill my feelings
please do not gift wrap the knife.

-Azna
<- Wings To Dust

input() and raw_input()

In Python 2.x there are two functions for input.  input(): Takes expression as input. If you typed in 2+3 and print. It will show 5.raw_input(): Takes string as input. For above example, output will be '2+3'. However, we can change its data type later. Python 3.x has eliminated input() and named raw_input() as input(). Basically it has only one function for taking data from user and that is input() explained below.  (If you are using Python 2.x you can refer below description for raw_input(). It works the same.) input( ) This function takes input as a string. If you want input in other formats you need to convert them to respective data types.

>>>input()
Type this in script mode and you'll see a cursor blinking in the next line. Input text is entered here. But where does it go?  You better do this!

>>>a = input() Input string
Now, the input is stored in variable a. Let's print it and check if that's true.

>>>print a Input string
Yeah. It wo…

Coding Digits

Image
Hello people. I hope all are doing great!
What are codes? We all know that computers don't understand our language. Be it English or Hindi or anything. They only work with 0's and 1's. So all our messages needs to be converted in a manner that machines can interpret it. That is code! We all learnt code long ago. Girls will get this. Remember when in school. We all used a secret word to name our crush. Only the best friend knows what it is. Also, there were some girls who used a keyword that is to be placed before and after every word in a sentence. And then they talk in public privately. Like 'en' is the keyword then 'entheen ensentencen enwillen enlooken enlikeen enthisen' That's exactly what we use code for - Secrecy.
Let's check out some secret codes for a computer.
BCD (Binary Coded Decimal) This is the simplest one. Every decimal digit is replaced by its binary equivalent in four digit.
Let's take the number 81.
8 in binary is 1000
1 in bina…

Print in Python

Hello people,
We have already seen how to print in Python in the previous post. Still there's more that you can do with print function.
Pass a string with * and integer value. You get it printed the times specified. For example,

>>>print ("Hi " * 3) Hi Hi Hi
You see Hi is printed 3 times here. If you pass integer this way, the output will be its product. However, in Python 3 and above an integer value is also printed multiple times using this technique.

Printing variables in python is also easy. Just pass the variable name in print method.

>>>n=7
>>>print (n) 7
You can write string along with variables using {} braces. Entire string should be followed by .format function which has variable names to write in place of {}. Values can also be used in .format function. Try this and you will get what I mean.

>>>n = 3
>>>print ("Python {}".format(n) ) Python 3
For a format with multiple parameters they are placed re…