Python - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Python Example

Python Example

shape Description

The Python dialect has numerous likenesses to C and Java. There are some positive contrasts between the dialects. The following is the syntax for the python to get the data. [c]print "Write any data"[/c] Where print is the keyword to display the data. As discussed in the installation part , user can execute the code in three ways as follows.

By using command line

shape Description

The execution of code will be very simple when compared to other languages, to print the data user need use the word print as follows. the following is an example. print "Welcome to splessons" Now execute the same code in python command line as follows, in case if any one is using latest version of python the peranthasis needs to placed.

By shell script

shape Description

Script Mode. In intelligent mode, Python shows the consequences of expressions. One can have the Python mediator execute our script records. Application program scripts can be of any size or many-sided quality. An interpreter is a PC program that specifically executes, i.e. performs, directions written in a programming or scripting dialect, without already aggregating them into a machine dialect program. A mediator by and large uses one of the accompanying procedures for program execution. The following is the way to execute the code script mode.

By Saving the file

shape Description

By using notepad the developer will write the code and save the file with the extension .py, for example the file name is python1 then it needs to be saved with python1.py . The following is the way to exacute code in python python1.py. Where python1 is the file name.

Summary

shape Key Points

  • Python is portable so result will be same at all platforms.
  • Python reduces the length of the code.
  • Python language does not have data types to store the variable.