0% found this document useful (0 votes)
2 views3 pages

VariablesDataTypes

The document outlines basic programming concepts related to data types and input in Python, including how information is stored as binary code. It provides examples of data types such as integer, string, and float, and explains commands like 'int' and 'float'. Additionally, it includes tasks for creating programs to calculate the area of rectangles and triangles, as well as the volume and surface area of cuboids.

Uploaded by

niki.joshi0311
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

VariablesDataTypes

The document outlines basic programming concepts related to data types and input in Python, including how information is stored as binary code. It provides examples of data types such as integer, string, and float, and explains commands like 'int' and 'float'. Additionally, it includes tasks for creating programs to calculate the area of rectangles and triangles, as well as the volume and surface area of cuboids.

Uploaded by

niki.joshi0311
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Name: Nikita Group: 9A

Variables & Data Types Co-Pilot

1.) How is information stored in a computer?

Computers store data by converting it into a binary code of 1s and 0s, known as bit

DATA TYPE DESCRIPTION


An integer is a whole number that can be positive, negative, or zero, and does not inclu
integer

A sequence of characters
string

A function or reusable code in the Python programming language that


float converts values into floating point numbers.

2.) In Python this year, we have to deal with 4 data types, what are they?
Integer, Boolean, string, float
3.) What does the command ‘int’ do?

Converts the specified number into an integer

4.) What does the command ‘float’ do?

A data type in programming for non-whole numbers or a css page for a webpage layout.

5.) Explain why 1 + 1 could equal 11 in Python?

They see numbers as text rather than numbers, so it becomes concatenated.

Task A – Rectangle Program (Basic)

3.1.9 – Different Types Of Input


Name: Nikita Group: 9A
Create a program called Rectangle Area Calculator (don't forget your program header and
comments). The program will ask the user to input:

 The rectangle’s length


 The rectangle’s height

It will then calculate the area of a rectangle with these dimensions.

# Rectangle Area Calculator, Nikita Joshi, 27th November 2025

length = int(input("Please enter a number for the length of the rectangle. e.g 8: "))

# takes an input from the user as an integer and stores it in a variable called length

height = int(input("Please enter a number for the height of the rectangle. e.g. 5: "))

# takes an input from the user as an integer and stores it in a variable called height

area = length * height

# multiplies the value in length by the value in height and stores it in a variable called area

print("The area of this rectangle is",area, "cm squared")

# outputs a message with the calculated area

Task B – Triangle Program (Medium)

Extend your program, so that as well as working out the area of a rectangle, it then works out the
area of a right-angled triangle with the given length/height...

length = int(input("Please enter a number for the length of the triangle. e.g 9: "))

# takes an input from the user as an integer and stores it in a variable called length

height = int(input("Please enter a number for the height of the rectangle. e.g. 7: "))

# takes an input from the user as an integer and stores it in a variable called height

area = length * height / 2

# multiplies the value in length by the value in height and stores it in a variable called area

print("The area of this rectangle is",area, "cm squared")

# outputs a message with the calculated area # Write your code here :-)

Task C – Surface Area/Volume (Hard)

3.1.9 – Different Types Of Input


Name: Nikita Group: 9A
Create a new program called “Cuboid Calculator” (don't forget your program header and
comments). The program will ask the user to input:

 A cuboids length
 The cuboid’s width
 The cuboids height

It will then calculate the volume and surface area of a rectangle with these dimensions:

# Cuboid Calculator
length = int(input("Please enter a number for the length of the cuboid. e.g 15: "))
# takes an input from the user as an integer and stores it in a variable called length
height = int(input("Please enter a number for the height of the cuboid. e.g. 6: "))
# takes an input from the user as an integer and stores it in a variable called height
width = int(input("Please enter a number for the width of the cuboid. e.g. 10: "))
surface_area = ((length * height) + (width * height) + (length * height))*2
# multiplies the value in length, height and width by the value ana adding it all and stores it in a variable
called surface area
print("The surface area of this cuboid is",surface_area, "cm squared")
# outputs a message with the calculated surface area
volume = length * width * height
# multiples the value in length, width and height and stores it in a variable called volume
print("The volume of this cuboid is",volume, "cm cubed")
# outputs a message area with a calculated volume

3.1.9 – Different Types Of Input

You might also like