Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in /home/ekhaliya/public_html/topcse/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /home/ekhaliya/public_html/topcse/wp-content/plugins/crayon-syntax-highlighter/crayon_langs.class.php:340) in /home/ekhaliya/public_html/topcse/wp-content/plugins/sg-cachepress/core/Supercacher/Supercacher_Helper.php on line 77
Python Tutorial : Getting started with Python Programming - Top CSE

Python Tutorial : Getting started with Python Programming

In this post we will learn about history of Python Language and introduction to Python , way for writing programs

 Introduction to Python – History, IDE, Syntax

Guido Van Rossum invented the python programming language in 1990’s.it is a high level language for solving problems on modern computer systems. here program can run on any operating systems and it is an interpreted language.

How to Run Python Programs in IDE

Python expressions and statements can run in interactive programming environment called “shell”. The easiest way to open a shell is to launch the idle. This is an integrated program development environment that comes with the python installation.

Introduction to  Syntax 

A shell window contains an opening message followed by the special symbol “>>>”, called a shell prompt. The cursor at shell prompt waits for you to enter a  command.

Example :>>> 3+4

7

>>>3

3

>>>”p”

P

>>>Name =”Kiel”

>>> Name

Kiel

>>>print (“hi”, Name)

Hi Kiel

This language is a case sensitive language. The   print function always ends its output with newline. In other words , it displays the values of the expression, an then it moves the cursor to the next line on the console windows.

To begin the next operation on the same line as the previous one, you can place expression end=” “, which says end the line with an empty string at the end of the list of expressions print (expression, end=” ”);

How to take Input 

You can prompt user to enter a value from the keyboard using the input (““) function.

Example:-   >>> name=input(“enter name:”)

Enter name: Namrata

>>>name

‘Namrata’

>>>Print (name)

Namrata

>>>

The input function always builds a string from the user’s keystrokes and returns it to program. After inputting strings that represents numbers, the programmer must convert them from strings to appropriate numeric types.

  • Int (a string of digits):- convert a string of digits to integer value.
  • Float (a string of digits):- convert a string of digits to a floating point values.

Tags:  Tutorials, introduction to Programming language, learn basics , history, learn  this language from scratch, syntax, printing  command, input .

%d bloggers like this: