(1). String Split and Join
Replace " " space with "-"
An example
Input
this is a string
Output
this-is-a-string
(2). What's Your Name?
You are given the firstname and lastname of a person on two different lines. Your task is to read them and print the following:
Input:
Ross
Taylor
Output:
Hello Ross Taylor! You just delved into python.
(3). Mutations
We have seen that lists are mutable (they can be changed), and tuples are immutable (they cannot be changed). Let's try to understand this with an example. You are given an immutable string, and you want to make changes to it.
input:
abracadabra
5 k
output:
abrackdabra
(4). Find a string
In this challenge, the user enters a string and a substring. You have to print the number of times that the substring occurs in the given string. String traversal will take place from left to right, not from right to left.
input
ABCDCDC
CDC
output
2
(5). String Validators
You are given a string S.
Your task is to find out if the string S contains: alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters.
In the first line, print True if S has any alphanumeric characters. Otherwise, print False.
In the second line, print True if S has any alphabetical characters. Otherwise, print False.
In the third line, print True if S has any digits. Otherwise, print False.
In the fourth line, print True if S has any lowercase characters. Otherwise, print False.
In the fifth line, print True if S has any uppercase characters. Otherwise, print False.
(6). Text Wrap
You are given a string S and width .
Your task is to wrap the string into a paragraph of width w.
Input
ABCDEFGHIJKLIMNOQRSTUVWXYZ
4
Output
ABCD
EFGH
IJKL
IMNO
QRST
UVWX
YZ
(7). Time Delta
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 yyy 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 2015 13:54:36 -0000
Sat 02 May 2015 19:54:36 +0530
Fri 01 May 2015 13:54:36 -0000
Sample Output 0
25200
88200
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 7 x 3600 seconds or 25200 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 x 3600 + 30 x 60 = 88200
(8). Find Angle MBC
ABC is a right triangle, 90 deg at B.
Therefore, angle ABC = 90 deg.
Point M is the midpoint of hypotenuse AC.
You are given the lengths AB and BC.
Your task is to find angle MBC (angle theta, as shown in the figure) in degrees.
(9). Triangle Quest 2
python
palindromic
You are given a positive integer N.
Your task is to print a palindromic triangle of size N.
For example, a palindromic triangle of size 5 is:
Input
5
Output
1
121
12321
1234321
123454321
(10). Calendar Module
A single line of input containing the space separated month, day and year, respectively, in MM DD YYYY
Sample Input
08 05 2015
Sample Output
WEDNESDAY