Line number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Line number

a = q w e r t y a s d f b h f h g print(???) How can i print only second line or each second liter from all lines? Like >>> a s d f or >>> w s h

27th Aug 2021, 12:10 PM
Александр Грамович
Александр Грамович - avatar
5 Answers
+ 1
Did you try yourself, where is your code?
27th Aug 2021, 12:33 PM
JaScript
JaScript - avatar
+ 1
I want the code, that will count working hours for my friend a = input('Введите список') b = [] for i in a: b.append(i) s = b[-2] + b[-1] s = int(s) q = b[-5] + b[-4] q = int(q) w = b[-8] + b[-7] w = int(w) e = b[-11] + b[-10] e = int(e) resh = q - e resm = s - w print(resh, 'часов', resm, 'минут') Input that: 03.08 10.00-17.30 04.08 10.00-18.00 05.08 10.25-15.00 06.08 8.40-17.30 10.08 8.30-16.30 11.08 10.00-18.40 12.08 10.20-18.40 13.08 10.20-21.30 17.08 7.00-12.00 18.08 7.30-19.00 19.08 10.30-21.00 20.08 9.50 -17.50 24.08 8.20-18.55 25.08 10.30 -19.00 26.08 10.00-19.00
27th Aug 2021, 12:57 PM
Александр Грамович
Александр Грамович - avatar
+ 1
In works only with first line: 7 hours 30 minutes. I need hours in a whole month.
27th Aug 2021, 12:58 PM
Александр Грамович
Александр Грамович - avatar
+ 1
Your code works good. I coded for you the multiple input. Now you can see what happed. The calculation needs a few improvements. https://code.sololearn.com/cYADjsRc7V60/?ref=app
27th Aug 2021, 5:17 PM
JaScript
JaScript - avatar
28th Aug 2021, 1:49 PM
JaScript
JaScript - avatar