Python For Data Analysis Assignment 1
Python For Data Analysis Assignment 1
1. A bakery sells 250 loaves of bread per day. Write a Python program to store the daily
bread sales in a variable and print the result.
2. Create a variable to store your name and age, then print out a greeting message using
these variables.
3. A car travels 350 miles in 5 hours. Store the distance and time in variables and calculate
the average speed.
4. . Convert the string "123" to an integer and perform arithmetic operations on it.
5. A user inputs their height as a string (e.g., "175"). Convert this to an integer and
calculate their BMI.
6. Convert the float 3.14 to an integer and explain the outcome.
7. Calculate the total cost of items purchased at a store: 2 shirts ($15 each), 1 pant ($20),
and 1 belt ($10).
8. A car's fuel efficiency is 25 miles per gallon. Calculate how many gallons are needed for a
500-mile trip.
9. Calculate the area of a rectangle with length 5cm and width 3cm.
10.Write a Python program to check if a person's age (stored in a variable) is eligible to vote
(18+).
11.Compare two numbers (stored in variables) to determine which is larger.
12.Check if a student's score (stored in a variable) is greater than or equal to 50.
13. Write a Python program to check if a person is eligible for a loan (age 25+, income
$50,000+).
14.Determine if a number (stored in a variable) is even or odd.
15.Check if a user has admin privileges (stored in a variable) and if their password (stored in
another variable) is correct.
16.Write a Python program to concatenate a person's first and last names.
17.Combine two strings to form a sentence: "Hello, " + name.
18.Create a full address by concatenating street, city, state, and zip.
19.Extract the first 3 characters of a string "HelloWorld).
20.Get the last 4 characters of a string "abcdefghij).
21.Extract a substring from index 2 to 5.
22.Access the 3rd character of a string "Python).
23.Get the last character of a string using negative indexing.