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

Basic Python Practice Sheet

This document is a basic Python practice sheet covering various topics including variables, data types, conditional statements, loops, functions, data structures, and file handling. It provides specific exercises such as creating variables, checking conditions, using loops, defining functions, and performing file operations. Additionally, there is a practice challenge to filter even numbers from a list.

Uploaded by

nandinidolas10
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)
2 views1 page

Basic Python Practice Sheet

This document is a basic Python practice sheet covering various topics including variables, data types, conditional statements, loops, functions, data structures, and file handling. It provides specific exercises such as creating variables, checking conditions, using loops, defining functions, and performing file operations. Additionally, there is a practice challenge to filter even numbers from a list.

Uploaded by

nandinidolas10
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

Basic Python Practice Sheet

1. Variables and Data Types

- Create a variable `name` and assign your name to it.


- Create two variables `a` and `b` with values 10 and 20. Find their sum.
- What is the difference between a list, tuple, and set? Create one example of each.

2. Conditional Statements

- Write a program to check if a number is positive, negative, or zero.


- Create a program that checks if a given year is a leap year.

3. Loops

- Write a program to print numbers from 1 to 10 using a `for` loop.


- Use a `while` loop to print the first 5 even numbers.

4. Functions

- Write a function `greet(name)` that takes a name as input and prints a greeting message.
- Create a function to find the factorial of a given number.

5. Basic Data Structures

- Create a list of five fruits and print each one using a `for` loop.
- Write a program to find the largest number in a given list.

6. File Handling

- Write a Python program to create a text file, write some content into it, and read the content.

7. Practice Challenge

- Write a program that takes a list of numbers as input and returns a new list with only the even
numbers.

You might also like