0% found this document useful (0 votes)
2 views1 page

Unit 5 Python

The document provides an overview of key Python programming concepts such as algorithms, flowcharts, nested loops, infinite loops, and the use of input and print functions. It also explains the differences between else and elif statements, division operators, and typecasting, including its implicit and explicit types. Each concept is defined with examples for clarity.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Unit 5 Python

The document provides an overview of key Python programming concepts such as algorithms, flowcharts, nested loops, infinite loops, and the use of input and print functions. It also explains the differences between else and elif statements, division operators, and typecasting, including its implicit and explicit types. Each concept is defined with examples for clarity.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SURYA THE GLOBAL SCHOOL

Unit 5: Python

1. What is algorithm and Flowchart?


A. An algorithm is a set of sequential steps to solve any logical or mathematical problem whereas
Flowchart is a diagrammatic representation of the steps of an algorithm, whcih are used for solving a
particular problem.
2. Write the difference between else and elif statement.
A. Else is used when no conditions are true.
Elif is used to check another condition if the first one is not true.
3. What are nested loops?
A. Nested loops are loops inside another loop. In python, this means one for or while loop is placed inside
another for or while loop.
4. What is an Infinite loop?
A. An infinite loop is a loop that never stops running because the condition is always true.
5. Describe the use of input () and Print () function.
A. The input () function is used to take input from the user.
The Print () function is used to show messages or results on the screen.
6. What is the difference between a division operator and a floor division operator?
A. The division operator / gives exact result (including decimal points).
Example :5/2 gives 2.5
The floor division operator // gives the whole number only, removing the decimal.
Example: 5//2 gives 2.
7. What is typecasting? Explain its types.
A. Typecasting means changing one data type to another in python.
Types of typecasting:
Implicit Typecasting: Implicit type conversion refers to the automatic conversion of one data type to
another by python.
Example: int + float becomes float
Explicit typecasting: This type of typecasting is done by programmer using functions like int (), float (),
str ().
Example: int (“5”) changes a string “5” to number 5.

You might also like