Wednesday, May 31, 2017

sWAP cASE

You are given a string S. The task is to Swap Cases. In other words, convert all lowercase letters to uppercase letters and vice versa. For Example: Www.HackerRank.com → wWW.hACKERrANK.COM Pythonist 2 → pYTHONIST 2 Input Format A single line containing a string S. Output Format Print the modified string S. Solution: def swap_case(s):     a = s.swapcase()  ...
Share:

Smallest Discount item

Choose item with the smallest discount offered among n items given Input Format  First line will contain the value of  n Followed by n lines contains item name, cost and discount percent separated by spaces. Output Format The name of the item which offers least discount  a = int(input()) c = 999999 for i in range (a):     b = input().split()    ...
Share:

Balanced Brackets

Given n strings of brackets, determine whether each sequence of brackets is balanced. If a string is balanced, print YES on a new line; otherwise, print NO on a new line. Input Format The first line contains a single integer n denoting the number of strings. Each line  of the  subsequent lines consists of a single string s denoting a sequence...
Share: