Posts

Showing posts with the label PYTHON

First Python Program

Often, a program called "Hello, World!" is used to introduce a new programming language to beginners. A "Hello, World!" is a simple program that outputs "Hello, World!". However, Python is one of the easiest language to learn, and creating "Hello, World!" program is as simple as writing  print("Hello, World!") . So, we are going to write a different program. Program to Add Two Numbers 1 2 3 4 5 # Add two numbers num1 = 3 num2 = 5 sum = num1 + num2 print ( sum ) How this program works? Line 1:  # Add two numbers Any line starting with  #  in Python programming is a comment. Comments are used in programming to describe the purpose of the code. This helps you as well as other programmers to understand the intent of the code. Comments are completely ignored by compilers and interpreters. Line 2:  num1 = 3 Here,  num1  is a var...

Basic Syntax of Python

Python is case sensitive . Hence a variable with name  codingavengers  is not same as  CodingAvengers For path specification, python uses  forward slashes . Hence if you are working with a file, the default path for the file in case of Windows OS will have backward slashes, which you will have to convert to forward slashes to make them work in your python script. For window's path  C:\folderA\folderB  relative python program path should be  C:/folderA/folderB In python,  there is no command terminator , which means no semicolon  ;  or anything. So if you want to print something as output, all you have to do is: print "Hello, World!" Oops! we just shared the first python program too with you. Yes, just one single statement. In one line only a single executable statement should be written  and the line change act as command terminator in python. To write two separate executable statements in a single line , you should...

4 Reasons to Choose Python as First Language

1.Simple Elegant Syntax Programming in Python is fun. It's easier to understand and write Python code.  Why? The syntax feels natural. Take this source code for an example: a = 2 b = 3 sum = a + b print(sum) Even if you have never programmed before, you can easily guess that this program adds two numbers and prints it. 2.Not overly strict You don't need to define the type of a variable in Python. Also, it's not necessary to add semicolon at the end of the statement. Python enforces you to follow good practices (like proper indentation). These small things can make learning much easier for beginners. 3.Expressiveness of the language Python allows you to write programs having greater functionality with fewer lines of code.You will be amazed how much you can do with Python once you learn the basics. 4.Great Community and Support Python has a large supporting community. There are numerous active forums online which can be handy if you are stuck. Some of th...

Introduction to Python and setting up Python Development Environment

Image
Welcome! This is your first step towards learning Python programming language. Or, Do you know this language already and are here just to revise your concepts?. It doesn't matter which category you belong to because we will be teaching you Python, right from the basics. An experienced programmer might have an advantage of picking up topics and lessons rather quickly, even though we recommend you to not to hurry through the topics, since Python, although being a normal programming language, carries some nice treats for programmers, and you would not want to miss those in the tutorials. For all the noobs out there, there is nothing to worry. You should be happy that you have chosen the most amazing and simple tutorial to learn Python. Why Python? Python is considered as one of the most versatile programming languages. If you have even a little experience in programming, then you will soon notice the difference. Let's take a look at the features of Python. Features o...