diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1a638a4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,50 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "R-Debugger", + "name": "Launch R-Workspace", + "request": "launch", + "debugMode": "workspace", + "workingDirectory": "${workspaceFolder}" + }, + { + "type": "R-Debugger", + "name": "Debug R-File", + "request": "launch", + "debugMode": "file", + "workingDirectory": "${workspaceFolder}", + "file": "${file}" + }, + { + "type": "R-Debugger", + "name": "Debug R-Function", + "request": "launch", + "debugMode": "function", + "workingDirectory": "${workspaceFolder}", + "file": "${file}", + "mainFunction": "main", + "allowGlobalDebugging": false + }, + { + "type": "R-Debugger", + "name": "Debug R-Package", + "request": "launch", + "debugMode": "workspace", + "workingDirectory": "${workspaceFolder}", + "includePackageScopes": true, + "loadPackages": [ + "." + ] + }, + { + "type": "R-Debugger", + "request": "attach", + "name": "Attach to R process", + "splitOverwrittenOutput": true + } + ] +} \ No newline at end of file diff --git a/Shashmitha Parvathaneni/Task1 b/Shashmitha Parvathaneni/Task1 new file mode 100644 index 0000000..4c96f98 --- /dev/null +++ b/Shashmitha Parvathaneni/Task1 @@ -0,0 +1,30 @@ +#Simple Calculator +def add(x, y): + return x + y + +def subtract(x, y): + return x - y + +def multiply(x, y): + return x * y + +def divide(x, y): + return "Error: Division by zero!" if y == 0 else x / y +print("Select operation:") +print("1. Add") +print("2. Subtract") +print("3. Multiply") +print("4. Divide") +choice = input("Enter choice (1/2/3/4): ") +num1 = float(input("Enter first number: ")) +num2 = float(input("Enter second number: ")) +if choice == '1': + print("Result: ", add(num1, num2)) +elif choice == '2': + print("Result: ", subtract(num1, num2)) +elif choice == '3': + print("Result: ", multiply(num1, num2)) +elif choice == '4': + print("Result: ", divide(num1, num2)) +else: + print("Invalid input") \ No newline at end of file diff --git a/Shashmitha Parvathaneni/Task2 b/Shashmitha Parvathaneni/Task2 new file mode 100644 index 0000000..592b8db --- /dev/null +++ b/Shashmitha Parvathaneni/Task2 @@ -0,0 +1,13 @@ +## weather app +import requests +api_key = '7a63db5cb1aa389d14af1589720bb4db' +user_input = input("Enter city: ") +weather_data = requests.get(f"https://api.openweathermap.org/data/2.5/weather?q={user_input}&units=imperial&APPID={api_key}") +if weather_data.json()['cod'] == '404': + print("No City Found") +else: + weather = weather_data.json()['weather'][0]['main'] + temp = round(weather_data.json()['main']['temp']) + + print(f"The weather in {user_input} is: {weather}") + print(f"The temperature in {user_input} is: {temp}ºF") \ No newline at end of file diff --git a/Shashmitha Parvathaneni/Task3 b/Shashmitha Parvathaneni/Task3 new file mode 100644 index 0000000..0287041 --- /dev/null +++ b/Shashmitha Parvathaneni/Task3 @@ -0,0 +1,38 @@ +## Data Analysis with Pandas +#import libraries +import seaborn as sns +import pandas as pd +import matplotlib.pyplot as plt +# Load the Iris dataset +iris = sns.load_dataset('iris') +# Display basic information about the dataset +print("Basic Information about the Iris dataset:") +print(iris.info()) +# Display the first few rows of the dataset +print("\nFirst few rows of the Iris dataset:") +print(iris.head()) +# Check for missing values +print("\nChecking for missing values:") +print(iris.isnull().sum()) +# Descriptive statistics +print("\nDescriptive statistics of the Iris dataset:") +print(iris.describe()) +# Aggregations +print("\nAverage values of each species:") +print(iris.groupby('species').mean()) +# Visualizations +# Pairplot +sns.pairplot(iris, hue='species') +plt.title('Pairplot of Iris Dataset') +plt.show() +# Boxplot +plt.figure(figsize=(10, 6)) +sns.boxplot(data=iris, x='species', y='petal_length') +plt.title('Boxplot of Petal Length by Species') +plt.show() +# Correlation matrix +correlation_matrix =iris.corr() +plt.figure(figsize=(8, 6)) +sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm', linewidths=0.5) +plt.title('Correlation Matrix of Iris Dataset') +plt.show() \ No newline at end of file diff --git a/Shashmitha Parvathaneni/Task4 b/Shashmitha Parvathaneni/Task4 new file mode 100644 index 0000000..a98f749 --- /dev/null +++ b/Shashmitha Parvathaneni/Task4 @@ -0,0 +1,36 @@ +## To-Do List +import cmd +class TaskManager(cmd.Cmd): + """Simple task manager""" + + intro = "Welcome to Task Manager! Type 'help' for a list of commands." + prompt = "(taskmgr) " + + def __init__(self): + super().__init__() + self.tasks = [] + + def do_add(self, arg): + """Add a new task: add """ + self.tasks.append(arg) + print("Task added successfully.") + + def do_delete(self, arg): + """Delete a task by index: delete """ + try: + index = int(arg) + if 0 <= index < len(self.tasks): + del self.tasks[index] + print("Task deleted successfully.") + else: + print("Invalid task index.") + except ValueError: + print("Invalid task index.") + + def do_list(self, arg): + """List all tasks""" + if self.tasks: + for i, task in enumerate(self.tasks): + print(f"{i}: {task}") + else: + print("No tasks found.") \ No newline at end of file diff --git a/Shashmitha Parvathaneni/Task5 b/Shashmitha Parvathaneni/Task5 new file mode 100644 index 0000000..c88a24c --- /dev/null +++ b/Shashmitha Parvathaneni/Task5 @@ -0,0 +1,24 @@ +## chatbot +import nltk +from nltk.chat.util import Chat, reflections +# Define the patterns and responses +patterns = [ + (r'hi|hello|hey', ['Hello!', 'Hi there!', 'Hey!']), + (r'how are you?', ['I am good, thank you!', 'I am doing well, thank you for asking.']), + (r'your name?', ['I am a chatbot.', 'My name is Chatbot.']), + (r'(weather|temperature) (.*)', ['I am sorry, I cannot provide weather information.']), + (r'quit', ['Bye!', 'Goodbye!', 'See you later.']) +] +# Create the chatbot +chatbot = Chat(patterns, reflections) +def simple_chat(): + print("Chatbot: Hi! How can I help you today?") + while True: + user_input = input("You: ") + response = chatbot.respond(user_input) + print("Chatbot:", response) + if user_input.lower() == 'quit': + break + +if __name__ == "__main__": + simple_chat() \ No newline at end of file