Page 126 - TechPluse_C8_Flipbook
P. 126
Conditional and Looping
10 Statements in Python
Your Aim
to learn about:
l Conditional Statements l The For Statement
l The While Statement l Jump Statements
l Functions
Python is a high-level, general-purpose programming language known for its simplicity,
readability, and versatility. Developed by Guido van Rossum in 1989, Python is widely used in
various fields, including web development, game design, data science, and artificial intelligence.
Its easy-to-learn syntax makes it a preferred choice for beginners and professionals alike.
Python offers several key features that make programming efficient and user-friendly. It is
easy to code, as its syntax is similar to the English language. Being an open-source language,
Python is free to use, modify, and distribute. It follows an object-oriented approach, allowing
developers to structure programs efficiently using objects and classes. Python is an interpreted
language, meaning the code is executed line by line, making debugging simpler. Additionally, it
is dynamically typed, so there is no need to declare variable types explicitly. Python can also be
integrated with other languages like C and C++.
Python provides two commonly used functions input() and output() for input and output. The
input() function takes the user’s input while a program executes. The general syntax of the input()
function is as follows:
input([<prompt>])
The print() function prints or sends the output to the standard output device, which is usually a
monitor. The general syntax of the print() function is as follows:
print [<expression 1>, <expression 2>...]
Variables are memory reference points where we store values which can be accessed or changed
later. The names given to the variables are known as identifiers. Python does not require explicit
type declarations. While naming variables, certain rules must be followed. A variable name
must start with a letter or an underscore and cannot start with a number. It can contain letters,
numbers, and underscores but cannot include special characters or symbols. Variable names are
case-sensitive, meaning name and Name are considered different.
124 Premium Edition-VIII

