0% found this document useful (0 votes)
17 views19 pages

Class Notes

The document discusses a certificate for a student's diploma project on quiz competition. It provides details about the student's work, certifies that the work is original and has not been submitted elsewhere, and includes signatures of the student, supervisor, and head of department.

Uploaded by

shivammaan896
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
17 views19 pages

Class Notes

The document discusses a certificate for a student's diploma project on quiz competition. It provides details about the student's work, certifies that the work is original and has not been submitted elsewhere, and includes signatures of the student, supervisor, and head of department.

Uploaded by

shivammaan896
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 19

Certificate

This is to certify that the work incorporated in this diploma entitled, “Quiz
Compition”, diploma of COMMUNICATION AND COMPUTER
NETWORKING, embodies original work carried-out by the student. We, further
certify that this work has not been submitted to any other University or Institution
in part or full for the award of any degree or diploma. material(s) obtained from
other source(s) and used in this work has/have been duly acknowledged in the
Report. Image(s), illustration(s), figure(s), table(s) etc., used in the report from
other source(s), have also been duly cited and acknowledged.

(Signature of Student) (Signature of Supervisor)

Name with date Name with date

(Signature of H.O.D)
Name with date
Acknowledgement

I would like to express my sincere gratitude to all these individuals for mentoring
and supporting me in completing this project quiz compition. My project
supervisor Er.Manoj kumar , for providing me with invaluable insights and
direction.
Our esteemed principal Er.Y.k.Goel for fostering an environment of learning and
creativity within our school.
To my parents, their constant encouragement, patience, and understanding have
been the pillars of my success.
I am grateful to my friends who contributed ideas and perspectives that enriched
the project.
Thank you everyone for shaping this project and enhancing my learning
experience.
CONTENT
1. Introduction
2. Why to use python
3. Features of python
4. Control structures in python
5. Comments
6. Variables
7. Keywords
8. Data type
9. Loops
10. Coding in python
11. Output
INTRODUCTION
Python is a widely used general-purpose, high level programming language. It was
initially designed by Guido van Rossum in 1991 and developed by Python
Software Foundation. It was mainly developed for emphasis on code readability,
and its syntax allows programmers to express concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate
systems more efficiently.
Why to use Python:
The following are the primary factors to use python in day-to-day life:
1. Python is object-oriented
Structure supports such concepts as polymorphism, operation overloading and
multiple inheritance.
2. Indentation
Indentation is one of the greatest feature in python.
3. It’s free (open source)
Downloading python and installing python is free and easy
4. It’s Powerful
 Dynamic typing
 Built-in types and tools
 Library utilities
 Third party utilities (e.g. Numeric, NumPy, sciPy)
 Automatic memory management
5. It’s Portable
 Python runs virtually every major platform used today
 As long as you have a compaitable python interpreter installed, python
programs will run in exactly the same manner, irrespective of platform.
6. It’s easy to use and learn
 No intermediate compile
 Python Programs are compiled automatically to an intermediate form
called byte code, which the interpreter then reads.
 This gives python the development speed of an interpreter without the
performance loss inherent in purely interpreted languages.
 Structure and syntax are pretty intuitive and easy to grasp.
7. Interpreted Language
Python is processed at runtime by python Interpreter
8. Interactive Programming Language
Users can interact with the python interpreter directly for writing the programs
9. Straight forward syntax
The formation of python syntax is simple and straight forward which also makes it
popular.
Features of Python
1.Simplicity and Readability Python's syntax is designed to be clean, concise, and
easy to read, making it an accessible language for beginners and experienced
developers alike.
2.Cross-Platform Compatibility Python can run on multiple operating systems,
including Windows, macOS, and Linux, allowing for cross-platform development
and deployment.
3.Extensive Libraries and Frameworks Python has a vast and growing ecosystem
of libraries and frameworks that provide pre-built functionality for a wide range of
tasks, from web development to scientific computing.
4.Dynamic Typing Python is a dynamically typed language, which means that
variables can hold values of different data types without the need for explicit
declarations.
Control Structures in Python
Python provides a range of control structures that allow you to control the flow of
execution in your programs. These include conditional statements (if-elif-else),
loops (for and while), and more advanced constructs like list comprehensions and
generator expressions.
1.If-Elif-Else
The if-elif-else statements allow you to make decisions based on one or more
conditions, and execute different blocks of code accordingly.
2.Loops
Loops, such as for and while loops, allow you to repeatedly execute a block of
code until a certain condition is met, making them useful for iterating over
collections of data or performing repetitive tasks.
3. List Comprehensions
List comprehensions provide a concise and efficient way to create lists by applying
a transformation or filter to each element of an iterable, such as a list or a range.
COMMENTS
Comments are important parts of code they help you and others understand what
your code is doing. It’s extremely helpful when you start writing functions and
need help understanding the connections in your code. To write a comment in
python you use the # symbol at the beginning of the line. In python the line will
turn green and you’ll be able to type anything you want after.

