Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A bus travels at for hours. Write a program that reads the speed and the time, and shows the distance.
distance = speed times time.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Plan. Distance is speed times time.
float(input(...)).speed * hours.Check. .
Answer: kilometres. The program shows 150.0.
Log in to join the discussion.
Loading…