Skip to content

Commit 5258a8c

Browse files
Added python files
Added python graphics , random team generator and text audio generator
1 parent f3dabfe commit 5258a8c

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

Random Team Generator.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import random
2+
y = ["abhinav","sravan","koundinya","ajitesh","teja","tt"]
3+
t1 = []
4+
t2 = []
5+
while (len(y) != 0):
6+
x = random.choice(y)
7+
if (len(t1) == len(t2)):
8+
t1.append(x)
9+
y.remove(x)
10+
elif (len(t1) > len(t2)):
11+
t2.append(x)
12+
y.remove(x)
13+
print("Team A: ", t1)
14+
print("Team B: ", t2)
15+

python graphics.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import random
2+
import turtle
3+
colors = ['violet','indigo','blue','green','yellow','orange','red'] # Added VIBGYOR
4+
t = turtle.Turtle()
5+
t.speed(10)
6+
turtle.bgcolor("black")
7+
length=100
8+
angle =50
9+
size=5
10+
for i in range(length):
11+
color=random.choice(colors)
12+
t.pencolor(color)
13+
t.fillcolor(color)
14+
t.penup()
15+
t.forward(i+50)
16+
t.pendown()
17+
t.left(angle)
18+
t.begin_fill()
19+
t.circle(size)
20+
t.end_fill()
21+
turtle.exitonclick()
22+
turtle.bgcolor("black")
23+

text-audio-generator.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'''
2+
Before running this code, do type these commands in command prompt.
3+
--> pip install gTTS
4+
--> pip install playsound
5+
'''
6+
from gtts import gTTS
7+
8+
from playsound import playsound
9+
text_val = input("Enter the text which you want to convert: ") # Example : 'Learn Some Cool and Basic Python Programs here.' #
10+
11+
language = 'en'
12+
obj = gTTS(text=text_val, lang=language, slow=False)
13+
obj.save("python.mp3") # This helps to save our audio file in the existing folder.
14+
15+
playsound("python.mp3") # This runs the audio when you run the program.

0 commit comments

Comments
 (0)