When users post an update on social media,such as a URL, image, status update etc., other users in their network are able to view this new post on their news feed. Users can also see exactly when the post was published, i.e, how many hours, minutes or seconds ago.
Since sometimes posts are published and viewed in different time zones, this can be confusing. You are given two timestamps of one such post that a user can see on his newsfeed in the following format:
Day dd Mon yyyy hh:mm:ss +xxxx
Here +xxxx represents the time zone. Your task is to print the absolute difference (in seconds) between them.
Input Format
The first line contains , the number of testcases. Each testcase contains lines, representing time and time .
Constraints
Input contains only valid timestamps
.
Output Format
Print the absolute difference in seconds.
Sample Input 0
2Sun 10 May 2015 13:54:36 -0700Sun 10 May 2015 13:54:36 -0000Sat 02 May 2015 19:54:36 +0530Fri 01 May 2015 13:54:36 -0000
Sample Output 0
2520088200
Explanation 0
In the first query, when we compare the time in UTC for both the time stamps, we see a difference of 7 hours. which is seconds or seconds.
Similarly, in the second query, time difference is 5 hours and 30 minutes for time zone adjusting for that we have a difference of 1 day and 30 minutes. Or 24*3600+30*60 =>88200
Basically,namedtuplesare easy to create, lightweight object types.
They turn tuples into convenient containers for simple tasks. With namedtuples, you don’t have to use integer indices for accessing members of a tuple.
>>> from collections import namedtuple
>>> Car = namedtuple('Car','Price Mileage Colour Class')
>>> xyz = Car(Price = 100000, Mileage = 30, Colour = 'Cyan', Class = 'Y')
>>> print xyz
Car(Price=100000, Mileage=30, Colour='Cyan', Class='Y')
>>> print xyz.Class
Y
Task
Dr. John Wesley has a spreadsheet containing a list of student's , , and .
Your task is to help Dr. Wesley calculate the average marks of the students.
Note:
1. Columns can be in any order. IDs, marks, class and name can be written in any order in the spreadsheet
2. Column names are ID, MARKS, CLASS and NAME. (The spelling and case type of these names won't change.)
Input Format
The first line contains an integer , the total number of students. The second line contains the names of the columns in any order. The next lines contains the , , and , under their respective column names.
Constraints
Output Format
Print the average marks of the list corrected to 2 decimal places.
Sample Input
TESTCASE 01
5
ID MARKS NAME CLASS
1 97 Raymond 7
2 50 Steven 4
3 91 Adrian 9
4 72 Stewart 5
5 80 Peter 6
TESTCASE 02
5
MARKS CLASS NAME ID
92 2 Calum 1
82 5Scott 2
94 2 Jason 3
55 8 Glenn 4
82 2 Fergus 5
Sample Output
TESTCASE 01
78.00
TESTCASE 02
81.00
Explanation
TESTCASE 01
Average =
Can you solve this challenge in 4 lines of code or less? NOTE: There is no penalty for solutions that are correct but have more than 4 lines.