Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
30 changes: 30 additions & 0 deletions Shashmitha Parvathaneni/Task1
Original file line number Diff line number Diff line change
@@ -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")
13 changes: 13 additions & 0 deletions Shashmitha Parvathaneni/Task2
Original file line number Diff line number Diff line change
@@ -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")
38 changes: 38 additions & 0 deletions Shashmitha Parvathaneni/Task3
Original file line number Diff line number Diff line change
@@ -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()
36 changes: 36 additions & 0 deletions Shashmitha Parvathaneni/Task4
Original file line number Diff line number Diff line change
@@ -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 <task_description>"""
self.tasks.append(arg)
print("Task added successfully.")

def do_delete(self, arg):
"""Delete a task by index: delete <task_index>"""
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.")
24 changes: 24 additions & 0 deletions Shashmitha Parvathaneni/Task5
Original file line number Diff line number Diff line change
@@ -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()