Python Forum
school assignment help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
school assignment help
#1
good morning
I'm a total noob and trying to learn about python for school
I'm stuck on an assignment any help will be amazing and any video/pdf i can read/watch to learn more about it would be awesome thank you

the assignment is
Write a program in cube.py that takes the length of an edge (an integer) as input and prints the cube’s surface area as output (LO: 2.4).
Reply
#2
what have you tried and what specific problem you can not resolve on your own? We are not going to do your school assignment for you.
Do you know how to solve this math problem with pencil and paper? Split the task in small chunks and amd complete them one by one
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
sorry I did tried

lenght = int(input("Enter the lenght of the edge of the cube: "))
surfaceArea = 6 * (lenght **2)
print("The surface area of the cube is:" )
buran write Feb-25-2025, 08:26 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply
#4
You actually did it. You just need to include surfaceArea (the result of calculations in the output)

edge_length = int(input("Enter the length of the edge of the cube: "))
surface_area = 6 * edge_length ** 2
print(f"The surface area of the cube is: {surface_area}")
or if you don't need variable surface_area

edge_length = int(input("Enter the length of the edge of the cube: "))
print(f"The surface area of the cube is: {6 * edge_length ** 2}")
output
Output:
Enter the length of the edge of the cube: 2 The surface area of the cube is: 24
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Photo Help needed for School Assignment keeratkaur 2 1,295 Aug-06-2024, 07:28 AM
Last Post: keeratkaur
  Need help with a tough school assignment datson79 5 4,406 Feb-18-2019, 06:01 PM
Last Post: ichabod801
  School Work Assignment: Snake Game DarksideMoses 6 6,733 Apr-29-2018, 10:56 PM
Last Post: DarksideMoses
  Array to get profit (school assignment) harryvandervelden 2 3,421 Nov-28-2017, 05:48 PM
Last Post: Larz60+
  School assignment Ronaldo 5 10,409 Jan-08-2017, 11:57 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020