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