title-img


Text Wrap Python

You are given a string S and width w. Your task is to wrap the string into a paragraph of width w. Input Format: The first line contains a string, S. The second line contains the width, w. Constraints: 0<len(S)<1000 0<w<len(S) Output Format: Print the text wrapped paragraph.

View Solution →

Designer Door Mat Python

Mr. Vincent works in a door mat manufacturing company. One day, he designed a new door mat with the following specifications: 1. Mat size must be MXN. (N is an odd natural number, and M is 3 times N.) 2. The design should have 'WELCOME' written in the center. 3. The design pattern should only use |, . and - characters. Sample Designs: Size: 7 x 21 ---------.|.--------- ------.|..|..|.------ ---.|..|..|..|..|.--- -------WELCOME------- ---

View Solution →

Alphabet Rangoli Python

You are given an integer, N. Your task is to print an alphabet rangoli of size N. (Rangoli is a form of Indian folk art based on creation of patterns.) Different sizes of alphabet rangoli are shown below: #size 3 ----c---- --c-b-c-- c-b-a-b-c --c-b-c-- ----c---- #size 5 --------e-------- ------e-d-e------ ----e-d-c-d-e---- --e-d-c-b-c-d-e-- e-d-c-b-a-b-c-d-e --e-d-c-b-c-d-e-- ----e-d-c-d-e---- ------e-d-e------ --------e-------- #size 10 ------------------j------

View Solution →

Capitalize! Python

You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. alison heck => Alison Heck Given a full name, your task is to capitalize the name appropriately. Input Format: A single line of input containing the full name, S. Constraints: 0<len(S)<1000 The string consists of alphanumeric characters and spaces. Note: in a word only the first character is

View Solution →

The Minion Game Python

Kevin and Stuart want to play the 'The Minion Game'. Game Rules Both players are given the same string, S. Both players have to make substrings using the letters of the string S. Stuart has to make words starting with consonants. Kevin has to make words starting with vowels. The game ends when both players have made all possible substrings. Scoring A player gets +1 point for each occurrence of the substring in the string S. For Example: String S = BANANA Kevin's vowel beginnin

View Solution →