Posts

Showing posts from February, 2018

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 use a  semicolon   ; to separate the co

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

C - Basic Syntax

You have seen the basic structure of a C program, so it will be easy to understand other basic building blocks of the C programming language. Tokens in C A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol. For example, the following C statement consists of five tokens − printf ( "Hello, World! \n" ); The individual tokens are − printf ( "Hello, World! \n" ) ; Semicolons In a C program, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity. Given below are two different statements − printf ( "Hello, World! \n" ); return 0 ; Comments Comments are like helping text in your C program and they are ignored by the compiler. They start with /* and terminate with the characters */ as shown below − /* my first program in C */ You cannot have comments within comments

HTML Editors

Image
Write HTML Using Notepad or TextEdit Web pages can be created and modified by using professional HTML editors. However, for learning HTML we recommend a simple text editor like Notepad (PC) or TextEdit (Mac). We believe using a simple text editor is a good way to learn HTML. Follow the four steps below to create your first web page with Notepad or TextEdit. Step 1: Open Notepad (PC) Windows 8 or later: Open the  Start Screen  (the window symbol at the bottom left on your screen). Type  Notepad . Windows 7 or earlier: Open  Start  >  Programs >   Accessories >   Notepad Step 1: Open TextEdit (Mac) Open  Finder > Applications > TextEdit Also change some preferences to get the application to save files correctly.  In  Preferences > Format >  choose  "Plain Text" Then under "Open and Save", check the box that says "Ignore rich text commands in HTML files". Then open a new document to place the code. Step