0

ineed calcualte A simple trip duration in Python

ineed calcualte A simple trip duration in Python exemple : deppar : " 08.15" arrival :" 22:30 " Time trip is : " ? " But without import datetime

24th Jan 2023, 2:10 PM
mohammed akallaa
mohammed akallaa - avatar
2 Respostas
+ 10
mohammed akallaa , to see what your issue is, we need to see your attempt. > please link your code here. > also give a description what problem do you have
24th Jan 2023, 2:59 PM
Lothar
Lothar - avatar
+ 9
mohammed akallaa , here some hints how it could be done: the best way is to break both times down to minutes, calculate the diff, and get hours and minutes of this. > take input from *start time*, strip off spaces, split it in hours and minutes, convert each to integer. > do the same with *end time*. > (for start and end): use hours and minutes and calculate each to total minutes. > calculate the difference of end_total_minutes - start_total_minutes. > use this difference from last step and get now hours and minutes by using 2 divisions (// division and % division).
24th Jan 2023, 4:33 PM
Lothar
Lothar - avatar