Skip to content
Open
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
1,808 changes: 1,808 additions & 0 deletions BOWpractice.ipynb

Large diffs are not rendered by default.

388 changes: 388 additions & 0 deletions MLPproject.ipynb

Large diffs are not rendered by default.

655 changes: 655 additions & 0 deletions Welcome_to_Colab.ipynb

Large diffs are not rendered by default.

1,753 changes: 1,753 additions & 0 deletions chapter_appendix-tools-for-deep-learning/jupyter.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"email": "23f3002893@ds.study.iitm.ac.in"
}
161 changes: 161 additions & 0 deletions problem_1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
---
title: Data type operations
---

# Problem Statement

Implement the function data_type_operations(data: dict) -> dict that takes a dictionary containing keys 'int', 'float', 'list', and 'set'. Perform the following operations:

For 'int', add 5.
For 'float', multiply by 1.5.
For 'list', append the length of the list.
For 'set', add the square of the size of the set.
Return the modified dictionary.

**Example**
```
data = {
'int': 10,
'float': 4.0,
'list': [1, 2, 3],
'set': {1, 2}
}
Result: {
'int': 15,
'float': 6.0,
'list': [1, 2, 3, 3],
'set': {1, 2, 4}
}
```

# Solution

```py3 test.py -r 'python test.py'
<template>
def data_type_operations(data: dict) -> dict:
'''
Modify the input dictionary as per the operations specified.

Arguments:
data: dict - Dictionary containing specific keys and values.

Returns:
dict - Modified dictionary after performing operations.
'''
<los>...</los>
<sol>
data['int'] += 5
data['float'] *= 1.5
data['list'].append(len(data['list']))
data['set'].add(len(data['set'])**2)
return data
</sol>

</template>
<suffix_invisible>
{% include '../function_type_and_modify_check_suffix.py.jinja' %}
</suffix_invisible>

```

# Public Test Cases

## Input 1

```
data = {
'int': 3,
'float': 2.0,
'list': [10, 20],
'set': {2}
}
is_equal(
data_type_operations(data),
{
'int': 8,
'float': 3.0,
'list': [10, 20, 2],
'set': {2, 1}
}
)
```

## Output 1

```
{
'int': 8,
'float': 3.0,
'list': [10, 20, 2],
'set': {2, 1}
}
```

# Private Test Cases

## Input 1

```
data = {
'int': 0,
'float': 0.0,
'list': [],
'set': set()
}
is_equal(
data_type_operations(data),
{
'int': 5,
'float': 0.0,
'list': [0],
'set': {0}
}
)

```

## Output 1

```
{
'int': 5,
'float': 0.0,
'list': [0],
'set': {0}
}

```

## Input 2

```
data = {
'int': -5,
'float': 10.0,
'list': [1, 2, 3, 4],
'set': {1, 3, 5}
}
is_equal(
data_type_operations(data),
{
'int': 0,
'float': 15.0,
'list': [1, 2, 3, 4, 4],
'set': {1, 3, 5, 9}
}
)

```

## Output 2

```
{
'int': 0,
'float': 15.0,
'list': [1, 2, 3, 4, 4],
'set': {1, 3, 5, 9}
}


```
104 changes: 104 additions & 0 deletions problem_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: Top Student
---

# Problem Statement

Implement the function top_student(students: list) -> dict that takes a list of dictionaries where each dictionary contains 'name' and 'marks' of a student. Return a dictionary with the following keys:

- 'average': the average marks rounded to 2 decimal places.
- 'topper': the name of the student with the highest marks.

*Example*

students = [
{"name": "lucky", "marks": 85},
{"name": "Rocky", "marks": 92},
{"name": "Chocky", "marks": 78}
]
top_student(students) # Output: {"average": 85.0, "topper": "Rocky"}


# Solution

py3 test.py -r 'python test.py'
<template>
def top_student(students: list) -> dict:
'''
Find the average marks and the student with the highest marks.
Arguments:
students: list - a list of dictionaries containing 'name' and 'marks'.
Return: dict - a dictionary with 'average' and 'topper'.
'''
<los>...</los>
<sol>
average = round(sum(s['marks'] for s in students) / len(students), 2)
topper = max(students, key=lambda x: x['marks'])['name']
return {'average': average, 'topper': topper} </sol>

</template>
<suffix_invisible>
{% include '../function_type_and_modify_check_suffix.py.jinja' %}
</suffix_invisible>


# Public Test Cases

## Input 1


students = [
{"name": "Johny", "marks": 70},
{"name": "Dony", "marks": 90},
{"name": "Smithy", "marks": 80}
]
is_equal(
top_student(students),
{"average": 80.0, "topper": "Dony"}
)


## Output 1


{"average": 80.0, "topper": "Dony"}


# Private Test Cases

## Input 1


students = [
{"name": "Ammu", "marks": 88},
{"name": "Evuram", "marks": 92}
]
is_equal(
top_student(students),
{"average": 90.0, "topper": "Evuram"}
)


## Output 1


{"average": 90.0, "topper": "Evuram"}


## Input 2


students = [
{"name": "Manvendra", "marks": 70},
{"name": "Lokendra", "marks": 86}
]
is_equal(
top_student(students),
{"average": 78.0, "topper": "Lokendra"}
)


## Output 2


{"average": 78.0, "topper": "lokendra"}
85 changes: 85 additions & 0 deletions problem_3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: City Temperatures
---

# Problem Statement

Write a program that reads city temperatures from stdin. The input contains lines of the format <city> <temperature>. Print the average temperature and the name of the city with the highest temperature(no two cities have highest temperature). Input ends when an empty line is encountered.

**Example**
```
Input:
Delhi 30
Mumbai 35
Chennai 33

Output:
Average Temperature: 32.67
City with Highest Temperature: Mumbai
```

# Solution

```py3 test.py -r 'python test.py'
<template>
import sys

def main():
'''
Calculate the average temperature and find the city with the highest temperature.

Input: Reads lines containing '<city> <temperature>'. Ends on an empty line.
Output: Prints average temperature and city with highest temperature.
'''
<los>...</los>
<sol>
lines = sys.stdin.read().strip().split('\n')
data = [line.split() for line in lines if line]
cities = [d[0] for d in data]
temps = [float(d[1]) for d in data]

avg_temp = round(sum(temps) / len(temps), 2)
highest_temp_city = cities[temps.index(max(temps))]

print(f"Average Temperature: {avg_temp}")
print(f"City with Highest Temperature: {highest_temp_city}")
</sol>
</template>
<suffix_invisible>
{% include '../function_type_and_modify_check_suffix.py.jinja' %}
</suffix_invisible>
```

# Public Test Cases

## Input 1

```
NYC 20
London 25
Berlin 22
```

## Output 1

```
Average Temperature: 22.33
City with Highest Temperature: London
```

# Private Test Cases

## Input 1

```
Delhi 27
Bhopal 24
Indore 21
```

## Output 1

```
Average Temperature: 24.00
City with Highest Temperature: Delhi
```
Loading