Skip to content

Commit 400b6dd

Browse files
committed
init
1 parent 3b8f00c commit 400b6dd

File tree

8 files changed

+69
-4
lines changed

8 files changed

+69
-4
lines changed

__pycache__/textwrap.cpython-310.pyc

606 Bytes
Binary file not shown.

designdoormat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
n, m = map(int,input().split())
2+
pattern = [('.|.'*(2*i + 1)).center(m, '-') for i in range(n//2)]
3+
print('\n'.join(pattern + ['WELCOME'.center(m, '-')] + pattern[::-1]))

formattednumber.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def print_formatted(number):
2+
# your code goes here
3+
width = len("{0:b}".format(number))
4+
for i in range (1 , number + 1):
5+
print("{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}".format(i,width=width))
6+
if __name__ == '__main__':
7+
n = int(input())
8+
print_formatted(n)

piglatin2.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
sentence = input('Enter a Sentence: ').lower()
2+
words = sentence.split()
3+
4+
for i, word in enumerate(words):
5+
6+
'''
7+
if first letter is a vowel
8+
'''
9+
if word[0] in 'aeiou':
10+
words[i] = words[i]+ "ay"
11+
else:
12+
'''
13+
else get vowel position and postfix all the consonants
14+
present before that vowel to the end of the word along with "ay"
15+
'''
16+
has_vowel = False
17+
18+
for j, letter in enumerate(word):
19+
if letter in 'aeiou':
20+
words[i] = word[j:] + word[:j] + "ay"
21+
has_vowel = True
22+
break
23+
24+
#if the word doesn't have any vowel then simply postfix "ay"
25+
if(has_vowel == False):
26+
words[i] = words[i]+ "ay"
27+
28+
pig_latin = ' '.join(words)
29+
print("Pig Latin: ",pig_latin)

radianstodegrees.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import math
2+
3+
def radians():
4+
pi=22/7
5+
radian = float(input("Input radians: "))
6+
degree = radian*(180/pi)
7+
print(degree)
8+
9+
10+
11+
if __name__ == "__main__":
12+
radians()

sampleprograms.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
def say_hi(name):
2-
print("Hello " + name)
3-
4-
say_hi("Drew")

tempCodeRunnerFile.python

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def print_formatted(number):
2+
# your code goes here
3+
width = len("{0:b}".format(number))
4+
for i in range(1, number + 1):
5+
print("{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}".format(i, width=width))
6+
if __name__ == '__main__':
7+
n = int(input())
8+
print_formatted(n)

textwrap.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import textwrap
2+
3+
def wrap(string, max_width):
4+
return "\n".join([string[i:i+max_width] for i in range(0, len(string), max_width)])
5+
6+
if __name__ == '__main__':
7+
string, max_width = input(), int(input())
8+
result = wrap(string, max_width)
9+
print(result)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy