Introduction to Python Programming

What is Python

Python is an interpreted,  object-oriented, high-level level programming language with dynamic semantics. Python was developed by Guido Van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands.

Features of Python:-

  • Less line of codes than other languages (fast execution of Ideas)
  • Platform independent
  • Open Source
  • Object Oriented
  • It supports functional and structured programming methods
  • It can be used as a scripting language or can be compiled to byte-code for building large applications
  • It provides very high-level
  • level dynamic data types and supports dynamic type checking
  • It supports automatic garbage collection
  • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java

What big companies use Python?

  • Google (Youtube)
  • Facebook (Tornado)
  • Dropbox.
  • Yahoo.
  • NASA.
  • IBM.
  • Mozilla.
  • Quora

Google written in Python?

Google App Engine is an eminent sample of Pythonwritten application, it allows
building web applications with Python programming language, using its rich collection
of libraries, tools and frameworks. Python is everywhere at YouTube.
code.google.com – main website for Google developers.

Is Python for web development?

Python can be used to build server-side web applications. While a web framework is not
required to build web apps, it’s rare that developers would not use existing open source
libraries to speed up their progress in getting their application working. Python is not
used in a web browser.

What is the framework for Python?

“What is a web framework?” is an in-depth explanation of what web frameworks are
and their relation to web servers. Django vs Flask vs Pyramid: Choosing a Python Web Framework contains background information and code comparisons for similar web applications built in these three big Python frameworks

Installing Python in Linux:

If you are using Ubuntu 16.10 or newer, then you can easily install Python 3.6 with the following commands:

$ sudo apt-get update
$ sudo apt-get install python3.6

To see which version of Python 3 you have installed, open a terminal and run

$ python3 --version

 

py.png

If you are using other Linux distribution, chances are you already have Python 3 pre-installed as well. If not, use your distribution’s package manager. For example on Fedora, you would use dnf:

$ sudo dnf install python3

For more: Refer to this link.

Installing Python in Windows:

How to start the Python?
First of all install the Python 2.7.12 on your system. After installation it will create a
directory in C: drive named Python27. In Python27 there is a file python.exe. Copy the path of python.exe from address bar.

To set the path of python in “path” system variable:

  1. Copy the path of python.exe from address bar.
  2. Right click on Computer then click on Properties
  3. Click on Advanced System Settings then click on Environment Variables.
  4. Choose path variable and click on Edit button.
  5. Deselect the path and stuff a semicolon at last and paste the copied path.
  6. Now click on OK button.

First Python Program:-

Open the command prompt, type python and press enter key. The python prompt will open. Now type the following code:
code:
print “Hello Python!”
Press enter key it will display following output:-
output:
Hello Python!

Make simple calculator using python:-

On command prompt make a directory PythonProgs using md command.
Then use cd command to open PythonProgs directory.
Now type notepad SimpleCalc.py. The notepad editor will open and type the following code:

code:

a=input(“Enter first number : ”)
b=input(“Enter first number : ”)
print “Summation = ”,(a+b)
print “Subtraction = ”(a-b)
print “Multiplication = ”(a*b)
print “Division = ”,(a/b)

Now save the file SimpleCalc.py and close the file.
Now at command prompt type python SimpleCalc.py it display the following output:-
output:

Enter first number : 10
Enter second number : 5
Summation = 15
Subtraction = 5
Multiplication = 50
Division = 2

What is the return in Python?

The print() function writes, i.e., “prints”, a string in the console. The return statement causes your function to exit and hand back a value to its caller. The point of functions in general is to take in inputs and return something. The return statement is used when a function is ready to return a value to its caller.

What is the input function in Python?

Input can come in various ways, for example from a database, another computer, mouse clicks and movements or from the internet. Yet, in most cases the input stems from the keyboard. For this purpose, Python provides the function input(). Input has an optional parameter, which is the prompt string.

Do you need semicolons in Python?

Python does not require semi-colons to terminate statements. You can also use them
at the end of a line, which makes them look like a statement terminator, but this is legal
only because blank statements are legal in Python — a line that contains asemicolon at
the end is two statements, the second one blank.

Applications for Python

Web and Internet Development
Python offers many choices for web development:

  • Frameworks such as Django and Pyramid.
  • Micro-frameworks such as Flask and Bottle.
  • Advanced content management systems such as Plone and django CMS.

Python’s standard library supports many Internet protocols:

  • HTML and XML
  • JSON
  • E-mail processing.
  • Support for FTP, IMAP, and other Internet protocols.
  • Easy-to-use socket interface.

And the Package Index has yet more libraries:

  • Requests, a powerful HTTP client library.
  • BeautifulSoup, an HTML parser that can handle all sorts of oddball HTML.
  • Feedparser for parsing RSS/Atom feeds.
  • Paramiko, implementing the SSH2 protocol.
  • Twisted Python, a framework for asynchronous network programming.

Scientific and Numeric
Python is widely used in scientific and numeric computing:

  • SciPy is a collection of packages for mathematics, science, and engineering.
  • Pandas is a data analysis and modeling library.
  • IPython is a powerful interactive shell that features easy editing and recording of a work session, and supports visualizations and parallel computing.
  • The Software Carpentry Course teaches basic skills for scientific computing, running bootcamps and providing open-access teaching materials.

Education
Python is a superb language for teaching programming, both at the introductory level and in more advanced courses.

  • Books such as How to Think Like a Computer Scientist, Python Programming: An Introduction to Computer Science, and Practical Programming.
  • The Education Special Interest Group is a good place to discuss teaching issues.

Journey with nature: The Guava Leaf

g.jpg

Seeing and observing are two different things. We are all familier with guavas and we must have eaten them too. But have you ever tried to observe anything that what benefits they may give to you ? I have two guava trees in my garden since past 10 years, I have seen them growing up from a sapling to a tree but never had observed them, I came across many great beneficial things, guava leaves can provide.

Guava is known well as tropical fruit which rich in nutrients throughout the world. People loves to eat it as it has sweet and juicy flavor. Not only consumed as food, guaya also being used in medicinal purpose. The fruit, leaf and other parts of guava has been proved may give benefits to human health. Scientific studies have documented the healthful qualities of the superfruit’s leaves, and you can see what they’ve found for a variety of conditions below:

1. Diarrhea

  • Guava leaf in medicinal purpose is mostly used to treat diarrhea. Diarrhea is a condition where the colon cant absorb water due to bacterial infection of Staphylococcus aureus. Study reported that guava leaf has strong anti-bacterial compound such as tannins and essential oil which very effective to fight against S. Aureus infection and inhibit those bacteria growth.
  • The way to use guava leaves to cure diarrhea is by taking 6 guava leaves, then wash it. Then, boil it through and squeeze the leaves. Next is you get the leaves extract. Then, just drink it straight once in two days until you feel much better.
  • People suffering from diarrhea who drink guava leaf tea may experience less abdominal pain, fewer and less watery stools, and a quicker recovery, according to Drugs.com. Add the leaves and root of guava to a cup of boiling water, strain the water and consume it on an empty stomach for quick relief.da.jpg

2. Lowers Cholesterol

  • It is surprising that guava leaf can reduce the level of cholesterol in bloodwhich can cause many health problems. Studies reported that guava leaf contains active phytochemical compounds such as gallic acid, cathechin and epicathecin which can inhibit pancreatic cholesterol esterase which slightly reduce cholesterol level.
  • LDL or Low-density lipoprotein are one of the five major groups of lipoproteins which transport all fat molecules throughout your body. It is the excess of this class of cholesterol that may cause a host of health disorders particularly that of heart. According to an article published in Nutrition and Metabolism, study participants who drank guava leaf tea had lower cholesterol levels after eight weeks.

ch.jpg

3. Manages Diabetes

  • Japan has approved guava leaves tea as one of the foods for specified health uses to help with the prevention and treatment of diabetes. The compounds in the tea help regulate blood sugar levels after meals, by inhibiting the absorption of two types of sugars – sucrose and maltose. According to an article published in Nutrition and Metabolism, guava leaf tea inhibits several different enzymes that convert carbohydrate in the digestive tract into glucose, potentially slowing its uptake into your blood.
  • Cathechin in guava leaf is not only can burn the fat but it also can control the blood glucose level or in other name it has hypoglycemic effect to the body. This may help to prevent the development of diabetes especially type 2 that also become a consequent along with developing obesity.

