Here's an example Python program that takes input from the user for the speed of a vehicle (in miles per hour) and the time it has travelled, and then outputs the distance travelled in hourly increments as a list of comma-separated values:
python
# get speed and time from user input
speed = int(input("Enter the speed of the vehicle (in mph): "))
time = int(input("Enter the time travelled (in hours): "))
# calculate distance travelled in each hour
distances = []
for t in range(1, time+1):
distance = speed * t
distances.append(distance)
# output distances as a comma-separated list
print("Distances travelled: " + ", ".join(str(d) for d in distances))
# get speed and time from user input
speed = int(input("Enter the speed of the vehicle (in mph): "))
time = int(input("Enter the time travelled (in hours): "))
# calculate distance travelled in each hour
distances = []
for t in range(1, time+1):
distance = speed * t
distances.append(distance)
# output distances as a comma-separated list
print("Distances travelled: " + ", ".join(str(d) for d in distances))
Here's an example of how the program might be run and what the output might look like:
java
# get speed and time from user input
speed = int(input("Enter the speed of the vehicle (in mph): "))
time = int(input("Enter the time travelled (in hours): "))
# calculate distance travelled in each hour
distances = []
for t in range(1, time+1):
distance = speed * t
distances.append(distance)
# output distances as a comma-separated list
print("Distances travelled: " + ", ".join(str(d) for d in distances))
Enter the speed of the vehicle (in mph): 40
Enter the time travelled (in hours): 3
Distances travelled: 40, 80, 120
In this example, the user entered a speed of 40 mph and a time travelled of 3 hours, and the program output a list of distances travelled in hourly increments of 40 miles, 80 miles, and 120 miles.