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

Python Topics Questions

This document provides a quick revision guide for Python, highlighting important topics such as Python basics, data types, control statements, functions, and object-oriented programming. It includes a list of expected descriptive questions for exams and several basic Python programs demonstrating key concepts. The programs cover checking even or odd numbers, calculating factorials, summing a list, defining a simple function, and writing to a file.

Uploaded by

sha26hla
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)
13 views2 pages

Python Topics Questions

This document provides a quick revision guide for Python, highlighting important topics such as Python basics, data types, control statements, functions, and object-oriented programming. It includes a list of expected descriptive questions for exams and several basic Python programs demonstrating key concepts. The programs cover checking even or odd numbers, calculating factorials, summing a list, defining a simple function, and writing to a file.

Uploaded by

sha26hla
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

Python Quick Revision (Exam Oriented)

Important Topics + Expected Questions + Basic Programs

1. Most Important Python Topics:


• Python Basics: features of Python, keywords, variables, basic syntax, input() and print()
• Data Types: int, float, string, boolean, list, tuple, dictionary, set
• Operators: arithmetic, relational, logical, assignment, bitwise (basic idea)
• Control Statements: if, if-else, if-elif-else, for loop, while loop, break, continue, pass
• Functions: user defined functions, parameters, return statement, lambda (basic idea)
• Data Structures: list, tuple, dictionary, set and their basic operations
• String Handling: slicing, concatenation, common string methods
• File Handling: open(), read(), write(), close(), modes r/w/a
• Exception Handling: try, except, finally
• Object Oriented Programming: class, object, constructor, inheritance (basic idea)

2. Most Expected Descriptive Questions:


1 What is Python? Explain its main features.
2 Explain Python data types with examples.
3 What is a List in Python? Explain with methods like append(), remove(), pop().
4 Difference between List and Tuple.
5 What is Dictionary in Python? Explain with example.
6 Explain control statements in Python.
7 What is a Function in Python? Explain with syntax and example.
8 What is Exception Handling? Explain try and except.
9 Explain File Handling in Python.
10 What are Class and Object in Python?

3. Important Python Programs:

Program 1: Check Even or Odd


num = int(input("Enter number: "))
if num % 2 == 0:
print("Even")
else:
print("Odd")

Program 2: Factorial using loop


n = int(input("Enter number: "))
fact = 1
for i in range(1, n+1):
fact = fact * i
print("Factorial =", fact)

Program 3: Sum of numbers in a list


numbers = [10,20,30,40]
total = sum(numbers)
print("Sum =", total)

Program 4: Simple Function Example


def add(a,b):
return a+b

print(add(5,3))

Program 5: File Write Example


file = open("[Link]","w")
[Link]("Hello Python")
[Link]()

You might also like