Upcoming technologies, programming, problem solving, coding, technology, mobile phones
About us
Get link
Facebook
X
Pinterest
Email
Other Apps
In this blog you will be able to learn python-programming language and problem solving. You can also find solutions for hackerrank problems, google coding problems.
Solution for hackerRank problem Time Delta in Python Problem : 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 T, the number of testcases. Each testcase contains 2 lines, representing time t1 and time t2. Constraints Input contains only valid timestamps year <= 3000 Output Format Print the absolute difference (t1-t2) in seconds. Sample Input 0 2 Sun 10 May 2015 13:54:36 -0700 Sun 10 May...
Run python script from command line Step 1: In order to run a python script in command line we need a python interpreter that is to be downloaded and installed. Click here to download Python for Windows. Click here to download Python for Linux/Unix. Click here to download Python for Mac OS Select the python version you want to download (Downloading the latest version is recommended). Then install the executable file that has been downloaded. Step 2 : The next step is to set path variable. To set path follow the following steps: Go to my computer -> select properties -> select advanced settings -> select environment variable -> new. In variable name write path and in variable value copy the path of Python interpreter downloaded. Then click ok Now path is set for executing python script. Step 3 : First we must have a python file to execute. Open any text editor (Notepad or Notepad++) Copy the python code give below in the text editor. print("Welcome to ...
Solution for hackerRank problem Arrays-DS in Python Problem : An array is a type of data structure that stores elements of the same type in a contiguous block of memory. In an array, A , of size N, each memory location has some unique index, i(where 0 <= i < N), that can be referenced as A[i] or Ai. Reverse an array of integers. Note: If you've already solved our C++ domain's Arrays Introduction challenge, you may want to skip this. Example A = [1, 2, 3] Return [3, 2, 1]. Function Description Complete the function reverseArray in the editor below. reverseArray has the following parameter(s): int A[n]: the array to reverse Returns int[n]: the reversed array Input Format The first line contains an integer, N, the number of integers in A. The second line contains N space-separated integers that make up A. Constraints 1 <= N <= 10^3 1 <= A[i] <= 10^4, where A[i] is the ith integer in A Sample Input 1 Sample Output 1 2 3 4 1 Code : #!/bin/python3 import math impor...
Comments
Post a Comment