100% found this document useful (1 vote)
316 views1 page

2 +Variables+for+Numbers

This document contains questions about declaring and initializing variables in Python. It asks the reader to: 1) Declare variables for age, number of website visits, birth year, visitor name, product title, quantity, and four integers and floats from the user. 2) Print or display the values and results of basic math operations on the variables, such as summing integers and multiplying floats. 3) Provide example output showing the values stored and calculated with the variables.

Uploaded by

Aisha Arif
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
100% found this document useful (1 vote)
316 views1 page

2 +Variables+for+Numbers

This document contains questions about declaring and initializing variables in Python. It asks the reader to: 1) Declare variables for age, number of website visits, birth year, visitor name, product title, quantity, and four integers and floats from the user. 2) Print or display the values and results of basic math operations on the variables, such as summing integers and multiplying floats. 3) Provide example output showing the values stored and calculated with the variables.

Uploaded by

Aisha Arif
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
You are on page 1/ 1

VARIABLES FOR NUMBERS

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 in your browser: “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 obtains four float values from the user and displays the sum
& the product.

Questions adapted from: https://github.com/LearningAppDevelopment/Assignments/wiki

You might also like