Skip to main content

Code #11 Speak Function

                GREETINGS TO ALL YOU!!!! This is text to speak converter Function from  win32com.client  import  Dispatch def   speak (str):     speak = Dispatch( "SAPI.spVoice" )     speak.Speak( str ) if  __name__  ==   "__main__" :     speak("# your text goes here")

Code #8 Error Handling Program

 GREETINGS TO ALL OF YOU!!!!!!

#WE ARE GOING TO HAVE A LOOK TO ERROR HANDLING TOPIC 
#IN PYTHON THERE ARE 4 MAIN ERROR HANDING KEYWORD

  • try: is a keyword were we write our logic of the program
  • except: is a keyword which helps us to catch the error and it only runs when there is an error in the program
  • else: is conditional keyword 
  • finally: is a keyword which is not so important but for making our program more efficient
# so let's start with our program, we will make a average finding tool

# this program will take to  total marks of the user and take total number of subject:

n=input("Enter your Name: ")
total_marks=int(input("enter the total marks: "))
total_subject=int(input("enter the total subject: "))
try:
print(total_marks/total_subject)
except ZeroDivisionError:
print("there should be atleast 1 subject")
else:
print("succesfully done:")

finally:
print(f"thank you {n} for taking our help")

thank you guys!!!!
instagram id: vaibhav singh_star

Comments

Popular posts from this blog

Code#3 Factorial problem, Recursion and Iterative Method PROGRAM

GREETINGS TO ALL OF YOU!!  Factorial problem, Recursion and Iterative Method   #  Recursion Method  def fac2 (n): if n== 1 : return 1 else : return n*fac2(n- 1 ) number = int ( input ( "enter your number" )) print ( 'factorial of your given number by recursion method :' ,fac2(number)) # Iterative Method  def fac1 (n): fac= 1 for i in range (n): fac=fac*(i+ 1 ) return fac number= int ( input ( "enter your number: " )) print ( "factorial of your given number by iterative method:" ,fac1(number))

Code #11 Speak Function

                GREETINGS TO ALL YOU!!!! This is text to speak converter Function from  win32com.client  import  Dispatch def   speak (str):     speak = Dispatch( "SAPI.spVoice" )     speak.Speak( str ) if  __name__  ==   "__main__" :     speak("# your text goes here")