0% found this document useful (0 votes)
2 views3 pages

Python

Python, invented by Guido Van Rossum in 1991, is a high-level programming language known for its readability and simplicity. The document discusses various programming concepts including flowcharts, algorithms, control structures, and numeric data types, as well as common errors in Python. It highlights the importance of understanding and analyzing problems in computer programming and provides examples of mathematical operators.

Uploaded by

manishajindal23
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)
2 views3 pages

Python

Python, invented by Guido Van Rossum in 1991, is a high-level programming language known for its readability and simplicity. The document discusses various programming concepts including flowcharts, algorithms, control structures, and numeric data types, as well as common errors in Python. It highlights the importance of understanding and analyzing problems in computer programming and provides examples of mathematical operators.

Uploaded by

manishajindal23
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

Python

[Link] is the inventor of python?


Guido Van Rossum in 1991
2. Short Note on Python .
Python is a high-level, interpreted, general-purpose programming language widely
recognized for its readability and simplicity. , it emphasizes clean syntax and allows
developers to express concepts in fewer lines of code compared to many other
languages.
3. Why are flowcharts more preferred than algorithms?
Flowcharts are easier to understand than algorithms as they are represented in pictorial
forms. Programmer can easily write the code by looking at the flowchart.
4. Can we write more than one algorithm for the same problem? Explain.
Yes, we can write more than one algorithm for the same problem. There is almost
always more than one way to solve a problem.
5. What is the meaning of selection flow in control structures?
The selection control structure allows one set of statements to be executed if a
condition evaluates to true otherwise another set of statements will be executed.
6. How can we create a multi-line string in Python?
We need to enclose the string with a pair of Triple quotes, one at the start and second in
the end. Anything inside the enclosing Triple quotes will become part of multiline string.
7. What is the use of print() function?
The print() function prints the specified message to the screen or other standard output
device.
e.g. Print(“Hello world”) will display the message “Hello world” on the screen.
8. What are variables? Why are they important in any programming language?
Variable is referred as a named memory location that is used to store the value of a
particular type. This value can be changed in the variable during the execution of
program. We declare the variables so our program can be understood more clearly by
the reader and ourselves.
9. How is floor division different from normal division?
Floor division divides the first number with the second number and returns the whole
number without including the decimal value whereas normal division divides the first
number with second number and return the result with decimal value.
e.g. 20//3 returns 6 (floor division), 20/3 returns 6.66 (normal division)
10. What is the meaning of Sequential Programming?
In sequential programming all the statement gets executed one after another, starting
from first statement till last statement.
11. Give three differences between an algorithm and a flowchart?
Algorithm Flowchart
1. It is a step-by-step textual approach to 1. It is step-by-step visual/graphical
solve a problem. approach to solve a problem.
2. Difficult to represent branching and 2. Easy representation of branching and
looping. looping through symbols.
3. Easy to find errors. 3. Difficult to find errors.
4. Can be used for simple, complex or 4. Advisable to use only for simple
long processes. processes.

12. Explain the first two steps involved in Computer Problem Solving.
1. Understanding the Problem: This is a very important and difficult step where we need to
understand the main objective of a problem. Better you understand the problem, easier
it will be to solve it.
2. Analyzing the Problem: In this step, we analyse what kind of data can be given as an
input, what formula or tool to use to do the processing and in which format the output
will be displayed.
13. Explain Mathematical operators with example.
Name Symbol Purpose Example Output
Addition + Adds two values 2+4 6
2.0+4 6.0
‘hello’+’world helloworld
Subtraction - Subtracts second value from first 6-2 4
value. 6.0-2 4.0
Multiplication * Multiplies two values. 2*3 6
2.0*3 6.0
‘DP’*2 DPDP
Division / Divides two values, return the result 4/2 2.0
with decimal value 4.0/2 2.0
7/2 3.5
Remainder % Returns the remainder after division 5%2 1
20%7 6
Exponential ** Return second number raised to the 2**3 8
power of first number 3**4 81
Floor Division // Divides the first number with second 4//2 2
number and returns the result as 21//4 5
whole number

14. Explain three different types of numeric data types available in python.
Following are some number types:
 Integer: Integers are whole numbers (+ve, -ve or 0) with no decimal value. For example,
10, 124, 4567, 7812568751.
 Float: It is a real number with floating point representation. For example, 15.5 and 12.0.
 Complex: It is made up of a real number and an imaginary number. For example, 3+2i
where 3 is a real number and 2i is an imaginary number.
15. Explain three different types of errors in Python.
Three kind of errors in Python are— syntax error, logical error and runtime error.
Syntax Error: Syntax means writing the code following the rules of Python language. This is
the most common type of an error made by a programmer. If there is typing error,
incorrect indentation, or incorrect arguments given in a function then Python will not be
able to interpret the instruction and will raise a syntax error.
Logical Error: This kind of error is difficult to find since the program will run correctly but
the desired output is not achieved. This happens if we give a wrong formula for the
calculation to be done.
Runtime Error: Runtime error occurs during the execution of a program like wrong input or
output errors, undefined object errors, division by zero errors. This type of error will stop
the program execution unexpectedly.

You might also like