0% found this document useful (0 votes)
5 views12 pages

Project2diploma Cs 5th Semester

The document provides an overview of Python, highlighting its features, benefits, and applications in various fields such as web development, data science, automation, and cybersecurity. It also explains Python's syntax, data types, and functions, including the use of comments and type checking. Additionally, it discusses GUI libraries and the characteristics of sets in Python.

Uploaded by

krharsh750
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)
5 views12 pages

Project2diploma Cs 5th Semester

The document provides an overview of Python, highlighting its features, benefits, and applications in various fields such as web development, data science, automation, and cybersecurity. It also explains Python's syntax, data types, and functions, including the use of comments and type checking. Additionally, it discusses GUI libraries and the characteristics of sets in Python.

Uploaded by

krharsh750
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/ 12

Diploma CS 5th Semester

PYTHON
1. What is Python? List some popular applications of
Python in the world of technology.
Ans- It is a high-level, interpreted programing
language, very easy to read and understand. It was
designed by Guido van Rossum and came out in
1991. Code readability has been its most important
feature, with its clear syntax that leaves it no
stranger to either amateur or professional
programmers.

The most popular usages of Python are in the world


of technology.

Django and Flask do lead the list, though, of most


commonly used frameworks in building robustly
scalable web applications.
 Data Science and Analytics: The manipulation,
analysis, and visualization of data is pretty
easy with libraries like Pandas, NumPy, and
Matplotlib.Some of the most commonly
applied libraries for developing complex
models in machine learning include
TensorFlow, Keras, and Scikit-learn.

 Automation and Scripting: The simplicity of


Python makes it ideal for writing scripts on
routine tasks.

 Library: Pygame: This module also supports


game development, so making nice games and
multimedia applications.

The SciPy and SymPy libraries of Python are highly used


in scientific research and computing.
 Cyber Security: Python is utilized in developing
security tools, scanning networks, and automating
any security-related function.

2. What are the benefits of using Python language as a


tool in the present scenario?
Ans- Python is one of the greatest powers in
today's technological world. Benefits make it a
necessity for use in almost every field. There are
reasons as to why Python stands out.

Readability and Simplicity: The syntax of Python


is clean and simple; therefore, it's a language for
the novice as well as the professional developer.
You'll spend more time solving problems than on
thinking about the problems your code's complex
structures generate.
 Versatility: Starting from web development to data
science, machine learning, and automation, it has no
limits in terms of versatility. That's more or less like
the Swiss Army knife in programming.

 Huge numbers of libraries and frameworks: Python


is enriched with libraries and frameworks like
Pandas, NumPy, TensorFlow, and Django, which
simplify only tough tasks and quicken the
development process. Community Support: The
Python community is vast and active. Whether
you’re stuck on a bug or looking for the latest
library, help is just a forum post away.

 Portability: Python code can be taken and run on any


combination of windows, Mac, and Linux without
alteration.
It thus provides interoperability capabilities with
other languages and technologies and, therefore,
might prove to be an excellent choice for projects
that require several technologies.

From the simplest script to complex automation,


the work of Python will make your workflow
much more effective. Rapid Prototyping: Python is
very good for quick prototyping in extremely fast-
paced environments, being highly flexible and
very easy.

3. What does the ‘#’ symbol do in Python?


Ans- The # is the comment symbol in Python.
Everything on that line after the # will be ignored
by the Python interpreter because the Python
interpreter ignores everything after the #.
Comments are what really make your code read
and understandable. They tell the purpose of parts
of your code. For example:

4. What is the difference between / and // in Python?


Ans- In Python, the / and // opertors are bot used for
division, but they serve different purposes:
 / (Single Slash) – True Division: This operator
perform division and returns a float (floating-
point number), even if both operands are
integers.
5. Write the name of function for type check of an
object.

ANS- The Python typeof function is a built-in function that returns the type
of an object. And this function is a polymorphic function, which means it can
take arguments of any type and return a value of any type.

The typeof function is typically used for debugging purposes, to help identify
the type of an object. It can also be used to check the type of the argument
passed to a function. In python, type() is used to get the type of an object.

The type() function allows you to determine the data type of a variable or
parameter. For example, the following code prints "int" when called on the
input "5":

Input

x = 5
print(type(x))
s = 'xyz’
print(type(s))
from collections import OrderedDict
od = OrderedDict()
print(type(od))
class Data:
pass
d = Data()
print(type(d))

Output

<class 'int'>
<class 'str'>
<class 'collections.OrderedDict'>
<class '__main__.Data'>
The type () function returns the type of the object with the module name. But
our Python script doesn’t have a module, so this script module becomes
__main__.

6. Write about GUI mode of python.


ANS- There are several python GUI libraries.
Popular Libraries
Tkinter: Tkinter is standard libraries of python. Easy learning with
the application. Preferred with smaller applications.
Qt Python: It is powered-based cross-platform framework based
upon a Qt library. Comes handy with numerous widgets
functionalities in a large extent.
Kivy: This is relatively, a new cross platform system, developed
for all user friendly touch applications on one's phone.
WxPython: wxPython is as it seems a cross-system native-looking,
and another, as if on all the respective working systems.
Widgets: A collection of building blocks that comprise a GUI,
such as buttons, labels, text boxes, and menus.
Events: Actions performed by a user in the sense that he clicks a
button or types some text.
Layout: A process used to place widgets on the screen, and these
include grids, packs, or placements.
Event Handlers: The action of code executed during a user's
events.
7. What is set in python.
ANS- A set in Python is an unordered collection of unique
elements. It is one of four built-in data types for storing collections
of data, the other three being lists, tuples, and dictionaries.

Basic Set Properties:-


Unordered: The elements of a set are not ordered like in a lists or
tuples.
Unique: A set does not allow an element to be repeated.
Mutable: You can add and remove from a set after it has been
defined.
Creating a set:
8. How to add more items in set.
ANS- In Python, you can add items to a set using the
following methods:
a. Adding a single item:
use the add() method.

b. Adding multipl item:


use the update() method.

 The update() method can also take other iterable


objects like tuples, strings, or other sets.
9. What is the use of input() .
ANS- The input() function in Python allows users to feed data into a
program. That is, it is a pre-defined feature one can use to:
Accept user input
The input() function can take input from the user via a keyboard, file,
or database.
Provide multiple inputs
The input() function can receive multiple inputs of the same data type.
Transform input
The input() function can be used to adjust the input to the format
desired. For example, the variable could convert the value keyed in
into an integer.
Some examples of using input()
Input without a prompt: takeString = input()
Input with a prompt : takeString = input( 'What would you like to say?
')
The input() function returns the input as a string. If an improper input
is entered by the user, then Python will throw a syntax error or
exception.

10. Write about data types used in python.


ANS- Data item Classification or categorization It specifies
what type of value means and what operations can be applied
to a given data As everything is an object in Python
programming, so these are classes in Python; variables are
instances, i.e., objects of the Python data types. Following are
the standard or Built-in data types of Python: Numeric
Sequence Type Boolean Set Dictionary Binary
Types(memoryview, bytearray, bytes )

To define the values of different data types of Python and


checking their data types we make use of type() . Consider
following examples :.

This code assigns variable 'x' different values of various


Python data types. It covers string, integer, float, complex,
list, tuple, range, dictionary, set, frozenset, boolean, bytes,
bytearray, memoryview, and the special value 'None'
successively. Each assignment replaces the previous value,
making 'x' take on the data type and value of the most recent
assignment.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy