0% found this document useful (0 votes)
4 views4 pages

Python Programming Basics Explained

Python is an interpreted, object-oriented programming language known for its simplicity and extensive libraries. It features various data types, including lists, tuples, and strings, and supports control and iteration statements for program flow. Key concepts include variables, constants, keywords, and operators, which are essential for writing Python programs.

Uploaded by

apu29.tadi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Python Programming Basics Explained

Python is an interpreted, object-oriented programming language known for its simplicity and extensive libraries. It features various data types, including lists, tuples, and strings, and supports control and iteration statements for program flow. Key concepts include variables, constants, keywords, and operators, which are essential for writing Python programs.

Uploaded by

apu29.tadi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Define Python
Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics developed by Guido van Rossum.
It was originally released in 1991.

2. Give features of python


 Free and Open Source  many libraries
 Easy to code  Interpreted Language
 High-Level Language

3. What is python interpreter


A python interpreter is a computer program that converts each
high-level program statement into machine code

4. What are python strings


Python strings are "immutable" which means they cannot be
changed after they are created. Since strings can't be changed, we
construct *new* strings as we go to represent computed values.

5. How interactive mode differs from crypt mode


 Interactive mode is  Script mode is where
where you type you put a bunch of
commands and they commands into a file
are immediately (a script), and then
executed. tell Python to run the
file.

6. List down the standard data types in python


 Numeric.  Tuple.  Dictionar
 String.  Set. y.
 List.

7. What is meant by python numbers


Numbers in Python refer to the numeric data types in Python
programming. Python supports three kinds of numeric data types:
int, float, and complex

8. Mention the features of list in python


 Lists are ordered.  Lists can be nested to
 Lists can contain any arbitrary depth.
arbitrary objects.  Lists are mutable.
 List elements can be  Lists are dynamic.
accessed by index.
9. What is tuple? Distinguish between list and tuple
Tuples are also a sequence data type containing elements of
different data types.
Lists are mutable Tuples are immutable

The implication of iterations is Time-


consuming The implication of iterations is comparatively Faster

The list is better for performing operations,


such as insertion and deletion. Tuple data type is appropriate for accessing the elements

Lists consume more memory Tuple consumes less memory as compared to the list

Lists have several built-in methods Tuple does not have many built-in methods.

10. Define variable and constants


constant is a named data item with a predefined value, while a
variable is a named data item whose value can change during the
course of program execution

11. What are keywords


Keywords are words or phrases in the content of your web pages
that match the words and phrases users are entering into search
engines as closely as possible.

12. State the rules to writing an identifier


1. A valid identifier can have letters (both uppercase and lowercase letters),
digits and underscores.
2. The first letter of an identifier should be either a letter or an underscore.
3. You cannot use keywords like int, while etc. as identifiers.
4. There is no rule on how long an identifier can be. However, you may run into
problems in some compilers if the identifier is longer than 31 characters.

13. Describe the Bare bone of python


The barebones of python program are Expressions, Statements,
Comments, Functions, Block and Indentation

14. List out the components of python program


A Python program can contain various components like expressions,
statements, comments, functions, blocks and indentation.

15. List and describe the various operators used in python


 Arithmetic operators  Identity operators
 Assignment operators  Membership operators
 Comparison operators  Bitwise operators
 Logical operators
16. What is the use of operator’s precedence
The precedence of an operator specifies how "tightly" it binds two
expressions together.

17. Define control statements & name its types


Control statements in python are used to control the flow of execution
of the program based on the specified [Link] supports 3
types of control statements such as, 1) Break. 2) Continue. 3) Pass

18. List out the types of decisionmaking statements and explain anyone
with a flow chart
There are three decision making statements in Python.
1. If Statements
2. If Else Statements
3. Nested If Else Statements

19. State and explain iteration statements & types


iteration statements or loop statements allow us to execute a block of
statements as long as the condition is true. loops statements are used
when we need to run same code again and again, each time with a
different value.
While loop -> It is used to execute a block of statement as long as a
given condition is true.
For loop -> It is used to iterate over items of any sequence, such as a
list or a string.
Jump Statements -> Jump statements are used to transfer the
program's control from one location to another.

20. Distinguish between


a) For loop & while loop

For loop While loop

For Keyword is used. While Keyword is used.


Number of iterations already known. No prior information on the number of iterations.
Loop runs infinite times. Display the compile time error.
Once done cannot be repeated. Repeat at every iteration.
To be done at starting of the loop. Can be done anywhere in the loop body.
Range or xrange function is used to iterate. No such function is used in the while loop.

b) Lists & tuples


c) Upend & extend

d) Indexing & slicing

e) Algorithm & flowchart

You might also like