If you want more than one line of code commented out you can use “”” ….
“”” three quotation marks at the start and end to have a set of lines commented
fully out.

>>> # This would be a comment line if you were coding right now
Variables
Variables are placeholders of information in the memory. It’s used in sort of the
same way as in algebra

>>> A = 12

>>> 10 + A = 22

In programming a variable is used to access and manipulate data. A variable is


a name that represents a piece of information in the computer’s memory. In
python you create and set variables. In python to create a variable you use the =
sign.

>>> Height = 20

To use the variable you can substitute it into any of the calculations from
earlier.

>>> 12 + height = 32

Variable Naming rules:

1. You can’t use one of python’s key words as a variable name


2. You can’t have spaces in your variable name
3. The first character of a variable must be a letter or an underscore
4. Python is case sensitive X is different than x

When creating variables it’s good practice to name the variable so it reflects the
purpose of the variable. Programmers also tend to use camel case or underscores
to denote different words so a variable called grosspay would look
like gross_pay or grossPay .:

Variables can hold a lot more than just numbers. In programming variables can
hold a multitude of information including (strings, numbers, data frames,
Booleans, floats, lists)
# Create a variable and display it

First_name = “James”

# To denote words to a variable you will have to use quotation marks

last_name = “Smith”

# display the values

Print(first_Name, last_Name)

KEYWORDS

Keywords are predefined, reserved words used in Python programming that have
special meanings to the compiler.

We cannot use a keyword as a variable name, function name, or any other


identifier. They are used to define the syntax and structure of the Python language.

Here is a list of the Python keywords. Enter any keyword to get more help.

False class from or

None continue global pass

True def if raise

and del import return

as elif in try

assert else is while

async except lambda with

await finally nonlocal yield

break for not


DATA TYPE

1. Integers (int): These are whole numbers, such as -5, 0, 42, etc.

2. Floats (float): Floating-point numbers represent real numbers and include a


decimal point or an exponent, such as 3.14, -0.001, etc.

3. Strings (str): Strings are sequences of characters enclosed in single quotes,


double quotes, or triple quotes, such as "hello", 'world', "123", etc.

4. Booleans (bool): Booleans represent truth values, either True or False, and
are often used in conditional statements and logical operations.

5. Lists (list): Lists are ordered collections of items, which can be of any data
type. They are mutable, meaning their elements can be changed after creation,
and are enclosed in square brackets, like [1, 2, 3] or ['a', 'b', 'c'].

6. Tuples (tuple): Tuples are similar to lists but are immutable, meaning their
elements cannot be changed after creation. They are enclosed in parentheses,
like (1, 2, 3) or ('a', 'b', 'c').

7. Dictionaries (dict): Dictionaries are collections of key-value pairs, where


each key is associated with a value. They are unordered and mutable, and keys
must be unique. They are enclosed in curly braces, like {'name': 'John', 'age':
30}
Mainly there are two types of loop in python:-

1. while loop 2. For loop

While loop:-

while loop is used to execute a block of statements repeatedly until a given


condition is satisfied. When the condition becomes false, the line immediately
after the loop in the program is executed.

For loop:-

For loops are used for sequential traversal. For example: traversing
a list or string or array etc. In Python, there is “for in” loop which is similar to for
each loop in other languages.
CODING IN PYTHON

FOR CREATING A QUIZ PROGRAM


CODING IN PYTHON
FOR CREATING A QUIZ PROGRAM
OUTPUT OF THE QUIZ
OUTPUT
FINAL OUTPUT OF THE QUIZ PROGRAM
WHEN WE ENTER THE WRONG ANSWER
WHEN WE ENTER THE WRONG ANSWER
FINAL OUTPUT
REFERENCE
1. Guido van Rossum and Fred L. Drake Jr, “an introduction to python –
Revised and updated for python 3.2, Network Theory Ltd, 2011.
2. John V Guttag, “Introduction to computation and programming using
python”, revised and expanded Edition, MIT Press , 2013.
3. www.python.org
4. www.w3schools.com
5. www.geeksforgeeks.org
6. www.programiz.com
REMARK

You might also like