Task 2 - Input Variables
Task 2 - Input Variables
1937 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> name = str(input("What is your name?"))
What is your name? Haniya
>>> surname = str(input("What is your surname?"))
What is your surname? Ahmed
>>>
>>> print("Your name is:", name, surname)
Your name is: Haniya Ahmed
>>>
>>> #Task 2
>>>
>>> name = str(input("What is your name?"))
What is your name? Haniya
>>> surname = str(input("What is your surname?"))
What is your surname? Ahmed
>>> nationality = str(input("What is your nationality?"))
What is your nationality? Pakistani
>>> DoB = str(input("Date of Birth:"))
Date of Birth: 10/10/2010
>>> team = str(input("What is your favourite team?"))
What is your favourite team? Manchester United
>>>
>>> print("My name is", name, surname, "and I was born on", DoB)
My name is Haniya Ahmed and I was born on 10/10/2010
>>> print("My nationality is", nationality, "and my favourite team is", team)
My nationality is Pakistani and my favourite team is Manchester United
>>>
>>> #------------------------------------------------------------------------------
>>>
>>> #Karak program
>>>
>>> number = int(input("How much Karak would you like?"))
How much Karak would you like? 20
>>> price = float(input("Enter price per Karak:"))
Enter price per Karak: 2
>>> total = number*price
>>> print("The total cost is:", total)
The total cost is: 40.0
>>>
>>> number = int(input("How much Karak would you like?"))
How much Karak would you like? 25
>>> price = float(input("Enter price per Karak:"))
Enter price per Karak: 1
>>> total = number*price
>>> print("The total cost is:", total)
The total cost is: 25.0
>>>
>>> number = int(input("How much Karak would you like?"))
How much Karak would you like? 75
>>> price = float(input("Enter price per Karak:"))
Enter price per Karak: 2.5
>>> total = number*price
>>> print("The total cost is:", total)
The total cost is: 187.5
>>>
>>> number = int(input("How much Karak would you like?"))
How much Karak would you like? 81
>>> price = float(input("Enter price per Karak:"))
Enter price per Karak: 7.5
>>> total = number*price
>>> print("The total cost is:", total)
The total cost is: 607.5
>>>
>>> number = int(input("How much Karak would you like?"))
How much Karak would you like? 120
>>> price = float(input("Enter price per Karak:"))
Enter price per Karak: 6
>>> total = number*price
>>> print("The total cost is:", total)
The total cost is: 720.0
>>>
>>> #--------------------------------------------------------------------------
>>>
>>> #Task 4 - Shopping calculator
>>>
>>> milkCost = 8
>>> breadCost = 3
>>> eggCost = 12
>>>
>>> milk = int(input("How many bottles of milk would you like?"))
How many bottles of milk would you like? 25
>>> bread = int(input("How many loaf's of bread would you like?"))
How many loaf's of bread would you like? 30
>>> eggs = int(input("How many eggs would you like?"))
How many eggs would you like? 50
>>> totalCost = (milkCost*milk) + (breadCost*bread) + (eggCost*eggs)
>>>
>>> print("Milk ordered:", milk)
Milk ordered: 25
>>> print("Bread ordered:", bread)
Bread ordered: 30
>>> print("Eggs ordered:", eggs)
Eggs ordered: 50
>>> print("Total bill is:", totalCost)
Total bill is: 890
>>>
>>> milk = int(input("How many bottles of milk would you like?"))
How many bottles of milk would you like? 75
>>> bread = int(input("How many loaf's of bread would you like?"))
How many loaf's of bread would you like? 45
>>> eggs = int(input("How many eggs would you like?"))
How many eggs would you like? 21
>>> totalCost = (milkCost*milk) + (breadCost*bread) + (eggCost*eggs)
>>>
>>> print("Milk ordered:", milk)
Milk ordered: 75
>>> print("Bread ordered:", bread)
Bread ordered: 45
>>> print("Eggs ordered:", eggs)
Eggs ordered: 21
>>> print("Total bill is:", totalCost)
Total bill is: 987
>>>
>>> milk = int(input("How many bottles of milk would you like?"))
How many bottles of milk would you like? 60
>>> bread = int(input("How many loaf's of bread would you like?"))
How many loaf's of bread would you like? 90
>>> eggs = int(input("How many eggs would you like?"))
How many eggs would you like? 95
>>> totalCost = (milkCost*milk) + (breadCost*bread) + (eggCost*eggs)
>>>
>>> print("Milk ordered:", milk)
Milk ordered: 60
>>> print("Bread ordered:", bread)
Bread ordered: 90
>>> print("Eggs ordered:", eggs)
Eggs ordered: 95
>>> print("Total bill is:", totalCost)
Total bill is: 1890
>>>
>>> milk = int(input("How many bottles of milk would you like?"))
How many bottles of milk would you like? 10
>>> bread = int(input("How many loaf's of bread would you like?"))
How many loaf's of bread would you like? 120
>>> eggs = int(input("How many eggs would you like?"))
How many eggs would you like? 165
>>> totalCost = (milkCost*milk) + (breadCost*bread) + (eggCost*eggs)
>>>
>>> print("Milk ordered:", milk)
Milk ordered: 10
>>> print("Bread ordered:", bread)
Bread ordered: 120
>>> print("Eggs ordered:", eggs)
Eggs ordered: 165
>>> print("Total bill is:", totalCost)
Total bill is: 2420
>>>
>>> milk = int(input("How many bottles of milk would you like?"))
How many bottles of milk would you like? 30
>>> bread = int(input("How many loaf's of bread would you like?"))
How many loaf's of bread would you like? 155
>>> eggs = int(input("How many eggs would you like?"))
How many eggs would you like? 80
>>> totalCost = (milkCost*milk) + (breadCost*bread) + (eggCost*eggs)
>>>
>>> print("Milk ordered:", milk)
Milk ordered: 30
>>> print("Bread ordered:", bread)
Bread ordered: 155
>>> print("Eggs ordered:", eggs)
Eggs ordered: 80
>>> print("Total bill is:", totalCost)
Total bill is: 1665
>>>
>>>
#---------------------------------------------------------------------------------
>>>
>>> #Area of a rectangle
>>>
>>> height = int(input("Enter height:"))
Enter height: 50
>>> width = int(input("Enter width:"))
Enter width: 55
>>> area = height*width
>>> print("The area is:", area)
The area is: 2750
>>>
>>> height = int(input("Enter height:"))
Enter height: 20
>>> width = int(input("Enter width:"))
Enter width: 120
>>> area = height*width
>>> print("The area is:", area)
The area is: 2400
>>>
>>> height = int(input("Enter height:"))
Enter height: 35
>>> width = int(input("Enter width:"))
Enter width: 225
>>> area = height*width
>>> print("The area is:", area,"cm^2")
The area is: 7875 cm^2
>>>
>>> height = int(input("Enter height:"))
Enter height: 120
>>> width = int(input("Enter width:"))
Enter width: 425
>>> area = height*width
>>> print("The area is:", area,"cm^2")
The area is: 51000 cm^2
>>>
>>> height = int(input("Enter height:"))
Enter height: 155
>>> width = int(input("Enter width:"))
Enter width: 555
>>> area = height*width
>>> print("The area is:", area,"cm^2")
The area is: 86025 cm^2
>>>
>>> #----------------------------------------------------------------------------
>>>
>>> #Area of a circle
>>>
>>> pi = 3.14159265
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 20
>>> Radius = radius*radius
>>> area = pi*Radius
>>> print("The area of the circle is:", area,"cm^2")
The area of the circle is: 1256.63706 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 45
>>> Radius = radius*radius
>>> area = pi*Radius
>>> print("The area of the circle is:", area,"cm^2")
The area of the circle is: 6361.725116250001 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 60
>>> Radius = radius*radius
>>> area = pi*Radius
>>> print("The area of the circle is:", area,"cm^2")
The area of the circle is: 11309.733540000001 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 55
>>> Radius = radius*radius
>>> area = pi*Radius
>>> print("The area of the circle is:", area,"cm^2")
The area of the circle is: 9503.31776625 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 98
>>> Radius = radius*radius
>>> area = pi*Radius
>>> print("The area of the circle is:", area,"cm^2")
The area of the circle is: 30171.855810600002 cm^2
>>>
>>> #--------------------------------------------------------------
>>>
>>> #Circumference of a circle
>>>
>>> pi = 3.14159265
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 20
>>> Circumference = 2*pi*radius
>>> print("The circumference of the circle is:", Circumference,"cm^2")
The circumference of the circle is: 125.663706 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 45
>>> Circumference = 2*pi*radius
>>> print("The circumference of the circle is:", Circumference,"cm^2")
The circumference of the circle is: 282.7433385 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 60
>>> Circumference = 2*pi*radius
>>> print("The circumference of the circle is:", Circumference,"cm^2")
The circumference of the circle is: 376.99111800000003 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 55
>>> Circumference = 2*pi*radius
>>> print("The circumference of the circle is:", Circumference,"cm^2")
The circumference of the circle is: 345.5751915 cm^2
>>>
>>> radius = int(input("Enter radius:"))
Enter radius: 98
>>> Circumference = 2*pi*radius
>>> print("The circumference of the circle is:", Circumference,"cm^2")
The circumference of the circle is: 615.7521594000001 cm^2
>>>
>>>
#----------------------------------------------------------------------------------
--
>>>
>>> #Area of a triangle
>>>
>>> height = int(input("Enter height:"))
Enter height: 95
>>> base = int(input("Enter width:"))
Enter width: 55
>>> area = 0.5*base*height
>>> print("The area of the triangle is:", area,"cm^2")
The area of the triangle is: 2612.5 cm^2
>>>
>>> height = int(input("Enter height:"))
Enter height: 120
>>> base = int(input("Enter width:"))
Enter width: 100
>>> area = 0.5*base*height
>>> print("The area of the triangle is:", area,"cm^2")
The area of the triangle is: 6000.0 cm^2
>>>
>>> height = int(input("Enter height:"))
Enter height: 175
>>> base = int(input("Enter width:"))
Enter width: 310
>>> area = 0.5*base*height
>>> print("The area of the triangle is:", area,"cm^2")
The area of the triangle is: 27125.0 cm^2
>>>
>>> height = int(input("Enter height:"))
Enter height: 375
>>> base = int(input("Enter width:"))
Enter width: 260
>>> area = 0.5*base*height
>>> print("The area of the triangle is:", area,"cm^2")
The area of the triangle is: 48750.0 cm^2
>>>
>>> height = int(input("Enter height:"))
Enter height: 480
>>> base = int(input("Enter width:"))
Enter width: 290
>>> area = 0.5*base*height
>>> print("The area of the triangle is:", area,"cm^2")
The area of the triangle is: 69600.0 cm^2
>>>
>>> #The end of Task 2 - Input Variables