diff --git a/Input_Output&Variables/Input_Output&Variables.py b/Input_Output&Variables/Input_Output&Variables.py new file mode 100644 index 00000000..21170c39 --- /dev/null +++ b/Input_Output&Variables/Input_Output&Variables.py @@ -0,0 +1,4 @@ +name = input("Enter your name: ") +age = int(input("Enter your age: ")) +city = input("Enter your city: ") +print(f"Hello {name}! You are {age} years old and live in {city}.") diff --git a/basic data cleaning2.py b/basic data cleaning2.py new file mode 100644 index 00000000..18a62b90 --- /dev/null +++ b/basic data cleaning2.py @@ -0,0 +1,23 @@ +# Task #100: Basic Data Cleaning using pandas +import pandas as pd + +# Read dataset (you can replace this with your CSV path) +data = pd.read_csv("data.csv") + +# Show first few rows +print("Before Cleaning:\n", data.head()) + +# Drop rows with missing values +data_cleaned = data.dropna() + +# Rename columns (example) +data_cleaned = data_cleaned.rename(columns={'OldColumnName': 'NewColumnName'}) + +# Reset index +data_cleaned.reset_index(drop=True, inplace=True) + +# Save cleaned data +data_cleaned.to_csv("cleaned_data.csv", index=False) + +print("\nAfter Cleaning:\n", data_cleaned.head()) +print("\n✅ Data cleaned and saved as 'cleaned_data.csv'") diff --git a/inputand output variables 1.py b/inputand output variables 1.py new file mode 100644 index 00000000..802b6c64 --- /dev/null +++ b/inputand output variables 1.py @@ -0,0 +1,9 @@ +# Exercise #31: Input/Output & Variables + +# Taking user inputs +name = input("Enter your name: ") +age = int(input("Enter your age: ")) +city = input("Enter your city: ") + +# Output message +print(f"Hello {name}! You are {age} years old and live in {city}.") diff --git a/transulate text using google translator 3.py b/transulate text using google translator 3.py new file mode 100644 index 00000000..5f76310f --- /dev/null +++ b/transulate text using google translator 3.py @@ -0,0 +1,19 @@ +# Project #288: Translate text using googletrans +from googletrans import Translator + +# Create a translator object +translator = Translator() + +# Input text +text = input("Enter text to translate: ") + +# Choose target language (e.g., 'es' for Spanish, 'fr' for French, 'ta' for Tamil) +target_lang = input("Enter target language code (e.g., 'es', 'fr', 'ta'): ") + +# Perform translation +translation = translator.translate(text, dest=target_lang) + +# Show result +print(f"\nOriginal: {text}") +print(f"Translated ({target_lang}): {translation.text}") +print("\n✅ Translation completed.") \ No newline at end of file