├── Arithimatic-Operator.py ├── Avg.of Marks.py ├── CGPA Calculator in python ├── Calcluator.py ├── Email-valid-or-not.py ├── Excel-TO-Json file.py ├── Fun-program.py ├── Lexicography-List.py ├── Merge-String.py ├── PM.py ├── Quiz-Game.py ├── README.md ├── Reverse-list.py ├── Stop watch .py ├── String-Capitalization.py ├── String-Compres.py ├── To-Do-List-Tkinter.py ├── To-Do-List.py ├── functions-presentation ├── ph.no.Valid or not.py └── translator.py /Arithimatic-Operator.py: -------------------------------------------------------------------------------- 1 | def add(x, y): 2 | return x + y 3 | 4 | 5 | def subtract(x, y): 6 | return x - y 7 | 8 | def multiply(x, y): 9 | return x * y 10 | 11 | def divide(x, y): 12 | if y == 0: 13 | return "Cannot divide by zero" 14 | return x / y 15 | 16 | while True: 17 | print("Options:") 18 | print("Enter 'add' for addition") 19 | print("Enter 'subtract' for subtraction") 20 | print("Enter 'multiply' for multiplication") 21 | print("Enter 'divide' for division") 22 | print("Enter 'quit' to end the program") 23 | 24 | user_input = input(": ") 25 | 26 | if user_input == "quit": 27 | break 28 | elif user_input in ("add", "subtract", "multiply", "divide"): 29 | num1 = float(input("Enter first number: ")) 30 | num2 = float(input("Enter second number: ")) 31 | 32 | if user_input == "add": 33 | print("Result: " + str(add(num1, num2))) 34 | elif user_input == "subtract": 35 | print("Result: " + str(subtract(num1, num2))) 36 | elif user_input == "multiply": 37 | print("Result: " + str(multiply(num1, num2))) 38 | elif user_input == "divide": 39 | print("Result: " + str(divide(num1, num2))) 40 | else: 41 | print("Invalid input. Please try again.") 42 | -------------------------------------------------------------------------------- /Avg.of Marks.py: -------------------------------------------------------------------------------- 1 | # Get marks for 5 subjects 2 | subject_marks = [] 3 | 4 | for i in range(5): 5 | mark = float(input(f"Enter marks for subject {i + 1}: ")) 6 | subject_marks.append(mark) 7 | 8 | # Calculate the average 9 | average_marks = sum(subject_marks) / 5 10 | 11 | # Display the average marks 12 | print(f"The average marks for 5 subjects are: {average_marks:.2f}") 13 | -------------------------------------------------------------------------------- /CGPA Calculator in python: -------------------------------------------------------------------------------- 1 | #python project for my college 2 | #get grade points 3 | def get_grade_points(grade): 4 | grade_points = { 5 | 'O': 10, 6 | 'A+': 9, 7 | 'A': 8, 8 | 'B+': 7, 9 | 'B': 6, 10 | 'C': 5, 11 | 'P': 4, 12 | 'F': 0 13 | } 14 | return grade_points.get(grade, 0) 15 | #define calculate formulaaa 16 | def calculate_cgpa(credit_hours, grades): 17 | total_credit_points = 0 18 | total_credits = 0 19 | #uning for loop 20 | for i in range(len(credit_hours)): 21 | credit = credit_hours[i] 22 | grade = grades[i] 23 | grade_point = get_grade_points(grade) 24 | 25 | total_credit_points += credit * grade_point 26 | total_credits += credit 27 | 28 | cgpa = total_credit_points / total_credits 29 | #return the value 30 | return cgpa 31 | #main function 32 | def main(): 33 | num_courses = int(input("Enter the number of courses: ")) 34 | credit_hours = [] 35 | grades = [] 36 | #for loop inside another one loop 37 | for i in range(num_courses): 38 | course_credit = float(input(f"Enter credit hours for course {i+1}: ")) 39 | course_grade = input(f"Enter grade for course {i+1} (O, A+, A, B+, B, C, P, F): ").strip().upper() 40 | #using if conditons 41 | if course_grade not in ['O', 'A+', 'A', 'B+', 'B', 'C', 'P', 'F']: 42 | print("Invalid grade entered. Please enter a valid grade.") 43 | return 44 | 45 | credit_hours.append(course_credit) 46 | grades.append(course_grade) 47 | #output print state ment 48 | cgpa = calculate_cgpa(credit_hours, grades) 49 | print(f"Your CGPA is: {cgpa:.2f}") 50 | #again using conditions 51 | if __name__ == "__main__": 52 | main() 53 | print("Study well and try to score good marks...") -------------------------------------------------------------------------------- /Calcluator.py: -------------------------------------------------------------------------------- 1 | #using tkinter 2 | import tkinter as tk 3 | 4 | def button_click(number): 5 | current = entry.get() 6 | entry.delete(0, tk.END) 7 | entry.insert(0, current + str(number)) 8 | 9 | def clear(): 10 | entry.delete(0, tk.END) 11 | 12 | def evaluate(): 13 | try: 14 | result = eval(entry.get()) 15 | entry.delete(0, tk.END) 16 | entry.insert(0, str(result)) 17 | except: 18 | entry.delete(0, tk.END) 19 | entry.insert(0, "Error") 20 | 21 | # Create the main window 22 | root = tk.Tk() 23 | root.title("Calculator") 24 | 25 | # Create an entry widget for input 26 | entry = tk.Entry(root, width=20) 27 | entry.grid(row=0, column=0, columnspan=4) 28 | 29 | # Define the buttons 30 | buttons = [ 31 | ("7", 1, 0), ("8", 1, 1), ("9", 1, 2), ("/", 1, 3), 32 | ("4", 2, 0), ("5", 2, 1), ("6", 2, 2), ("*", 2, 3), 33 | ("1", 3, 0), ("2", 3, 1), ("3", 3, 2), ("-", 3, 3), 34 | ("0", 4, 0), (".", 4, 1), ("=", 4, 2), ("+", 4, 3), 35 | ] 36 | 37 | # Create and place the buttons on the grid 38 | for (text, row, col) in buttons: 39 | button = tk.Button(root, text=text, padx=20, pady=20, command=lambda t=text: button_click(t)) 40 | button.grid(row=row, column=col) 41 | 42 | # Create the Clear button 43 | clear_button = tk.Button(root, text="Clear", padx=20, pady=20, command=clear) 44 | clear_button.grid(row=5, column=0, columnspan=2) 45 | 46 | # Create the Evaluate button 47 | eval_button = tk.Button(root, text="=", padx=20, pady=20, command=evaluate) 48 | eval_button.grid(row=5, column=2, columnspan=2) 49 | 50 | # Start the main loop 51 | root.mainloop() 52 | -------------------------------------------------------------------------------- /Email-valid-or-not.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | def is_valid_email(email): 4 | # Define a regular expression pattern for email validation 5 | pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' 6 | 7 | if re.match(pattern, email): 8 | return True 9 | else: 10 | return False 11 | 12 | # Input an email address for validation 13 | email = input("Enter an email address: ") 14 | 15 | if is_valid_email(email): 16 | print("Valid email address") 17 | else: 18 | print("Invalid email address") 19 | -------------------------------------------------------------------------------- /Excel-TO-Json file.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | # Read the Excel file into a DataFrame 4 | df = pd.read_excel('your_excel_file.xlsx', sheet_name='Sheet1') 5 | 6 | # Convert the DataFrame to JSON 7 | json_data = df.to_json(orient='records', indent=4) 8 | 9 | # Save the JSON to a file 10 | with open('output.json', 'w') as json_file: 11 | json_file.write(json_data) 12 | -------------------------------------------------------------------------------- /Fun-program.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import messagebox 3 | 4 | # Function to calculate love percentage 5 | def calculate_love(): 6 | your_name = entry_your_name.get() 7 | partner_name = entry_partner_name.get() 8 | 9 | # Make sure both names are entered 10 | if your_name == "" or partner_name == "": 11 | messagebox.showerror("Error", "Please enter both names.") 12 | else: 13 | love_percentage = hash(your_name + partner_name) % 101 14 | result_label.config(text=f"Love Percentage: {love_percentage}%") 15 | 16 | # Create the main window 17 | window = tk.Tk() 18 | window.title("Love Calculator") 19 | 20 | # Create labels 21 | label_your_name = tk.Label(window, text="Your Name:") 22 | label_partner_name = tk.Label(window, text="Partner's Name:") 23 | result_label = tk.Label(window, text="", font=("Helvetica", 18)) 24 | 25 | # Create entry fields 26 | entry_your_name = tk.Entry(window) 27 | entry_partner_name = tk.Entry(window) 28 | 29 | # Create calculate button 30 | calculate_button = tk.Button(window, text="Calculate Love", command=calculate_love) 31 | 32 | # Place widgets on the window 33 | label_your_name.grid(row=0, column=0) 34 | entry_your_name.grid(row=0, column=1) 35 | label_partner_name.grid(row=1, column=0) 36 | entry_partner_name.grid(row=1, column=1) 37 | calculate_button.grid(row=2, columnspan=2) 38 | result_label.grid(row=3, columnspan=2) 39 | 40 | # Start the Tkinter event loop 41 | window.mainloop() 42 | -------------------------------------------------------------------------------- /Lexicography-List.py: -------------------------------------------------------------------------------- 1 | x = int(input()) 2 | y = int(input()) 3 | z = int(input()) 4 | n = int(input()) 5 | 6 | 7 | coordinates = [[i, j, k] for i in range(x + 1) for j in range(y + 1) for k in range(z + 1) if i + j + k != n] 8 | 9 | 10 | print(coordinates) 11 | -------------------------------------------------------------------------------- /Merge-String.py: -------------------------------------------------------------------------------- 1 | def merge_the_tools(string, k): 2 | # your code goes here 3 | 4 | 5 | 6 | n = len(string) 7 | parts = [string[i:i+k] for i in range(0, n, k)] 8 | 9 | for part in parts: 10 | seen = set() 11 | result = [] 12 | for char in part: 13 | if char not in seen: 14 | seen.add(char) 15 | result.append(char) 16 | print("".join(result)) 17 | 18 | 19 | 20 | 21 | 22 | if __name__ == '__main__': 23 | string, k = input(), int(input()) 24 | merge_the_tools(string, k) 25 | -------------------------------------------------------------------------------- /PM.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import messagebox 3 | import pyperclip 4 | 5 | # Sample data (replace with your own) 6 | passwords = { 7 | "example.com": { 8 | "username": "your_username", 9 | "password": "your_password", 10 | }, 11 | # Add more entries as needed 12 | } 13 | 14 | def save_password(): 15 | website = website_entry.get() 16 | username = username_entry.get() 17 | password = password_entry.get() 18 | 19 | if website and username and password: 20 | passwords[website] = {"username": username, "password": password} 21 | website_entry.delete(0, tk.END) 22 | password_entry.delete(0, tk.END) 23 | else: 24 | messagebox.showerror("Error", "Please fill in all fields.") 25 | 26 | def find_password(): 27 | website = website_entry.get() 28 | if website in passwords: 29 | username = passwords[website]["username"] 30 | password = passwords[website]["password"] 31 | password_entry.delete(0, tk.END) 32 | password_entry.insert(0, password) 33 | pyperclip.copy(password) 34 | else: 35 | messagebox.showerror("Error", f"No password found for {website}") 36 | 37 | # Create the main window 38 | root = tk.Tk() 39 | root.title("Password Manager") 40 | 41 | # Create labels 42 | website_label = tk.Label(root, text="Website:") 43 | username_label = tk.Label(root, text="Username:") 44 | password_label = tk.Label(root, text="Password:") 45 | 46 | # Create entry fields 47 | website_entry = tk.Entry(root) 48 | username_entry = tk.Entry(root) 49 | password_entry = tk.Entry(root, show="*") # Show asterisks for password 50 | 51 | # Create buttons 52 | add_button = tk.Button(root, text="Add", command=save_password) 53 | generate_button = tk.Button(root, text="Generate Password") 54 | search_button = tk.Button(root, text="Search", command=find_password) 55 | 56 | # Place widgets on the window 57 | website_label.grid(row=0, column=0) 58 | username_label.grid(row=1, column=0) 59 | password_label.grid(row=2, column=0) 60 | 61 | website_entry.grid(row=0, column=1) 62 | username_entry.grid(row=1, column=1) 63 | password_entry.grid(row=2, column=1) 64 | 65 | add_button.grid(row=3, column=1, sticky="EW") 66 | generate_button.grid(row=2, column=2) 67 | search_button.grid(row=0, column=2) 68 | 69 | # Start the Tkinter event loop 70 | root.mainloop() 71 | -------------------------------------------------------------------------------- /Quiz-Game.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | # Sample question bank (you can expand this) 4 | questions = [ 5 | { 6 | "question": "What is the capital of France?", 7 | "options": ["Paris", "London", "Berlin", "Madrid"], 8 | "correct_answer": "Paris" 9 | }, 10 | { 11 | "question": "Which planet is known as the Red Planet?", 12 | "options": ["Mars", "Venus", "Jupiter", "Mercury"], 13 | "correct_answer": "Mars" 14 | }, 15 | { 16 | "question": "Who wrote the play 'Romeo and Juliet'?", 17 | "options": ["William Shakespeare", "Charles Dickens", "Jane Austen", "Leo Tolstoy"], 18 | "correct_answer": "William Shakespeare" 19 | } 20 | ] 21 | 22 | def start_quiz(): 23 | score = 0 24 | random.shuffle(questions) 25 | 26 | print("Welcome to the Quiz Game!") 27 | print("You will be presented with a series of questions. Choose the correct answer.") 28 | print("Let's begin!\n") 29 | 30 | for question in questions: 31 | print(question["question"]) 32 | for i, option in enumerate(question["options"], start=1): 33 | print(f"{i}. {option}") 34 | 35 | user_answer = input("Enter the number of your answer: ") 36 | 37 | if user_answer.isdigit() and 1 <= int(user_answer) <= len(question["options"]): 38 | selected_option = question["options"][int(user_answer) - 1] 39 | if selected_option == question["correct_answer"]: 40 | print("Correct!\n") 41 | score += 1 42 | else: 43 | print(f"Wrong. The correct answer is: {question['correct_answer']}\n") 44 | else: 45 | print("Invalid input. Skipping to the next question.\n") 46 | 47 | print(f"Quiz completed! Your score is {score}/{len(questions)}.") 48 | 49 | if __name__ == "__main__": 50 | start_quiz() 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # python-programing 2 | This Repo. consist of python programs 3 | -------------------------------------------------------------------------------- /Reverse-list.py: -------------------------------------------------------------------------------- 1 | # using string slicing operator 2 | input_string = "Hello, World!" 3 | reversed_string = input_string[::-1] 4 | print(reversed_string) 5 | #using for loop statement 6 | input_string = "Hello, World!" 7 | reversed_string = "" 8 | for char in input_string: 9 | reversed_string = char + reversed_string 10 | print(reversed_string) 11 | #using recursive function recursiom 12 | def reverse_string(input_string): 13 | if len(input_string) == 0: 14 | return input_string 15 | else: 16 | return reverse_string(input_string[1:]) + input_string[0] 17 | 18 | input_string = "Hello, World!" 19 | reversed_string = reverse_string(input_string) 20 | print(reversed_string) 21 | 22 | -------------------------------------------------------------------------------- /Stop watch .py: -------------------------------------------------------------------------------- 1 | #stop watch in python 2 | #$import time 3 | import time 4 | #define watch 5 | def stopwatch(): 6 | input("Press Enter to start the stopwatch.") 7 | start_time = time.time() 8 | 9 | try: 10 | #using while loop 11 | while True: 12 | elapsed_time = time.time() - start_time 13 | minutes, seconds = divmod(int(elapsed_time), 60) 14 | hours, minutes = divmod(minutes, 60) 15 | time_str = f"{hours:02d}:{minutes:02d}:{seconds:02d}" 16 | #print statement 17 | print("\r" + time_str, end="") 18 | time.sleep(1) 19 | except KeyboardInterrupt: 20 | print("\nStopwatch stopped.") 21 | return 22 | 23 | if __name__ == "__main__": 24 | stopwatch() 25 | -------------------------------------------------------------------------------- /String-Capitalization.py: -------------------------------------------------------------------------------- 1 | def solve(s): 2 | # Capitalize the first letter of each word in the string 3 | capitalized_string = s.title() 4 | return capitalized_string 5 | 6 | # Example usage: 7 | input_string = "infance tony" 8 | result = solve(input_string) 9 | print(result) # This will print "Chris Alan" 10 | -------------------------------------------------------------------------------- /String-Compres.py: -------------------------------------------------------------------------------- 1 | from itertools import groupby 2 | 3 | def compress_string(s): 4 | compressed = [(len(list(g)), int(k)) for k, g in groupby(s)] 5 | result = ' '.join([f'({count}, {key})' for count, key in compressed]) 6 | return result 7 | 8 | if __name__ == "__main__": 9 | s = input() 10 | compressed_string = compress_string(s) 11 | print(compressed_string) 12 | -------------------------------------------------------------------------------- /To-Do-List-Tkinter.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import messagebox 3 | 4 | def add_task(): 5 | task = entry.get() 6 | if task: 7 | listbox.insert(tk.END, task) 8 | entry.delete(0, tk.END) 9 | else: 10 | messagebox.showwarning("Warning", "Please enter a task.") 11 | 12 | def delete_task(): 13 | try: 14 | selected_task_index = listbox.curselection()[0] 15 | listbox.delete(selected_task_index) 16 | except IndexError: 17 | messagebox.showwarning("Warning", "Please select a task to delete.") 18 | 19 | # Create the main window 20 | root = tk.Tk() 21 | root.title("To-Do List") 22 | 23 | # Create and pack a listbox to display tasks 24 | listbox = tk.Listbox(root, selectmode=tk.SINGLE, width=40) 25 | listbox.pack(pady=10) 26 | 27 | # Create an entry field to add tasks 28 | entry = tk.Entry(root, width=40) 29 | entry.pack() 30 | 31 | # Create buttons to add and delete tasks 32 | add_button = tk.Button(root, text="Add Task", command=add_task) 33 | delete_button = tk.Button(root, text="Delete Task", command=delete_task) 34 | add_button.pack(pady=5) 35 | delete_button.pack() 36 | 37 | # Run the Tkinter main loop 38 | root.mainloop() 39 | -------------------------------------------------------------------------------- /To-Do-List.py: -------------------------------------------------------------------------------- 1 | # Sample code for a To-Do List Application 2 | 3 | # Initialize an empty to-do list 4 | tasks = [] 5 | 6 | # Function to add a task 7 | def add_task(task_name, description="", due_date=""): 8 | task = {"name": task_name, "description": description, "due_date": due_date, "completed": False} 9 | tasks.append(task) 10 | 11 | # Function to list all tasks 12 | def list_tasks(): 13 | for index, task in enumerate(tasks, start=1): 14 | status = "Done" if task["completed"] else "Not Done" 15 | print(f"{index}. {task['name']} - {task['description']} (Due: {task['due_date']}) - {status}") 16 | 17 | # Function to mark a task as completed 18 | def mark_completed(task_index): 19 | if 0 < task_index <= len(tasks): 20 | tasks[task_index - 1]["completed"] = True 21 | 22 | # Function to remove a task 23 | def remove_task(task_index): 24 | if 0 < task_index <= len(tasks): 25 | del tasks[task_index - 1] 26 | 27 | # Main program loop 28 | while True: 29 | print("\nTo-Do List Application") 30 | print("1. Add Task") 31 | print("2. List Tasks") 32 | print("3. Mark Task as Completed") 33 | print("4. Remove Task") 34 | print("5. Quit") 35 | 36 | choice = input("Enter your choice: ") 37 | #conditional statements 38 | if choice == "1": 39 | task_name = input("Enter task name: ") 40 | description = input("Enter task description (optional): ") 41 | due_date = input("Enter due date (optional): ") 42 | add_task(task_name, description, due_date) 43 | elif choice == "2": 44 | list_tasks() 45 | elif choice == "3": 46 | task_index = int(input("Enter the task number to mark as completed: ")) 47 | mark_completed(task_index) 48 | elif choice == "4": 49 | task_index = int(input("Enter the task number to remove: ")) 50 | remove_task(task_index) 51 | elif choice == "5": 52 | print("Goodbye!") 53 | break 54 | else: 55 | print("Invalid choice. Please try again.") 56 | -------------------------------------------------------------------------------- /functions-presentation: -------------------------------------------------------------------------------- 1 | what is function: 2 | In computer programming, a function is a named, reusable block of code that performs a specific task or set of tasks 3 | 4 | structure: 5 | 6 | 7 | ( function_name(parameters): 8 | """ 9 | Docstring (optional): A brief description of the function. 10 | This is where you document what the function does, what parameters it takes, 11 | and what it returns. 12 | """ 13 | 14 | # Function body: The actual code that performs the task. 15 | # It can include statements, expressions, and other function calls. 16 | 17 | # Optionally, use the "return" statement to send a value back to the caller. 18 | return result ) 19 | 20 | 21 | 22 | Use of function: 23 | Promote Code Reusability: They allow you to define a block of code that can be executed multiple times with different inputs, reducing redundancy. 24 | Organize Code : Functions help in structuring code by breaking it into modular, manageable parts, improving readability and maintainability. 25 | 26 | Types of function: 27 | 28 | Built-in Functions: 29 | These are functions that are pre-defined in Python and come with the language. Examples include len(), print(), max(), and min(). 30 | 31 | User-Defined Functions: 32 | Functions created by the programmer to perform a specific task. They are defined using the def keyword. 33 | 34 | Anonymous Functions (Lambda Functions): 35 | Small, one-line functions defined using the lambda keyword. They are often used for short-term tasks. 36 | 37 | Recursive Functions: 38 | Functions that call themselves during their execution. Recursion is a technique where a function solves a problem by solving smaller instances of the same problem. 39 | 40 | 41 | 42 | 43 | 44 | Examples: 45 | 46 | Built-in : 47 | 48 | type() 49 | str() 50 | int() 51 | 52 | let=[] 53 | for i in range(65,91): 54 | print(chr(i)) 55 | 56 | 57 | let.append(chr(i)) 58 | print(let) 59 | 60 | 61 | 62 | text="Byte Bash Blitz" 63 | length_text=len(text) 64 | print(f"Length of the string is :{lenght_text}") 65 | 66 | 67 | User defined : 68 | 1 69 | def add_numbers(x, y): 70 | sum_result = x + y 71 | print(sum_result) 72 | 73 | num1 = int(input("Enter the first number: ")) 74 | num2 = int(input(" ")) 75 | add_numbers(num1, num2) 76 | 2 77 | def big(x, y): 78 | if x > y: 79 | bigest = x 80 | else: 81 | bigest = y 82 | print(bigest) 83 | 84 | num1 = float(input("nter the first number: ")) 85 | num2 = float(input("enter the second number: ")) 86 | big(num1, num2) 87 | 3 88 | def number(): 89 | for num in range(1, 11): 90 | print(num) 91 | 92 | number() 93 | 94 | -------------------------------------------------------------------------------- /ph.no.Valid or not.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | def is_valid_indian_phone_number(phone_number): 4 | # Define a regular expression pattern for an Indian phone number 5 | pattern = r'^[6-9]\d{9}$' 6 | 7 | # Use the re.match() function to check if the input matches the pattern 8 | if re.match(pattern, phone_number): 9 | return True 10 | else: 11 | return False 12 | 13 | # Input a phone number for validation 14 | phone_number = input("Enter an Indian phone number (10 digits starting with 6 or 9): ") 15 | 16 | # Check if the phone number is valid 17 | if is_valid_indian_phone_number(phone_number): 18 | print("Valid Indian phone number") 19 | else: 20 | print("Invalid Indian phone number") 21 | -------------------------------------------------------------------------------- /translator.py: -------------------------------------------------------------------------------- 1 | #google translator 2 | from googletrans import Translator 3 | 4 | def translate_text(text, target_language='en'): 5 | translator = Translator() 6 | translated_text = translator.translate(text, dest=target_language) 7 | return translated_text.text 8 | 9 | if __name__ == "__main__": 10 | input_text = input("Enter the text to translate: ") 11 | target_language = input("Enter the target language (e.g., 'en' for English): ") 12 | 13 | translated_text = translate_text(input_text, target_language) 14 | 15 | print(f"Translated Text: {translated_text}") 16 | --------------------------------------------------------------------------------