diab.jpg

4. Promotes Weight Loss

  • Looking to shed the extra inches around your belly? Sip into guava leaf tea. Guava leaves help prevent complex carbs from turning into sugars, promoting rapid weight loss. Drink guava leaves tea or juice regularly to reap the benefits.

wl.jpg

5. Fights Cancer

  • Due to high quantities of the antioxidant lycopene, various studies have revealed that lycopene plays a significant role in lowering the risk of cancer.
  • Many studies have been conducted to found the components and benefits of guava leaf. One of best benefits that you may found in guava leaf is anti-cancer activity. It has been proved that guava leaf can reduce the risk of several types of cancer such as gastric, breast, oral and prostate cancer. This benefits performed by the antioxidant contains in guava leaf such as quercetin, lycopene and Vitamin C. Those components can induce the apoptosis or self-killing activity of cancer cells according to a study which published in 2011.

ca.jpg

How to Make Guava Leaves Tea

To get all those benefits you can start to consume it by making guava leaves as tea. Below is several steps to make guava tea :

  1. Dry some young guava leaves
  2. After they got dry, crush them into powder
  3. Use one tablespoon of guava leaves and add it to one cup of hot water
  4. Let it brew for 5 minutes then you can strain it
  5. Drink guava leaves tea regularly, once a day

Those are all benefits that you may get from guava leaves. You can consider it as natural remedy which has many good effect to your body and of course low cost medicine which you can get almost anywhere.

tea.jpg

Networking: Heart of World !

Ask ten different people what networking is and you may get as many as ten different answers. A person’s definition of networking probably depends upon their use of this important personal and professional activity. Whether you network to make new friends, find a new job, develop you current career, explore new career options, obtain referrals or sales leads, or simply to broaden you professional horizons, it is important to focus on networking as an exchange of information, contacts or experience.

Networking is one of the most fascinating thing ever. Here, I am writing and at my place and you are reading from your place. This is cool. But have you ever wonder how the world’s scenario would be without this heart ? This is beyond my imagination. Being a Computer Science student, I spend most of the time sitting in front of the laptop doing coding stuffs, programming, web development and much more. So, slowly I have developed interest in computer networking.

How the Computer network works really ? How the network has developed to this vast extent ? What will happen to the world without networking ? These are some of the questions that is fascinating me more and more that it can’t stop me from writing this.

Computer networking is the practice of interfacing two or more computing devices with each other for the purpose of sharing data. Computer Networks are built with a combination of hardware and software.net

Clients and Servers

An important relationship on networks is that of the server and the client. A server is a computer that holds content and services such as a website, a media file, or a chat application. A good example of a server is the computer that holds the website for Google’s search page: http://www.google.com. The server holds that page, and sends it out when requested.

A client is a different computer, such as your laptop or cell phone, that requests to view, download, or use the content. The client can connect over a network to exchange information. For instance, when you request Google’s search page with your web browser, your computer is the client.

MAC address

Imagine MAC addresses like people addresses or phone numbers. You can’t have two persons have the same MAC Address. The thing about MAC address is that it’s only used in LANs. It’s an address that is only usable inside a local network. You can’t send data to a device in a different network using it’s MAC as destination, but you can send data to devices in your local networks using MAC address as identifier.

When a device is manufactured, it’s chip has provided an address called MAC address. A media access control address of a device is a unique identifier assigned to a network interface controller for communications at the data link layer of a network segment. mac

