Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Tape Length Calculation
00:00
5 left

Tape Length Calculation

EasyPython

Problem

Imperial College London facilities may need to estimate how much tape remains on a roll. Given the roll's outer radius, empty-core radius, tape width, and tape thickness, calculate the tape length.

Treat the wound tape as the annular region between the core and the outer surface. Use volume conservation: the volume of the wound tape equals the volume of a rectangular strip with length L, width w, and thickness t.

Formal Specification

Implement tape_length(outer_radius, core_radius, width, thickness). All dimensions are positive real numbers in the same unit. Return the tape length in that unit as a floating-point number. The tape is wound tightly, with no gaps or compression.

The roll volume is:

π * (outer_radius² - core_radius²) * width

The tape volume is:

length * width * thickness

Therefore, calculate the length without iterating through individual layers. The supplied width must be accepted even though it cancels algebraically.

Constraints

  • 0 < core_radius <= outer_radius <= 10^6
  • 0 < width <= 10^4
  • 0 < thickness <= 10^3
  • All dimensions use consistent units
  • The answer must be accurate to at least 1e-6 relative or absolute error

Function Signature

def tape_length(outer_radius, core_radius, width, thickness):
Interviewer

Your question is Tape Length Calculation. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.