Python is a widely used general-purpose, high level programming language. It was created by Guido van Rossum in 1991 and further developed by the Python Software Foundation. It was designed with an emphasis on code readability, and its syntax allows programmers to express their concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate systems more efficiently.
There are two major Python versions: Python 2 and Python 3. Both are quite different.
Beginning with Python programming:
1) Finding an Interpreter:
Before we start Python programming, we need to have an interpreter to interpret and run our programs. There are certain online interpreters like https://ide.geeksforgeeks.org/, http://ideone.com/ or http://codepad.org/ that can be used to run Python programs without installing an interpreter.
Windows: There are many interpreters available freely to run Python scripts like IDLE (Integrated Development Environment) that comes bundled with the Python software downloaded from http://python.org/.
Linux: Python comes preinstalled with popular Linux distros such as Ubuntu and Fedora. To check which version of Python you’re running, type “python” in the terminal emulator. The interpreter should start and print the version number.
macOS: Generally, Python 2.7 comes bundled with macOS. You’ll have to manually install Python 3 from http://python.org/.
2) Writing our first program:
Just type in the following code after you start the interpreter.
Let’s analyze the script line by line.
Line 1: [# Script Begins] In Python, comments begin with a #. This statement is ignored by the interpreter and serves as documentation for our code.
Line 2: [print(“GeeksQuiz”)] To print something on the console, print() function is used. This function also adds a newline after our message is printed(unlike in C). Note that in Python 2, “print” is not a function but a keyword and therefore can be used without parentheses. However, in Python 3, it is a function and must be invoked with parentheses.
Line 3: [# Script Ends] This is just another comment like in Line 1.
Please comment if you find anything incorrect, or if you want to share more information about the topic discussed above.
- Python – The new generation Language
- Encrypt a string into the Rovarspraket (The Robber Language)
- Array in Python | Set 1 (Introduction and Functions)
- Virtual Functions and Runtime Polymorphism in C++ | Set 1 (Introduction)
- Pointers in C and C++ | Set 1 (Introduction, Arithmetic and Array)
- An introduction to Flowcharts
- Introduction of Microprocessor
- Introduction of Secondary Memory
- Introduction of Object Oriented Programming
- Python | Set 4 (Dictionary, Keywords in Python)
- Increment and Decrement Operators in Python
- Division Operators in Python
- Interesting facts about strings in Python | Set 1
- Interesting facts about strings in Python | Set 2 (Slicing)
- Python List Comprehension and Slicing
- Loops and Control Statements (continue, break and pass) in Python
- Object Oriented Programming in Python | Set 1 (Class, Object and Members)
- Object Oriented Programming in Python | Set 2 (Data Hiding and Object Printing)
- Ternary Operator in Python
- Python String Methods | Set 1 (find, rfind, startwith, endwith, islower, isupper, lower, upper, swapcase & title)