Traditional MAC addresses are 12-digit (6 bytes or 48 bits hexadecimal numbers. By convention, they are usually written in one of the following three formats:

  • MM:MM:MM:SS:SS:SS
  • MM-MM-MM-SS-SS-SS
  • MMM.MMM.SSS.SSS

IP Address

For a computer to communicate with another computer it needs an IP address, and it must be unique. If there is another computer on the same network with the same IP there will be an IP address conflict and both computers will lose network capability until this is resolved.

The IP address consists of 4 numbers separated by decimals. The IP address itself is separated into a network address and a host address. This means that one part of the IP address identifies the computer network ID and the other part identifies the host ID.
As an example, an IP address of 192.168.0.45 is known as a class C address (more on classes later). A class C networks uses the first 3 numbers to identify the network and the last number to identify the host. So, the network id would be 192.168.0 and the host id would be 45. Computers can only communicate with other computers on the same network id. In other words networking will work between 2 computers with IPs 192.168.0.231 and 192.168.0.45 respectively but neither can communicate with 192.168.1.231 because it is part of the 192.168.1 network.ip

                              IP address = Network ID part + Host ID part

An IP address has two components, the network address and the host address. A subnet mask separates the IP address into the network and host addresses (<network><host>). Subnetting further divides the host part of an IP address into a subnet and host address (<network><subnet><host>) if additional subnetwork is needed.

Sub-Classes of IP addressing:

bi.jpg

The 32 bit IP address is divided into five sub-classes. These are:

  • Class A
  • Class B
  • Class C
  • Class D
  • Class E

Each of these classes has a valid range of IP addresses. Classes D and E are reserved for multicast and experimental purposes respectively. The order of bits in the first octet determine the classes of IP address. The class of IP address is used to determine the bits used for network ID and host ID and the number of total networks and hosts possible in that particular class. Each ISP or network administrator assigns IP address to each device that is connected to its network. IPv4 address is divided into two parts:

  • Network ID
  • Host ID

Class A:

IP address belonging to class A are assigned to the networks that contain a large number of hosts.

  • The network ID is 8 bits long.
  • The host ID is 24 bits long.

The higher order bit of the first octet in class A is always set to 0. The remaining 7 bits in first octet are used to determine network ID. The 24 bits of host ID are used to determine the host in any network. The default sub-net mask for class A is 255.x.x.x. Therefore, class A has a total of:

  • 2^7= 128 network ID
  • 2^24 – 2 = 16,777,214 host ID

ca.jpg

Class B:

IP address belonging to class B are assigned to the networks that ranges from medium-sized to large-sized networks.

  • The network ID is 16 bits long.
  • The host ID is 16 bits long.

The higher order bits of the first octet of IP addresses of class B are always set to 10. The remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to determine the host in any network. The default sub-net mask for class B is 255.255.x.x. Class B has a total of:

  • 2^14 = 16384 network address
  • 2^16 – 2 = 65534 host address

cb.jpg

Class C:

IP address belonging to class C are assigned to small-sized networks.

  • The network ID is 24 bits long.
  • The host ID is 8 bits long.

The higher order bits of the first octet of IP addresses of class C are always set to 110. The remaining 21 bits are used to determine network ID. The 8 bits of host ID is used to determine the host in any network. The default sub-net mask for class C is 255.255.255.x. Class C has a total of:

  • 2^21 = 2097152 network address
  • 2^8 – 2 = 254 host address

cc.jpg

Class D:

IP address belonging to class D are reserved for multi-casting. The higher order bits of the first octet of IP addresses belonging to class D are always set to 1110. The remaining bits are for the address that interested hosts recognize.

Class D does not posses any sub-net mask. IP addresses belonging to class D ranges from 224.0.0.0 – 239.255.255.255.

cd.jpg

Class E:

IP addresses belonging to class E are reserved for experimental and research purposes. IP addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This class doesn’t have any sub-net mask. The higher order bits of first octet of class E are always set to 1111.

ce.jpg

Subnet:

Maintaining a smaller network is easy and we can provide security of some particular network from other network by dividing a network into many smaller networks. This is called subnet.

sub

Subnet Mask:

A subnet mask is a mask used to determine what subnet an IP address belongs to. An IP address has two components, the network address and the host address.

It is called a subnet mask because it is used to identify network address of an IP address by perfoming a bitwise AND operation on the netmask. A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address.

Subnet Mask is made by setting network bits to all “1”s and setting host bits to all “0”s. Within a given network, two host addresses are reserved for special purpose, and cannot be assigned to hosts. The “0” address is assigned a network address and “255” is assigned to a broadcast address, and they cannot be assigned to hosts.

Advantage of Subnet Mask:

Given an IP address, if it is bitwise AND with the Subnet Mask, then we will get the network ID of the network to which this particular IP address belongs to.

IP address: 200.1.2.130

This means that a packet is to be sent to host 200.1.2.130 and we have to find out what is the network in which this particular host belongs to.

  • Convert the IP address to 0’s and 1’s bits: 200.1.2.130 converted to:

11001000.00000001.00000010.10000010

  • Let, Subnet Mask is: 255.255.255.192

11111111.11111111.11111111.11000000

  • Performing bitwise AND-

11001000.00000001.00000010.10000010

11111111.11111111.11111111.11000000  

We will get: 11001000.00000001.00000010.10000000

i.e. 200.1.2.128

Hence, 200.1.2.130 belongs to the network 200.1.2.128

 

                                                                                        

 

The “line” which keeps me motivated !

IMG_20180804_231511

Whenever you will feel less energized, demotivated just ask one question to you-

“What is stopping you ?”

The answer that comes to your mind is- “Nothing is stopping me !” Always remember one thing that someone in the world has already faced and overcame from the problem you may facing. So get up and ask few questions to yourself and say to you that-

  • Do I have the Potential ?

Yes definitely I have and why not ! I am capable of development into actuality.

  • Do I have the Courage ?

Yes, I have the strength to venture, persevere and withstand danger, fear or difficulty !

  • Do I have any reason of not making things happen and not giving my as best as I can ?

Definitely, I don’t have any excuse of not doing the best !

 

 

 

Algorithms: Heart of Computing

Before there were computers, there were algorithms. What are algorithms? Why is the study of algorithms worthwhile? What is the role of algorithms relative to other technologies used in computers?

These are some questions that came to the mind. So let’s begin !

What are algorithms ?

Informally, an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output. An algorithm is thus a sequence of computational steps that transform the input into the output. We can also view an algorithm as a tool for solving a well-specified computational problem.

What kinds of problems are solved by algorithms?

Some of the practical applications of the Algorithms are:

  • The Human Genome Project has made great progress toward the goals of identifying all the 100,000 genes in human DNA, determining the sequences of the 3 billion chemical base pairs that make up human DNA, storing this information in databases, and developing tools for data analysis. Each of these steps requires sophisticated algorithms.

download (1)

  • The Internet enables people all around the world to quickly access and retrieve large amounts of information. With the aid of clever algorithms, sites on the Internet are able to manage and manipulate this large volume of data. Examples of problems that make essential use of algorithms include finding good routes on which the data will travel and using a search engine to quickly find pages on which particular information resides.

download (2)

  • Electronic commerce enables goods and services to be negotiated and exchanged electronically, and it depends on the privacy of personal information such as credit card numbers, passwords, and bank statements. The core technologies used in electronic commerce include public-key cryptography and digital signatures, which are based on numerical algorithms and number theory.

download (3)

Algorithms as a technology

Suppose computers were infinitely fast and computer memory was free. Would you have any reason to study algorithms? The answer is yes, if for no other reason than that you would still like to demonstrate that your solution method terminates and does so with the correct answer. If computers were infinitely fast, any correct method for solving a problem would do. You would probably want your implementation to be within the bounds of good software engineering practice (for example, your implementation should be well designed and documented), but you would most often use whichever method was the easiest to implement. Of course, computers may be fast, but they are not infinitely fast. And memory may be inexpensive, but it is not free. Computing time is therefore a bounded resource, and so is space in memory. You should use these resources wisely, and algorithms that are efficient in terms of time or space will help you do so.

So, this is all the small introduction to Algorithms. 

That is why they Learn Faster !

“If you can’t explain it simply, you don’t understand it well enough.”

-Albert Einstein

Feynman Technique

Today, you woke up with some specific goals, say you learnt some concept, if you want to understand it well, try to explain it simply. At first, may be this seems to be easy but actually changing your learning habits is not that easy !

This is the idea behind Feynman Technique.

How to use the Feynman Technique:

Since this technique involves explaining the concept, it can be done in many ways.

  • Definitely we all have friends, whatever concept you learnt, try to explain in front of them. But, they may not be available for you at some particular time, so try the other way.
  • Take out a sheet of paper. Whatever concept you have learnt, write the name of the concept on the top and explaine those.
  • You can create a virtual class by yourself, yes you can !                                                                       Whenever you are in a room, and don’t have any one to listen to you or you aren’t willing to write things on a sheet of paper explaining them, assume that you are teaching it to someone else, may be your classmates or may be you are standing on stage in front of so many people to explain.

Whenever I learn something new, most of the time I began to explain it as if I were explaining it to someone else. Once you will try, you will get to know the impact of this technique. But it is also true that changing your learning habits is not that easy but if you will try once you will see the difference of your understanding.

It boosts your ability to express yourself and more than this, the concept will last longer – Why – Because you understood it well.

Applying the Feynman Technique:

The Pythagorean Theorem

 

IMG-20180702-WA0010

Happy Learning : )

How to be a better Competitive Programmer ?

What is Competitive Programming ?

Competitive Programming is solving problems by writing computer programs under some limits or condition involving participants writing the code according to the given problem. A problem statement is given with variables and necessary details required to solve a particular problem. For instance, you are given with the time limit for the program and memory limit. The computer programs you write solves the problem.Here is an example of a problem:

Statement: Write a program to check whether a triangle is valid or not, when the three angles of the triangle are the inputs. A triangle is valid if the sum of all the three angles is equal to 180 degrees.

Input

The first line contains an integer T, total number of testcases. Then follow T lines, each line contains three angles AB and C of triangle separated by space.

Output

Display ‘YES’ or ‘NO’ if the triangle is Valid or not respectively.

Constraints

  •  T  1000
  • 1 ≤ A,B,C  180

Example’

Input

3                                                                                                                                                         
40 40 100                                                                                                                                           
45 45 90                                                                                                                                             
180 1 1

Output                                                                                                                                        
YES                                                                                                                                                     
YES                                                                                                                                                     
NO

For those who have never done Competitive Programming, can you solve this ? Don’t worry, we will discuss the solution later.

How to do Competitive Programming                                                                                   Competitive Programming combines two things:

  • Design of Algorithms which consists of mathematical thinking and problem solving. An algorith should be correct and efficient. Analyse the proble and then solve them creatively. Algorithm is the set of rules or steps to be followed by the computer. Theoretical knowledge of algorithm is important.
  • Implementation of algorithm requires good programming skills. Implementation and design both has to be correct. The solution are tested using a set of test cases. For instance: There are 3 test cases in the above sample question.

