Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
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,026 changes: 981 additions & 45 deletions Python-ifed.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Python-ifed
Binary file added __pycache__/ability.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/nearest_square.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions ability.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import requests, json

def ability(name):
response = requests.get('https://pokeapi.co/api/v2/pokemon/' + str(name))
text = json.dumps(response.json(), indent=4)

json_object = json.loads(text)


A = []
for i in range(len(json_object['abilities'])):
a= json_object['abilities']
b = a[i]
c = b['ability']
final = c['name']
A.append(final)

return A
15 changes: 15 additions & 0 deletions nearest_square.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def nearest_square(limit):
if limit < 0:
return 0

while limit > 3:
i = 2
while i <= limit//2:
square = i*i
if square == limit:
return square
else:
i += 1
limit -= 1
return 1

47 changes: 47 additions & 0 deletions step4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import time
import pandas as pd
import numpy as np

with open('subset_elemets.txt') as f:
subset_elements = f.read().split('\n')

with open('all_elements.txt') as f:
all_elements = f.read().split('\n')

def Number_elements(file1,file2):
"""Defined a function named Number_elements.This also contains intersect1d function from numpy module.
##parameters
file1,file2

##Returns:
returns the total number of elements present in both the files.
"""
start = time.time()

verified_element = np.intersect1d(np.array(file1), np.array(file2))

print(len(verified_element))
print(f'Duration: {time.time() - start} seconds')

Number_elements(subset_elements, all_elements)

Method_one(subset_elements, all_elements)

# This is using datastructures

def Method_two(file1,file2):
"""Defined a function named Method_two.This also uses the built in function intersection to find out the elements that are present as common in both the files.
##parameters
file1,file2

##Returns:
returns the total number of elements present in both the files.
"""
start = time.time()

verified_element=set(file1).intersection(file2)

print(len(verified_element))
print('Duration: {} seconds'.format(time.time() - start))

Method_two(subset_elements, all_elements)