Untitled
import datetime import pyttsx3 # Initialize the text-to-speech engine engine = pyttsx3.init() # Function to speak out the text in Arabic def speak(text): engine.say(text) engine.runAndWait() # Function to greet the user in Arabic def greet_user(): print("مرحباً! أنا قوارندرا، مساعدك الشخصي.") speak("مرحباً! أنا قوارندرا، مساعدك الشخصي.") print("كيف يمكنني مساعدتك؟") speak("كيف يمكنني مساعدتك؟") # Function to respond to 'What time is it' in Arabic def tell_time(): now = datetime.datetime.now() time_str = now.strftime("%H:%M:%S") print(f"الوقت الآن هو: {time_str}") speak(f"الوقت الآن هو: {time_str}") # Function to respond to 'What is the date' in Arabic def tell_date(): today = datetime.date.today() date_str = today.strftime("%d/%m/%Y") print(f"التاريخ اليوم هو: {date_str}") speak(f"التاريخ اليوم هو: {date_str}") # Main function to handle different commands def qawandra_assistant(): greet_user() while True: print("\nأكتب 'الوقت' لمعرفة الوقت.") print("أكتب 'التاريخ' لمعرفة التاريخ.") print("أكتب 'خروج' للخروج.") user_input = input("أكتب هنا: ").strip().lower() if user_input == 'الوقت': tell_time() elif user_input == 'التاريخ': tel
Leave a Comment