darshna

A few months ago I came to know that pycon was happening in Chennai on the month of October, and I realized that attending this year's PyCon is necessary. Deep down I knew that after returning from Pycon I'll not only make new connection and potential people but also it'll change my perspective about the open-source world(in a good way). Also this was my first time that I'll be moving out from my home town, I asked mom that this will be a great opportunity for my exposure of life and experience, as unfortunately there's not much stuff happening in my college(except mass bunking and unnecessary gossip). And my Durga puja was over, packed my bags and left for Chennai. After 27 hours of a long journey, I reached the station, where communicating with people was a bit tough, but my ecstasy was unlimited of meeting that part of India(South). I couldn't sleep that night, I woke up early morning and got ready and reached the venue with one of my folks (@priyankasaggu) from dgplug. When I reached there I was amazed at the crowd which gathered there, I took my id card, and went in the venue, people were everywhere are. Earlier I didn't notice that goodies were being distributed if you play quiz from the respective booths of sponsors. At the evening after the event got over we (dgplug) members went to beach and spent some good time together. It was day 2 and coincidently I met some new friends who were from Kerala and thet were of my same batch and of same stream. So, I attended the keynote speaker who was Ines Montani, and yeah I did not understand everything as clear as water but yes, I did get an idea. And at the end of the day, we all the folks of dgplug went for dinner and enjoyed our meals and some quality time together.

Overall, my experience if I rate out of 10, it will 10/10...yeah every penny i spent to come here, every hour of my journey I spent to come here was worth it...Before coming to PyCon 2k19, I asked myself that none of my friends came from my college.. will it be worth it? Now I know yes it was worth it!

Here we will get to know about the If-else, control flow.

As the name says (if) it simply applies the condition applied to it. If the value of the expression is true, the command works according to it. #!usr/bin/env/ python 3 number= int(input("Enter a number:")) if number<100 print("the number is less than 100")

Else statement:– This is used when the (if)statement is not fulfilled.

#!usr/bin/env python3 number= int(input("Enter a number:") if number<100 print("The number is less than 100"); else print("The number is greater than 100");

Be who you are, not who others tell you to be.

The above quote clearly replicates confidence and self-love. We somehow get affected by the negative comments and judgments passing by and try to change ourself so that people would accept us the way we are. Finally, when we arrange ourselves for the people to accept us there is again a judgment passing by and yet again we try to change ourselves. In the end, we forget the real us and be a toy for people's satisfaction. as we grow old we realize that we have left the true selves way back and been another person. Fat-shaming or Body shaming, being a dark-skinned girl or being extra bold even wearing a dark lipstick at daytime, or wearing clothes of your own choice attracts people's attention more than taking care of social and devastating issues happening day-to-day. Have you ever heard someone saying that look at the person who threw the packets on the side of a road or look at the person who is pissing at a public place, why aren't they ashamed? Yes, I am healthy and have a unique body shape that maybe most girls don't have or most guys make fun of it. So what? yes I am like this and I am proud of it but you will ignore it once or twice or maybe thrice. Ignorance is not a solution the mentality should be changed, and it can only change if people start teaching their children the value of respect and acceptance, acceptance of people as they are. That obviously doesn't include the acceptance of wrongdoings and violent nature of some people, but accepting the things to make this a society and a better place to live. Only then we can stand together and build a healthy community.

After so many days I am continuing with Python again. Yes, I was not able to maintain the series properly, but let's get back to work and know what I read next in Python from the book of PYM. In Python most of the lines will have expressions and these expressions are made of operators and operands.

Operators

These are the symbols which tells the python interpretor to do the mathematical operation.

2+3
5
22.0/12
1.83333

To get floating results we need to use the division using any of operand as the floating number. To do modular operation use % operator.


#!/usr/bin/envv python3
days= int(input("Enter days:"))

