0% found this document useful (0 votes)
3 views1 page

Mid Exam Python Handwritten Notes

The document outlines important Python concepts for a mid-exam, covering keywords, data types, factorials, palindromes, operators, prime numbers, sums of odd numbers, dictionaries, string occurrences, function arguments, and methods for lists and tuples. Each section provides definitions and examples relevant to the topics. The focus is on essential programming knowledge and practical applications in Python.
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)
3 views1 page

Mid Exam Python Handwritten Notes

The document outlines important Python concepts for a mid-exam, covering keywords, data types, factorials, palindromes, operators, prime numbers, sums of odd numbers, dictionaries, string occurrences, function arguments, and methods for lists and tuples. Each section provides definitions and examples relevant to the topics. The focus is on essential programming knowledge and practical applications in Python.
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

Mid Exam – Python Important Questions (6 Marks Each)

1. Keywords and Data Types


Keywords are reserved words in Python which have special meaning. Examples: if, else, for, while,
def, return.
Data types specify the type of data stored in a variable.
Examples: int, float, string, list, tuple, set, dictionary, boolean.

2. Factorial and Palindrome


Factorial of a number n is n × (n−1) × ... × 1.
A palindrome number reads the same forward and backward.

3. Operators
Operators are symbols used to perform operations.
Types: Arithmetic, Relational, Logical, Assignment, Membership, Identity.

4. Prime Numbers between 100 and 200


A prime number has only two factors: 1 and itself. Numbers between 100 and 200 are checked
using loops and conditions.

5. Sum of Odd Numbers (1 to 100)


Odd numbers are not divisible by 2. Using a loop, odd numbers are added to find the sum.

6. Dictionary Programs
A dictionary stores data in key-value pairs. It is mutable and unordered.

7. Number of Occurrences in a String


This program counts how many times a character appears in a given string using a loop.

8. Function Arguments
Arguments are values passed to functions. Types include positional, keyword, default and variable
length arguments.

9. List Methods
Lists are ordered and mutable. Common methods are append, insert, remove, pop, sort, reverse.

10. Tuple Methods


Tuples are ordered and immutable. Methods include count() and index().

You might also like