Skip to content

Madhuraj9030/python-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

-- this is the first git commit i have done without main but in master and have added the files which i have practised on my own and the question are below Q1. Declare a variable called age & assign to it your age. Print your age. Q2. Declare & initialize a variable to keep track of how many times a visitor has visited your program. Show his/her number of visits on your program. For example: “You have visited this site N times”. Q3. Declare a variable called birthYear & assign to it your birth year. Also Print the type of your variable using type(). Print the following message: My birth year is 1990 Data Type of my declared variable is <class 'int'> Q4. A visitor visits an online clothing store www.xyzClothing.com. Write a python script to store in variables the following information: a) Visitor’s name b) Product title c) Quantity i.e. how many products a visitor wants to order Show the following message : “John Doe ordered 5 T-shirt(s) on XYZ Clothing store”. Q5. Write a program that obtains four integer values from the user and displays the sum & the product. Insert 1st number: 2 Insert 2nd number: 5 Insert 3rd number: 7 Insert 4th number: 9 Sum: 23 Product: 630

Q6. Write a program that takes input a name from user & greet the user like this: Please enter your name: John Doe Hi, John Doe Q7. Write a program to take “city” name as input from user. If user enters “Karachi”, welcome the user like this: “Welcome to city of lights”. Please Enter Your City: Karachi Welcome to city of lights Q8. Write a program to take “gender” as input from user. If the user is male, give the message: Good Morning Sir. If the user is female, give the message: Good Morning Ma’am.

Q9. Write a program to take input max age & current age from user. If the current age is less than or equal to max age, show the message “You are welcome”. Q10. Write a program to take input remaining fuel in car (in litres) from user. If the current fuel is less than 0.25litres, show the message “Please refill the fuel in your car

Q11. Write a program to implement checkout process of a shopping cart system for an e-commerce website. Take input from users, the following: a) Name of item1 b) Name of item2 c) Price of item 1 d) Price of item 2 e) Ordered quantity of item 1 f) Ordered Quantity of item 2 g) Shipping charges Compute the total cost. If the total cost is above 2000 PKR, offer them 10% discount & show the receipt in your screen. Shopping Cart Price of T-Shirt is 1000 Quantity of T-Shirt is 2 Price of USB Flash Drive is 3 Shipping Charges 250 Total Cost of Your Order is 4350 PKR Discounted Price is 3915 PKR

Q12.) Guess game: Store a secret number (ranging from 1 to 10) in a variable. Prompt user to guess the secret number. a) If user guesses the same number, show “Bingo! Correct answer”. b) If the guessed number +1 is the secret number, show “Close enough to the correct answer”. Q13. Write a program to check whether the given number is divisible by 3. Show the message to the user if the number is divisible by 3. Q14. Write a program that takes user input day name. If the day is Monday, Tuesday, Wednesday, Thursday or Friday, then show “It’s a week day”. If the day is Saturday then show “It’s weekend”. If the day is Sunday then show “Yay! It’s a holiday”.

About

Assignment on control statements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages