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

Assinment Sudip

The document outlines key concepts in Python programming, including the differences between for and while loops, error handling with try-except blocks, and the distinction between division types (/ and //). It also explains the use of pass statements, lambda functions, list comprehension, and the benefits of Python as a programming language. Additionally, it differentiates between lists and tuples, discusses decorators, local and global variables, and provides examples of Python code for finding minimum values and checking for palindromes.

Uploaded by

nehabombe2233
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 views2 pages

Assinment Sudip

The document outlines key concepts in Python programming, including the differences between for and while loops, error handling with try-except blocks, and the distinction between division types (/ and //). It also explains the use of pass statements, lambda functions, list comprehension, and the benefits of Python as a programming language. Additionally, it differentiates between lists and tuples, discusses decorators, local and global variables, and provides examples of Python code for finding minimum values and checking for palindromes.

Uploaded by

nehabombe2233
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
You are on page 1/ 2

1)Difference between for loop and while loop in Python

For loop is used as to access the element as sequence Ly from our list or Tuple.

In while loop its iterate or give the output when given condition is
true.

2)How is Exceptional handling done in Python?

There is different error while executing the program such as name error, syntax error, index error

To handle this error by using the blocks try-except, try except-else, try except finally.

3)What is the difference between / and // in Python? (2

/ = is use for the purpose of division of the numerical value and if we dividing even number by 2, its
giving out put in decimal ,

// is also use for division, but if we dividing the even number by 2 its giving out as round off, its not
giving out put in decimal point, its known as floor division

For ex.

10 / 3 = 3.33

10//3 = 3 --- its floor division

4) What is a pass in Python?

Whenever we don’t know the what actual code is written , then the pass function is used

(2)

5 )What is a lambda function?

It’s a anonymous function, there is no need to give name of function, its always without name

6) What is List Comprehension? Give an Example.

(2)
7) What are the benefits of using Python language as a tool in the present scenario?

Paython is easy to learn and its very faster rather than other language.

Its object oriented language and its give better satisfaction in machine learning .

(2)

8) Differentiate between List and Tuple?

List is mutable and tuple is immutable

In list , we can insert more memory , tuple having less memory.

We can modify the list but we cannot modify the tupple.

(2)

9) What are Decorators?

(2)

10) What are local and global variables in Python?

The variables inside the block of code is known as local variable.

The variables outside the block of code is known as global variable

(2)

11) write a Python code to find the Minimum of these two numbers (2.5)

a=2

b=5

minimum = min(a,b)

minimum

12) Python program to check whether the string is Symmetrical or Palindrome (2.5)

You might also like