month= days/30
days= days%30
print("Months= %d days= %d %(month, days))

Relational operators

operator ## meaning

< is less than > is greater than <= is less than or equal to >= is greater than or equal == is equal to != is not equal to

Note: // operator gives floor division result.

4.0//3
1.0

4.0/3
1.33333

Logical operator

To do a logical AND, OR we use these keywords.

I am reading the book Linux for you and me, and some of the commands I got to know and it's work!! Gnome Terminal Here in this terminal, we write the commands.

For example: [darshna@localhost~]

Here Darshna is the username, localhost is the hostname and this symbol `#~ is the directory name.

Following some commands are: * date command= tells us about current time and date in IST(Indian standard time) * cal command= displays the default present calendar. * whoami command= tells which user account you are using in this system. * id command=displays real user id. * pwd comma= helps to find the absolute path of the current directory. * cd command= this command helps you to change your current directory.

#Did you know? We can assign multiple assignments in a single line.

For example:a,b = 10,20
a=10
b=20
You can use this method for swapping two numbers.
a,b=b,a
a=20
b=10

To understand how it works, we need to understand a datatype called tuple. We use a comma, to create the tuple; in the right-hand side we create the tuple(called tuple packing) and in the left-hand side we do tuple unpacking into a new tuple.

Let us take an example tp understnd more clearly.
data=("Darshna Das, West Bengal, Python")
name, state, language=data
name=Darshna Das
state=West Bengal
language=Python

Formatting a string Let us now see different methods to format string. .format method

name="Darshna"
language="Python"
msg="{0} loves {1}". .format(name,language)
print(msg)
Darshna loves Python.

Interesting fact In Python 3.6 a new way to do string formatting introduces a new concept called f-string.

name=Darshna
lanuguage=Python
msg=f"{name} loves {language}
print(msg)
Darshna loves Python.

f-strings provide a simple and readable way to embed Python expressions in a string.

In continuation with the last blog, we now proceed with the following topic.

Variables and Datatype Following identifiers are used as reserved words, or keywords of the language, and cannot be used as ordinary identifiers. They must be typed exactly as written here:

false                   class              finally

is                         return            

none                    continue        for

lambda                  try             

true                       def                  from

non-local              while

and                        del                   global

not                        with

as                           elif                  if

or                           yield

assert                     else                 import

pass

break                     except               in

raise

In Python, we don't specify what kind of data we are going to put in a variable. So, we can directly write abc=1 and abc will become integer datatype. If we write abc= 1.0 abc will become of floating type.

Eg:-
a= 13
b=23
a+b
36

From the given example we understand that to declare a variable in Python we just need to type the name and the value. Python can also manipulate strings, they can be enclosed in single quotes or double-quotes.

Reading input from keyboard Generally, the real-life Python codes do not need to read input from the keyboard. In Python, we use an input function to do input(“string to show”); this will return a string as output.

Let us write a program to read a number from the keyboard and check if it is less than 100 or not.

testhundred.py
#!/usr/bin/env python3
number=int(input("Enter an integer:"))
if number<100:
print("Your no. is smaller than 100")
else:
print("Your number is greater than 100")

output:
$ ./testhundered.py
Enter an integer: 13
Your number is smaller than 100.
$ ./testhunderd.py
Enter an integer: 123
Your number is greater than 100.

This is the continuation of the Python learning series from the book Python for you and me.

Modules – These are Python files that contain different function definitions or variables that can be reused. These files are always ended with the .py extension.

For writing any language you need an editor, similarly here we use mu editor which was developed by Nicholas Tollervey. For installation, the total download size is around 150MB. We can open the editor from the command line type mu in the terminal. Give the following command line, type mu in the terminal

python3 -m mu

Executing Code – Write your code you want to execute and save it. – Use a proper file name. ( end it with .py) – Click on the run button to execute the code. – If you want to a REPL, then click REPL button.

NOTE: Do not give any unnecessary space in the file name, use _ if required, for an example download_photos.py

I have just started with Python, from the book Python For you and me!

Some basic guidelines I have jotted down. The first program to print the “Hello World !”

print ("Hello World!") = Hello World !

While writing this above code, we write it into a source file. We can use any text editor. For example:

#!/usr/bin/env python
print ("Hello World!")

On the first line, we use (#!), which is called she-bang. In python, this indicates that it should be running the code. The lines of text in python is called “strings”.

Whitespace at the beginning of a line is known as indentation, but if we use the wrong indentation it shows an error.

Basic Rules For Indentation!

  • Use 4 spaces for indentation.
  • Never mix tabs and spaces.
  • One blank line between functions.
  • Two blank lines between classes.

Always give a space after # and then start writing commands.

I learned about open-source when I got involved in a community called #dgplug, the full form states that Durgapur (Dgp), Linux(l), user's(u), group(g). Here we, folks are taught about open source systems and how can we work on Linux and other open-source software. Now for working on Linux, you need to install another operating system, before I always used Windows. I got involved in the channel's conversation but until an, unless if you aren't doing it practically on your computer or laptop its not helpful. Then I was suggested by some folks in the channel that I can dual boot my system, which means having two operating systems on the same computer. It was quite tricky for me because I had to see both the pros and cons, as I don't have a very advanced computer, just having RAM of 2GB might make things slower. but I had to take a step because I had to learn about Linux. Unfortunately, my computer broke down and I wasn't able to work on it for at least a week or two. But I asked my repairer if he can dual boot it too while repairing it. Initially, he too didn't know much about installing fedora and was not sure if my computer will work after this, but luckily things got better and successfully he installed Fedora 20( i need to upgrade this, this a very old version).