0% found this document useful (0 votes)
3 views3 pages

Python Assignment

This document outlines a Python assignment consisting of ten questions that cover various programming concepts. Tasks include creating variables of different data types, converting data types, performing list operations, using arithmetic operators, implementing if-else conditions, creating a grading system, utilizing loops, filtering data, creating and analyzing a product dictionary, and analyzing sales data. Each question requires specific programming tasks to demonstrate understanding of Python fundamentals.
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)
3 views3 pages

Python Assignment

This document outlines a Python assignment consisting of ten questions that cover various programming concepts. Tasks include creating variables of different data types, converting data types, performing list operations, using arithmetic operators, implementing if-else conditions, creating a grading system, utilizing loops, filtering data, creating and analyzing a product dictionary, and analyzing sales data. Each question requires specific programming tasks to demonstrate understanding of Python fundamentals.
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

Python Assignment

Q1. Create variables of different data types:

 Integer
 Float
 String
 Boolean
 List
 Dictionary

 Print each variable with its data type.

[Link] data types:

 Convert a string "100" into integer


 Convert integer 50 into float
 Convert list [1,2,3] into tuple

Q3. List Operations

 Create a list of 5 numbers


 Add a new number
 Remove one number
 Find maximum and minimum value

Q4. Arithmetic Operators

Take two numbers from user and perform:

 Addition
 Subtraction
 Multiplication
 Division
 Modulus

Q5. If-Else Condition

Write a program to check:

 If a number is positive, negative, or zero


Q6. Grading System

Input marks and print grade:

 90+ → A
 75–89 → B
 50–74 → C
 Below 50 → Fail

Q7. Loop program.

For Loop

 Print numbers from 1 to 10


 Print sum of numbers from 1 to 100

While Loop

 Print even numbers from 1 to 20


 Stop loop when number reaches 15

Break & Continue

 Skip number 5 using continue


 Stop loop at 8 using break

Q8. Data Filtering

data = [12, 45, 67, 23, 89, 10, 5]


Create a new list with values greater than 30

Q9. Create a dictionary of products with prices:

products = {
"laptop": 50000,
"mobile": 20000,
"tablet": 30000
}
Perform Tasks:

 Find the total price of all products


 Find the maximum priced product
 Find the minimum priced product

Q10. Sales Data Analysis

sales = [250, 300, 150, 400, 500, 100]

Perform:

 Total sales
 Average sales
 Highest sales
 Lowest sales
 Count how many days sales > 300

You might also like