There are various online platform for the competitive coding like codechef  , hackerearth , Codeforces  and many more. If you are new to competitive programming, you should begin with hackerearth. Analyse the problem and write the code in any of your favourite programming language and submit it. There are online judges which compile and run your code.                                                                                                                 Practice and practice is the only thing required to become good at programming. A problem may take days or weeks to be solved, so have patience and never give up! Keep thinking and thinking.

Trust me, the more you think, the more you will gain : )  

You will learn more from those problems which took your days or weeks to get solved. So by giving your time, believe me you are gaining alot. If you are really interested in competitive programming, you will start loving. It will become your habit.

Which language should be preferred for competitive programming: 

At the moment, the most popular programming languages used in contests are
C++, Python and Java. C++ have much more inbuilt libraries than C, C++ is always available in contest systems and is very fast which will help you to escape from time limit exceeded type errors and many more. Programming in Python is cool but it takes more time. In competitive programming, how much time your code took to run matters alot. If your code is absolutely correct, but if it is taking more time than specified in the problem, then your code will not be accepted.

C++ code template

#include <bits/stdc++.h>
using namespace std;
int main() {
// solution comes here
}

Integers: The most used integer type in competitive programming is int , which is a 32-bit type with a value range of −2ˆ31 to 2ˆ31 – 1. If the type int is not enough, the 64-bit type long long can be used. It has a value range of −2ˆ 63 to 2ˆ 63 − 1. The following code defines a long long variable:

long long x = 123456789123456789LL;

Floating point numbers: In most cases, double is enough, but long double is more accurate. An easy way to output the answer is to use the printf function and give the
number of decimal places in the formatting string. For example, the following
code prints the value of x with 6 decimal places:

printf("%.6f\n", x);

What should be done to save time and improve the code:

Short code is ideal in competitive programming in order to save time. Because of this, competitive programmers often define shorter names for datatypes and other parts of code.

typedef long long ll;

Using the above command, you can write simply ll in place of data type long long. Also, shorten your code by using macros .

I am writing the idea of solving the Triangle problem:

