Photo AI

Write a Python program that calculates an estimate of the braking distance in metres for a new model of go-kart that is travelling between 10 and 50 kilometres per hour (kph) - AQA - GCSE Computer Science - Question 18 - 2021 - Paper 1

Question icon

Question 18

Write-a-Python-program-that-calculates-an-estimate-of-the-braking-distance-in-metres-for-a-new-model-of-go-kart-that-is-travelling-between-10-and-50-kilometres-per-hour-(kph)-AQA-GCSE Computer Science-Question 18-2021-Paper 1.png

Write a Python program that calculates an estimate of the braking distance in metres for a new model of go-kart that is travelling between 10 and 50 kilometres per h... show full transcript

Worked Solution & Example Answer:Write a Python program that calculates an estimate of the braking distance in metres for a new model of go-kart that is travelling between 10 and 50 kilometres per hour (kph) - AQA - GCSE Computer Science - Question 18 - 2021 - Paper 1

Step 1

keep asking the user to enter a speed for the go-kart until they enter a speed that is between 10 and 50 (inclusive)

96%

114 rated

Answer

speed = 0
while speed < 10 or speed > 50:
    speed = float(input('Enter the speed of the go-kart (10-50 kph): '))

Step 2

calculate the braking distance in metres by dividing the speed by 5

99%

104 rated

Answer

braking_distance = speed / 5

Step 3

ask the user if the ground is wet

96%

101 rated

Answer

is_wet = input('Is the ground wet? (yes/no): ').lower()

Step 4

if the ground is wet, multiply the braking distance by 1.5

98%

120 rated

Answer

if is_wet == 'yes':
    braking_distance *= 1.5

Step 5

output the final calculated braking distance

97%

117 rated

Answer

print(f'The calculated braking distance is: {braking_distance:.2f} metres')

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;