Skip to content

Instantly share code, notes, and snippets.

View gkfarwaha's full-sized avatar

GAURAV KUMAR FARWAHA gkfarwaha

  • india
View GitHub Profile
@gkfarwaha
gkfarwaha / txt2speech.py
Created October 15, 2020 09:14
input text to audio file
from gtts import gTTS
import os
str = input("Please enter the text to convert it into audio file \n", ) # taking input from the user to convert it into audio file
txt = str
# txt="hello world"
lan = 'en'
output = gTTS(text=txt, lang=lan, slow=False)
output.save("txt2sph.mp3")
@gkfarwaha
gkfarwaha / filetxt2mp3.py
Created October 15, 2020 09:12
reading file txt and converting it into audio file
from gtts import gTTS
import os
# mytext="Text to speech conversion using python"
# to convert file text into mp3 file output
# create a var to handle and open the file
fh = open("test.txt", "r") # this variable is used to open the file,open is the function to open file,
# hve to create test.txt file by ourslf
mytext = fh.read().replace("\n", " ") # varible to read the file leaving out new lines & spaces
@gkfarwaha
gkfarwaha / REVERSE STRING.py
Created October 15, 2020 06:40
reversing the string
# GET YOUR LINE PRINTED BACKWARDS
print("Enter the string you want to print backward")
str1 = input()
print("String entered by you as follows\n", str1)
print("String entered by you in upper case as follows\n", str1.upper())
print("String entered by you in lower as follows\n", str1.lower())
x = int(len(str1))
print("Length of the string: ", x)
i = x
print(type(i))
@gkfarwaha
gkfarwaha / CALCULATOR
Last active October 13, 2020 10:19
CALCULATOR
#THIS THE BASIC CALCULATOR WHICH OPTIONS TO SELECT FROM.
print("WELCOME TO THE PYTHON CALCULATOR")
a= int( input("enter your FIRST NO. ", ))
b= int(input("enter your SECOND NO. ", ))
print("SELECT M FOR MULTIPLICATION OF TWO NOS. \nSELECT D FOR DIVISION OF TWO NOS. \nSELECT A FOR ADDITION OF TWO NOS.\nSELECT S FOR SUBSTRACTION OF TWO NOS.")
x=input("ENTER YOUR CHOICE ",)
print(x)
if x == "m" or x == "M" :
print(a*b)
elif x == "d" or x == "D":