Skip to content

Commit 53fd63f

Browse files
files
1 parent 943e4a3 commit 53fd63f

File tree

4 files changed

+135
-0
lines changed

4 files changed

+135
-0
lines changed

String's/Alphabet Rangoli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import string
2+
st = string.ascii_lowercase
3+
lst = list()
4+
def print_rangoli(size):
5+
for i in range(size):
6+
s="-".join(st[i:size])
7+
lst.append((s[::-1]+s[1:]).center(4*size-3,"-"))
8+
print("\n".join(lst[::-1]+lst[1:]))
9+
10+
if __name__ == '__main__':
11+
n = int(input())
12+
print_rangoli(n)

String's/Alphabet Rangoli.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
You are given an integer, . Your task is to print an alphabet rangoli of size . (Rangoli is a form of Indian folk art based on creation of patterns.)
2+
3+
Different sizes of alphabet rangoli are shown below:
4+
5+
#size 3
6+
7+
----c----
8+
--c-b-c--
9+
c-b-a-b-c
10+
--c-b-c--
11+
----c----
12+
13+
#size 5
14+
15+
--------e--------
16+
------e-d-e------
17+
----e-d-c-d-e----
18+
--e-d-c-b-c-d-e--
19+
e-d-c-b-a-b-c-d-e
20+
--e-d-c-b-c-d-e--
21+
----e-d-c-d-e----
22+
------e-d-e------
23+
--------e--------
24+
25+
#size 10
26+
27+
------------------j------------------
28+
----------------j-i-j----------------
29+
--------------j-i-h-i-j--------------
30+
------------j-i-h-g-h-i-j------------
31+
----------j-i-h-g-f-g-h-i-j----------
32+
--------j-i-h-g-f-e-f-g-h-i-j--------
33+
------j-i-h-g-f-e-d-e-f-g-h-i-j------
34+
----j-i-h-g-f-e-d-c-d-e-f-g-h-i-j----
35+
--j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j--
36+
j-i-h-g-f-e-d-c-b-a-b-c-d-e-f-g-h-i-j
37+
--j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j--
38+
----j-i-h-g-f-e-d-c-d-e-f-g-h-i-j----
39+
------j-i-h-g-f-e-d-e-f-g-h-i-j------
40+
--------j-i-h-g-f-e-f-g-h-i-j--------
41+
----------j-i-h-g-f-g-h-i-j----------
42+
------------j-i-h-g-h-i-j------------
43+
--------------j-i-h-i-j--------------
44+
----------------j-i-j----------------
45+
------------------j------------------
46+
The center of the rangoli has the first alphabet letter a, and the boundary has the alphabet letter (in alphabetical order).
47+
48+
Input Format
49+
50+
Only one line of input containing , the size of the rangoli.
51+
52+
Constraints
53+
54+
55+
Output Format
56+
57+
Print the alphabet rangoli in the format explained above.
58+
59+
Sample Input
60+
61+
5
62+
Sample Output
63+
64+
--------e--------
65+
------e-d-e------
66+
----e-d-c-d-e----
67+
--e-d-c-b-c-d-e--
68+
e-d-c-b-a-b-c-d-e
69+
--e-d-c-b-c-d-e--
70+
----e-d-c-d-e----
71+
------e-d-e------
72+
--------e--------

String's/Capitalize!.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
lst=list()
9+
lst1=list()
10+
def solve(s):
11+
lst=s.split(" ")
12+
13+
for i in lst:
14+
lst1.append(i.capitalize())
15+
16+
return(" ".join(lst1))
17+
18+
if __name__ == '__main__':
19+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
20+
21+
s = input()
22+
23+
result = solve(s)
24+
25+
fptr.write(result + '\n')
26+
27+
fptr.close()

String's/Capitalize!.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
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.
2+
3+
4+
Given a full name, your task is to capitalize the name appropriately.
5+
6+
Input Format
7+
8+
A single line of input containing the full name, .
9+
10+
Constraints
11+
12+
The string consists of alphanumeric characters and spaces.
13+
Note: in a word only the first character is capitalized. Example 12abc when capitalized remains 12abc.
14+
15+
Output Format
16+
17+
Print the capitalized string, .
18+
19+
Sample Input
20+
21+
chris alan
22+
Sample Output
23+
24+
Chris Alan

0 commit comments

Comments
 (0)