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:"))
print("the number is less than 100")
Else statement:– This is used when the (if)statement is not fulfilled.
number= int(input("Enter a number:")
print("The number is less than 100");
print("The number is greater than 100");
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.
These are the symbols which tells the python interpretor to do the mathematical operation.
To get floating results we need to use the division using any of operand as the floating number. To do modular operation use % operator.
I am reading the book Linux for you and me, and some of the commands I got to know and it's work!!
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
You can use this method for swapping two numbers.
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
Formatting a string
Let us now see different methods to format 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
none continue for
true def from
and del global
as elif if
assert else import
break except in
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.
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.
number=int(input("Enter an integer:"))
print("Your no. is smaller than 100")
print("Your number is greater than 100")
Enter an integer: 13
Your number is smaller than 100.
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
– 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 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).
I was scrolling my social media account (fb) and suddenly saw a post of a song of a very old cartoon NODDY!
Oh my god! It instantly lifted my mood and made me smile, these 90's cartoons back then really made our childhood so memorable. We grew up seeing these and back then I felt that the world was too simple, colorful, bright and easy. That's why I always wanted to grow up so fast and wanted to be out and wander freely like those cartoon characters. But sadly growing up is not at all fun, we have to grow up and work ourselves but somewhere I miss that innocence among people which we shared while being children, people are now self-centered. I often participated in singing competitions and did not thought what people will think if I made a mistake. But growing up really makes self-conscious again, about being judged. Still, here it is the life cycle goes like this, being responsible and taking care of your parents and hence, it continues! But why are people now selfish, dirty games and politics and yet we deal with it and move on.