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 Finding the percentage in python Problem : The provided code stub will read in a dictionary containing key/value pairs of name:[marks] for a list of students. Print the average of the marks array for the student name provided, showing 2 places after the decimal. Example The query_name is 'beta'. beta's average score is . Input Format The first line contains the integer , the number of students' records. The next lines contain the names and marks obtained by a student, each value separated by a space. The final line contains query_name , the name of a student to query. Constraints 2<=n<=10 0<=marks[i]<=100 length of marks arrays = 3 Output Format Print one line: The average of the marks obtained by the particular student correct to 2 decimal places. Sample Input 0 3 Krishna 67 68 69 Arjun 70 98 63 Malika 52 56 60 Malika Sample Output 0 56.00 Explanation 0 Explanation 0 Marks for Malika are whose av...
1. Cab and Walk Arun is working in an office which is N blocks away from his house. He wants to minimize the time it takes him to the from his house to the office. He can either take the office cab or he can walk to the office. While walking Arun's velocity is V1 m/s and V2 m/s is the velocity of cab. But when he calls the cab it always starts from the office, covers N blocks, collects Arun and goes back to the office. The cab crosses a total distance of N meters when going from office to Arun's house and vice versa , whereas Arun covers a distance of √2*N while walking. Help Arun to decide whether he has to walk or to take the cab to save the time. Input format : A single line containing three integers N, V1 and V2 separated by space. Output format : Print "Walk" or "Cab" accordingly. Sample input 1 : 5 10 15 Sample output 1 : Cab Sample input 2 : 2 10 14 Sample output 2 : Walk Code : Output : 2. End - Sort Given a list A of ...
Solution for hackerRank problem ginortS in Python Problem : You are given a string S. S contains alphanumeric characters only. 'SORTING' Your task is to sort the string S in the following manner: All sorted lowercase letters are ahead of uppercase letters. All sorted uppercase letters are ahead of digits. All sorted odd digits are ahead of sorted even digits. Input Format A single line of input contains the string S. Constraints 0 < len(S) < 1000 Output Format Output the sorted string S. Sample Input Sorting1234 Sample Output ginortS1324 Code : s = str(input()) Upper = [] lower = [] odd_no = [] even_no = [] for i in s: if(i.isupper()): Upper += [i] if(i.islower()): lower += [i] if(i.isnumeric()): if(int(i)%2 == 0): even_no += [i] else : ...
Comments
Post a Comment