0% found this document useful (0 votes)
5 views

Python QB

The document outlines various applications of Python, including web development, data science, machine learning, automation, and game development. It highlights key features of Python such as its easy syntax, interpreted nature, dynamic typing, and extensive standard library. Additionally, it discusses concepts like operators, dictionaries, variables, and built-in functions in Python.

Uploaded by

Ronit Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Python QB

The document outlines various applications of Python, including web development, data science, machine learning, automation, and game development. It highlights key features of Python such as its easy syntax, interpreted nature, dynamic typing, and extensive standard library. Additionally, it discusses concepts like operators, dictionaries, variables, and built-in functions in Python.

Uploaded by

Ronit Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2 Marks:

Q3
ANS:
Applications of Python:
1. Web Development: Django, Flask, FastAPI
2. Data Science & Analytics: Pandas, NumPy, Matplotlib
3. Machine Learning & AI: TensorFlow, Scikit-learn, PyTorch
4. Automation & Scripting: Selenium, PyAutoGUI
5. Game Development: Pygame, Panda3D

Q4
ANS:
-indentation is crucial as it defines the structure of the code and determines how statements are grouped.
-Unlike other languages that use braces {}, Python relies on indentation to indicate blocks of code.

Q5
ANS:
-An operator in Python is a symbol that performs an operation on values or variables.
-Operators are used in mathematical calculations, comparisons, and logical expressions.

Operators Used in Python:


1. Arithmetic Operators
2. Comparison Operators
3. Logical Operators
4. Assignment Operators
5. Bitwise Operators

Q7
ANS:
-A dictionary in Python stores data as key-value pairs using {}.
-Keys must be unique and are usually strings, numbers, or tuples, while values can be any data type.
-Dictionaries are mutable, allowing adding, updating, and removing items.
-Example: {'name': 'Alice', 'age': 30}.

4 Marks
Q2
ANS:
key features of Python:
1.Easy to Learn and Use - Python has a simple and readable syntax, making it beginner-friendly.
2.Interpreted Language - Python executes code line by line (no need for compilation), making debugging easier.
3.Dynamically Typed - No need to declare variable types; Python automatically determines the data type.
4.Object-Oriented and Procedural - Supports both object-oriented and procedural programming paradigms.
5.Platform Independent -Python code can run on different operating systems without modification.
6.Large Standard Library - Comes with built-in modules for handling tasks like file handling, networking, and
data processing.
7.Extensible and Embeddable - Can integrate with other languages like C, C++, and Java for enhanced
functionality.
8.High-Level Language - Python manages memory allocation and garbage collection automatically.
9.Supports GUI and Web Development - Libraries like Tkinter, Django, and Flask allow building graphical
applications and web applications.
Q1
ANS:

Q8
ANS:
-A variable in programming is a name that refers to a memory location where data can be stored.
-It acts as a container for holding values or data types (such as integers, strings, floats, etc.) that can be used and
manipulated throughout a program.
-Rules for Declaring Variables in Python:
1.Variables in python can be created from alphanumeric character and underscore (_) character.
2.A variable cannot begin with a number.
3.The variable are case sensative.
4.Variable name should not be reserved word or keyword.
5.No special characters are used except underscore (_) in variable declaration.
6.Variable can be of unlimited length
-E.g.,
>>> a = 10
>>> print(a)
10

Q9
ANS:
r = float(input("Enter radius: "))
h = float(input("Enter height: "))
pi = 3.1416 # Approximate value of π
volume = pi * r * r * h
surface_area = 2 * pi * r * (r + h)
print("Volume:", volume)
print("Surface Area:", surface_area)
Q10
ANS:
Built-in Functions in Python:
-Python provides built-in functions that are readily available for use without needing to import any modules.
-These functions help perform common tasks like mathematical operations, input/output handling, type conversions, and
more.

Categories of Built-in Functions :


1. Basic Input/Output Functions
- print() – Displays output.
- input() – Takes user input.

2. Type Checking & Conversion Functions


- type(x) – Returns the type of x.
- str(x) – Converts x to a string.
- int(x) – Converts x to an integer.
- float(x) – Converts x to a floating-point number.
3. String Functions
- len(s) – Returns the length of a string.
- lower() – Converts a string to lowercase.
- upper() – Converts a string to uppercase.
- replace(a, b) – Replaces a with b in a string.
4. Mathematical Functions
- abs(x) – Returns the absolute value of x.
- max() – Returns the largest value.
- min() – Returns the smallest value.
- sum(iterable) – Returns the sum of numbers.
5. List & Tuple Functions
- list(iterable) – Converts an iterable to a list.
- tuple(iterable) – Converts an iterable to a tuple.
- sorted(iterable) – Returns a sorted list.
- len(iterable) – Returns the number of elements in a list or tuple.

6. Utility Functions
- id(x) – Returns the memory address of x.
- help(x) – Displays help information about x.
- range(start, stop, step) – Generates a sequence of numbers.

You might also like