Lab Manual
Lab Manual
Format Printing
**Q1:** Write a Python program that asks the user for their name and prints "Hello, [name], welcome!" using string formatting.
**Q2:** Write a Python program to display pi up to 4 decimal places using string formatting.
**Q3:** Write a Python program that displays the result of division of two numbers with 3 decimal points.
**Q4:** Write a Python program that prints the following formatted output using f-strings:
Name: John
Age: 25
Occupation: Developer
**Q5:** Write a Python program to display a table of squares and cubes of numbers from 1 to 10.
**Q2:**A store offers different discounts based on the membership and the amount spent:
If a customer is a gold member, they receive a 20% discount on purchases over 1000.
If they are a silver member, they receive 15% discount on purchases over 750.
If they are a bronze member, they receive 10% discount on purchases over 500.
If the customer spends less than the required amount for their membership level, no discount applies.
Write a program to determine the discount for a customer based on their membership type and the total purchase amount.
(Use menu for membership selection)
**Q3:**Write a Python program that checks a given number and classifies it as:
"Positive Odd": If the number is odd and greater than zero.
"Positive Even": If the number is even and greater than zero.
"Negative Odd": If the number is odd and less than zero.
"Negative Even": If the number is even and less than zero.
"Zero": If the number is exactly zero.
**Q4:**Write a Python program to check if a given date is valid (in the format day/month/year). Consider:
A month should be between 1 and 12.
A day should be within the valid range for the given month (e.g., 31 for January, 28 for February, 30 for April, etc.).
Consider leap years (if the year is divisible by 4 and not 100, or divisible by 400, February has 29 days).
Input:Day, month, and year (three integers).
Output:"Valid Date" if the date is valid, otherwise "Invalid Date".
**Q5:**Design a simple Bank Account System in Python where users can perform various banking operations.
The system should allow for the following features:
Create an Account: Users should be able to create a bank account by specifying their name and an initial balance.
Deposit Money: Users should be able to deposit money into their bank account.
Withdraw Money: Users should be able to withdraw money from their account. The system should ensure the user cannot withdraw more
than their available balance.
Check Balance: Users should be able to check their current balance.
Exit the System: The user should be able to exit the system.