Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Ticket Selling Time Problem

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Ticket Selling Time Problem. Start with the requirements on the right.

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.

Problem

An Infosys campus shuttle conductor sells tickets at a constant rate. Given the number of tickets to sell and the number sold per hour, calculate the total time required in hours.

Implement a function that divides the required ticket count by the hourly selling rate. The result may be a whole number or a decimal. Assume the rate remains constant throughout the process.

Formal Specification

  • Input: two positive integers, tickets and tickets_per_hour.
  • Output: a number representing the required time in hours.
  • Do not round the result unless the division produces an exact integer.

Constraints

  • 1 <= tickets <= 10^9
  • 1 <= tickets_per_hour <= 10^9
  • The selling rate is constant and positive

Function Signature

def calculate_sales_time(tickets, tickets_per_hour):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output