tr.jpg     

  • Given three angles, the triangle will be formed if the sum of all the three angles is 180°.
  • No any of the three angles should be 0°.                                                                                 Following is the C++ code:
    #include<iostream>
    using namespace std;
    int main()
    {
    int t, A, B, C;
    cin >> t;
    for(int i = 0; i < t; i++)
    {
    cin >> A;
    cin >> B;
    cin >> C;
    if((A + B + C) == 180 && A != 0 && B != 0 && C != 0)
    cout << "YES" << "\n";
    else
    cout << "NO" << "\n";
    }
    return 0;
    }                                                                                                       
                

Happy competitive programming : )

Communication in the Online World

The right understanding between people began when communication began. In real world, face to face communication and verbal communication helps to express ourselves to others. But what if the communication going online, where you may not be able to see the faces or expressions of the people to whom you are communicating ? Yeah, it creates a lot of misunderstanding sometimes, specially if you don’t know the rules, the common language accepted by that particular online community. We may say today’s world as “Internet’s World”, the reason is obvious : )

Effective Online Communication Tips.jpg

So, this seems pretty easy but at the same time, it is essential to know the rules which should be followed in communicating in the online world. Today, people are more comfortable with sms language, since they think it easy to type and time saving or whatever. On the contrary, writing shorthand should not be preferred. For instance: Hey Anny, what r u doing today ? If u r free, then let’s hangout.                                       Instead of: Hey Anny, what are you doing today ? If you are free, then let’s hangout.

In communicating, full stop, punctuation marks plays a vital role. Don’t neglect them. Many of us use to type without looking at the keyboard ! Funny yeah. Always do a spell check before sending messages. To make people understand clearly what you are willing to say, use full stop, comma, question mark, etc. For instance: “What are you doing ?” is not the same as “What are you doing !”

Writing the message in caps means you are shouting. “I LOVE YOU.” is not the same as “I love you.”                                                                                                                                             The problem with the newbies is that, they don’t know how to type, they focus more on seeing the keyboard. Seeing the screen that what and how you are typing should not be ignored. These are some basic guidelines of texting or online communication. Obviously, this will not come into habit at once but will be in habit if practiced.

Markdown

Words, some paragraph, and a bit of punctuation,  breaks are the most important constituents of an understandable writing. Headings, italicised text, images, fancy quotes, bullet points and more are just decoration.

Decoration is important, which everyone wants in his/her writing.

That’s the problem with text formatting. Add bold text and bullet points and handsome headings to a Word document, then copy and paste it into your blog, and odds are the shine will have quickly faded.

On 28th June, there was a session by Kushal about Markdown. The session started with the installation of “Discount” package. Let’s see what is Markdown.

Words + Special characters= Markdown Formatted Text

Markdown was created in 2004 by John Gruber and Aaron Swartz as a way to format text for the web using simple characters including asterisks, underscores, and brackets. Markdown is a markup language with plain text formatting syntax. It is designed so that it can be converted to html and many other formats using a tool by the same name. If there were no Italics option, no color option, then to emphasize our words, Markdown is very useful.

markdown

Humanoid Robots

 

robot

Have you ever thought of a Robot doing your homework? Yeah, obviously you thought that : ) But have you ever thought of making Humanoid robot on your own? Not yet, I guess. But before that let’s take a look at what it is. Humanoid may be defined as something that resembles or look like a human being and has certain characterstics. In the present era of technological development and advancements, humanoid is being implemented in robotics and these robots are called as “HUMANOID ROBOTS”. It has  torso, a head, two arms, two legs, face, eyes, mouth. Though an extensive research is necessary before building a personal robot. To make the robot behave like a human being, sensors play a big role. Most importantly, the sensors have increased the performance of robot to a large extent.

Different types of sensors used in the present day robots are:

  • Proprioceptive sensors:  For sensing position, speed and orientation.
  • Proximity sensor: To detect the presence of nearby objects.
  • Range sensor: To measure the distances.
  • Tilt sensors: To measure the inclination.
  • Accelerometors: To measure the acceleration.

Such advanced humanoid robots are capable of multiple activities that are mere reflexes of a human being and do not require high intellectual efforts. These robots are fully automated as they can adapt to its surroundings and continue with its direction or command. Depending upon the size and weight, these robots have the capability of self-maintenance and an advanced feature of autonomous learning, thus they avoid harmful situations to people, property and themselves.