What is a program?¶
- A program is a sequence of instructions that tells how to solve a given problem. For example, Finding a square of a number.
Basic terminology of programming¶
- Input: Get data from the keyboard, a file, or some other device.
- Math: Perform basic mathematical operations like addition and multiplication.
- Conditional execution: Check for certain conditions and execute the appropriate sequence of statements.
- Repetition: Perform some action repeatedly, usually with some variation.
- Output: Display data on the screen or send data to a file or other device.
Before start programming in python, we have to install python software. To install python software go to https://www.python.org/downloads/ and download and install the python software which is compatible with your operating system.
Python program - "Hello World"¶
- when we run the above code the python interpreter will give output
- Indentation refers to the spaces at the beginning of a code line.
- Python uses indentation to indicate a block of code.
- Indentation improves the code readability
- Comments are used to explain Python code.
- Comments are used to make the code more readable.
- Comments are used to prevent execution when testing code.
- Comments starts with a #, and Python will ignore them:
#This is a comment print("Hello, World!")