blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
159ab5569dd08cd04650f91f5c20f29516113082
RaulNinoSalas/Programacion-practicas
/Practica3/MediaAritmetica.py
121
3.65625
4
a=float(raw_input("Escribe un numero ")) b=float(raw_input("Otro mas ")) c=(a+b)/2 print "La media aritmetica es ",c
5f26e8142a8bd641b319bf5e9d39ba03e794f5f0
RaulNinoSalas/Programacion-practicas
/Practica4/P4E4.py
228
3.859375
4
"""RAUL NIO SALAS. DAW1. PRACTICA 4 EJERCICIO 4.Escriu un programa que demani un nombre i calculi el seu factorial""" f=1 a=int(raw_input("Dame un numero y te calculare su factorial ")) for i in range(1,a+1): f=i*f print f
b3008412bee66bcf9836b9aeee8409f5c7918ac8
RaulNinoSalas/Programacion-practicas
/Practica6/P6E5.py
635
4.125
4
"""RAUL NIO SALAS DAW1 Ejercicio 05 Escribe un programa que permita crear dos listas de palabras y que, a continuacin, elimine de la primera lista los nombres de la segunda lista. """ lista=[ ] numero=input("Cuantas palabras tiene la lista? ") for i in range(0,numero): palabra=raw_input("Dime una palab...
4650f1931705c1d0ad281565211197910ab63a10
MartynovaDaria/Django
/2/ex_3.py
178
3.5
4
#!/usr/bin/env python3 data = [4, -30, 100, -100, 123, 1, 0, -1, -4] # Реализация задания 3 def srt(num): return(abs(num)) print(sorted(data, key = srt))
f8f03043f1a8ac867fd4dfacc3a64c77f16398c4
tylermhansen/PTDAMDSWAC
/PythonSprites/display.py
872
3.90625
4
# Proj 4 # Stephanie Taylor # spring 2011 import graphics # Open a new window, give it the specified title, # and display the image # Input: # src : a Zelle Image # title : a string # Output: # the window in which the pixmap is displayed def displayImage(src, title): # get the size of the image w = sr...
107bfae437878ac94c9d1fa208f2a2260030f1c7
i-Tinerary/datasources
/foursquare/scripts/api_wrapper.py
6,919
3.671875
4
import argparse import requests import webbrowser ROOT_URL = "https://api.foursquare.com/v2/venues/" parser = argparse.ArgumentParser(description="Wrapper around the foursquare API. Use it to retrieve information about\ specific venues or groups of venues.") parser.add_argument("endpo...
5930cba3e467cb9825f277c3ff6009402892a2c5
tanbin-hasnat-shehab/Aisc-steel-section-database-version-15
/app2.py
747
3.609375
4
import streamlit as st from openpyxl import load_workbook def about(): st.write( ''' contact email - tanbinhasnat04@gmail.com ''') def main(): st.title("Aisc database version - v15 : ") activities = ["Home", "About"] choice = st.sidebar.selectbox("Pick something fun", activit...
da00e40b7c84495f754737718bbde3518036eebe
rahavoi/pythonSandbox
/standard_lib.py
307
3.6875
4
from collections import OrderedDict favorite_languages = OrderedDict() favorite_languages['illia'] = 'java' favorite_languages['nadia'] = 'python' favorite_languages['ilya'] = 'javascript' for name, language in favorite_languages.items(): print(name.title() + "'s favorite lang is " + language.title())
9f90665483d91d356770e54a2514640a941d431b
rahavoi/pythonSandbox
/working_with_files.py
645
4.125
4
#Reading from a file: def dumbChatBot(filename): chatsLeft = 3 botResponse = 'I\'m just a bot. Bear with me' with open(filename, 'a') as file_object: while(chatsLeft > 0): userInput = input("User:") file_object.write('User: ' + userInput + '\n') print("Bot: " + botResponse) file_object.write('Bot: ' +...
30265a6b92c8e66d7c35f344d97892eaf08e87ef
AndreyVanyuck/BSUIR-labs-6-sem
/isob/lab1/task2/main.py
2,221
3.890625
4
import argparse from string import ascii_lowercase def read_file(file_path: str) -> str: with open(file_path, "r") as read_file: return read_file.read() def write_file(file_name: str, text: str) -> None: with open(file_name, "w") as write_file: write_file.write(text) def generate_key(key: ...
bebb04b3d366f1cd1b1e6b31dfb6c6a18c5dfb42
JacobDominski/SearchAndSortAlgorithms
/SearchAlgorithm.py
2,267
3.921875
4
import random def populateList(): temp = [] for i in range(20): temp.append(i) random.shuffle(temp) return temp def IterativeLinearSearch(inputList): searchValue = int(input("What value are you looking for? :>")) for i in range(0, len(inputList)): if inputList[i] == searchValue: pri...
17602e4fac54e08e9adbef7358bb3262561073c6
XLexxaX/RData2Graph
/Python/DuplicateRemoval/InvertedIndexToolbox.py
936
3.671875
4
class InvertedIndex: def __init__(self, n=3): self.iindex = dict() self.N = n def addToIndex(self, value, index): ngrams = getNGrams(value, self.N) for gram in ngrams: if gram in self.iindex: s = self.iindex[gram] s.add(index) ...
435ef938c90661b21da86658ac9bc65c165cce20
antares681/Python
/PythonFundamentals/Lecture.04.Data_Types_Variables/Excercise.Lab.03.Special__Numbers.py
689
3.734375
4
#solution 1 # # digit = int(input()) # # for num in range(1, digit + 1): # digit_list = list(map(int, str(num))) # digit_sum = 0 # for elements in digit_list: # digit_sum += int(elements) # # if digit_sum == 5 or digit_sum == 7 or digit_sum == 11: # print(f'{num} -> True') # else: # ...
34a657204222be7d22f6fee6be3cf62cad925979
antares681/Python
/PythonFundamentals/REAL MIDEXAM RETAKE/Problem_2.py
1,001
4.03125
4
groceries_list = input().split('!') command = input() while not command == 'Go Shopping!': detailed_command = command.split(' ') if 'Urgent' in command: # TEST 0 item = detailed_command[1] if item not in groceries_list: groceries_list.insert(0, item) elif 'Unnecessary' in...
3e5d907d03844ab6a5af0649aade951def5c4e9a
antares681/Python
/PythonAdvanced/L.01.Stack_and_Queues/Lab.01.ReverseString.py
410
4.0625
4
# def reverse_string(text): # stack=[] # for letter in text: # stack.append(letter) # # reversed_stack = [] # while stack: # letter = stack.pop() # reversed_stack.append(letter) # result = ''.join(reversed_stack) # return result # print(reverse_string('I love Python')) # ...
ff6beed3910d547e05982033b33581576af0bb23
antares681/Python
/PythonAdvanced/EXAM.01.14APR/01.Problem.py
1,305
4.03125
4
def pizza_checker(orders_left): if sum(orders_left) <= 0: return False return True def empl_checker(free_empl): if len(free_empl) <= 0: return False return True def solve(pizza_orders, employees_capacity): total_pizzas_made = 0 while len(employees_capacity) and len(pizza_orders...
0c013746881fc469b37f354668e3c5fe2ab3784c
antares681/Python
/PythonAdvanced/L.03.Multidimensional_Lists/Lab.04.Number_in_Sum.py
442
3.78125
4
present = False n = input() if n and n.isdigit(): n= int(n) matrix = [[el for el in input()] for el in range(n)] symbol = input() for i in range(n): for j in range(n): if matrix[i][j] == symbol: print(f'{i, j}') present = True break ...
1a63a025b9471266a1229e84ea254557082d4924
antares681/Python
/PythonFundamentals/Lecture11.REGEX/Lab.03.Match_Dates.py
383
3.65625
4
import re test_string = input() pattern = r'\b(\d{2})(?P<separator>[\/.-])([A-Z][a-z]{2})(?P=separator)(\d{4})\b' matches = re.findall(pattern, test_string) print(matches) for n in range(len(matches)): print(f'Day: {matches[int(n)][0]}, Month: {matches[n][2]}, Year: {matches[n][3]}') #TEST STRING '13/Jul/1928, 10...
3dd2ca319c752a7d3a1ba1b5d45da0f3618d8a21
antares681/Python
/PythonOOP/L.01.Defining_Classes/Pokemon/project/Ex.06.Pokemon_Battle.py
1,015
3.96875
4
class Pokemon: def __init__(self, name, health): self.name = name self.health = health def pokemon_details(self): return f"{self.name} with health {self.health}" class Trainer: def __init__(self, name): self.name = name self.pokemon = [] def add_pokemon(self, p...
65f1749a6b4246a71294ba07541445bfe9224cbd
antares681/Python
/PythonFundamentals/Final_Exam_1/02.Emoji_Detector_2.py
663
3.765625
4
import re text = input() pattern = re.compile(r"(::|\*\*)[A-Z]([a-z]+){2}\1") cool_emoji = [] threshold = [int(num) for num in re.findall("\\d", text)] cool_threshold = 1 for num in threshold: cool_threshold *= num emojies = [match.group() for match in pattern.finditer(text)] for emoji in emojies: sum_emoji =...
b8d6ba3183816211841c6095e6fd42b2b7c44771
antares681/Python
/PythonFundamentals/Lecture.04.Data_Types_Variables/Excercise.07.Water.Overflow.py
312
3.671875
4
ttl_capacity = 255 rest_capacity = 255 n = int(input()) for i in range (0, n): water_quantity = int(input()) if water_quantity > rest_capacity: print('Insufficient capacity!') elif water_quantity <= water_quantity: rest_capacity -= water_quantity print(ttl_capacity - rest_capacity)
95d192c9aebb28211a66b7db7cb69e71a4480233
antares681/Python
/PythonAdvanced/L.05.Advanced_Functions/Lab.08.Expressions.py
861
3.59375
4
# #TODO SOLUTION 1 OUT OF TIME LIMIT # # from itertools import permutations, chain # numbers = [n for n in input().split(', ')] # n = len(numbers) # permutations = set(permutations(['-'] * n + ['+'] * n , n)) # # for permutation in permutations: # # exp = (''.join((list(chain(*zip(permutation, numbers)))))) # r...
72cfb04caedc6466d1baa5d440f20b00c18c5c4b
antares681/Python
/PythonAdvanced/L.01.Stack_and_Queues/Ex.03.Fast_Food.py
1,382
3.921875
4
def solve(food, orders): biggest_order = 0 while orders: curr_order = orders.popleft() if food >= curr_order: food -= curr_order else: orders.appendleft(curr_order) if not biggest_order > max(orders): biggest_order = max(orders) ...
ba918ea6440a58f79a18fef272398b04b64e4e91
antares681/Python
/PythonFundamentals/Lecture.04.Data_Types_Variables/Excercise.03.Elevator.py
289
3.75
4
from math import ceil number_of_persons = int(input()) capacity_of_elevator = int(input()) if number_of_persons % capacity_of_elevator == 0: courses = number_of_persons / capacity_of_elevator else: courses = ceil(number_of_persons / capacity_of_elevator) print(f'{courses:.0f}')
53b39983bc3a4651962704e83782df3a4edbf70c
antares681/Python
/PythonFundamentals/SOME OWN PROJECTS/Pillow_image_converter.py
1,092
3.65625
4
import PIL.Image ASCII_CHARS = ["@", "#", "$", "%", "?", "*", "+", ";", ":", ",", "."] def resize_image(image, new_width=1000): width, height = image.size ratio = height / width new_height = int(new_width * ratio) resized_image = image.resize((new_width, new_height)) return resized_image def gray...
349ae22f458bc5f3da243f4545e4f1dd91062650
antares681/Python
/PythonAdvanced/L.05.Advanced_Functions/Lab.06.Character_Combinations.py
381
3.671875
4
from itertools import permutations data = [int(x) if x.isdigit() else x for x in input()] result = permutations(data,len(data)) [print(''.join(x)) for x in list(result)] #TODO WHY IT CANNOT PRINT ALL 2 PRINTS EITHER FIRST TWO OR THE SECOND # print(list(result)) from itertools import permutations data = input() [prin...
cc11c558dc2f9506716eaeac92096b87462533ca
antares681/Python
/PythonFundamentals/Lecture.05.Lists.Basics_Advanced/Ex.04.Number_Beggars.py
681
3.546875
4
#Прочитаме от конзолата сумите за раздаване sums_list = input().split(", ") #прочитаме от конзолата броя просяци number_of_beggars = int(input()) #листа с сумите за всеки просяк sums_per_beggar = [] #цикъл с итерации колко са броя просяци start_index = 0 # вложен цикъл for beggars in range(number_of_beggars): curr...
475dbc6ffb6a23926bf8d435e8c8238750cb1174
antares681/Python
/PythonAdvanced/L.02.Tuples_and_Sets/Lab.05.SoftUni_Party.py
1,396
3.609375
4
#TODO SOLUTION 1 def guest_Sorter(guests_nmbr): vip_guestlist = set() standard_guestlist = set() for _ in range(guests_nmbr): reservation = input() if reservation[0].isdigit(): vip_guestlist.add(reservation) elif reservation[0].isalpha(): standard_guestlist.a...
c8cb048554ddc7a995a3c6ea96a16fee182aa9e2
antares681/Python
/PythonAdvanced/L.04.Comprehensions/Ex.09.Bunker.py
1,086
3.734375
4
def get_category_items(category, bunker): return ', '.join([x for x in bunker[category]]) categories = input().split(', ') bunker = {category: {} for category in categories} lines = int(input()) for line in range(lines): category, food_name, food_properties = input().split(' - ') food_properties = {pai...
0610cf88c442f606b2f4869af317fc85b6665073
antares681/Python
/PythonAdvanced/DISCORD/PR1.py
5,161
3.765625
4
# size_of_side = float(input()) # n_sheets_of_paper = int(input()) # counter = 0 # total_sheet_area = 0 # # To find the surface area of a cuboid, add the areas of all 6 faces. # # We can also label the length (l), width (w), and height (h) of the prism and use the formula, # # SA=2lw+2lh+2hw, to find the surface area. ...
7dd4aa4a347ac48c8687598e14a8404b2160a092
antares681/Python
/PythonOOP/L06_Static_Methods/Ex02_Movie_World/movie_world.py
1,993
3.609375
4
from Ex02_Movie_World.customer import Customer from Ex02_Movie_World.dvd import DVD class MovieWorld: def __init__(self, name): self.name = name self.customers = [] self.dvds = [] @staticmethod def dvd_capacity(): return 15 @staticmethod def customer_capacity(): ...
97585384663be4e03a903c591c1bb01e7bc976e4
antares681/Python
/PythonFundamentals/Lecture10.Text.Processing/Winning_Ticket.py
2,660
3.609375
4
winning_symbols = ["@", "#", "$", "^"] def jackpot_check(ticket): for winning_symbol in winning_symbols: if winning_symbol in ticket: if ticket.count(winning_symbol) == 20: print(f"ticket \"{ticket}\" - 10{winning_symbol} Jackpot!") return True return False ...
27495757abaade932b543bf22bf5da008041d4a7
antares681/Python
/PythonOOP/L.01.Defining_Classes/Lab.02.Book.py
420
3.84375
4
class Book: def __init__(self, name, author, pages:int): self.name = name self.author = author self.pages = pages def __str__(self): return f'{self.name} {self.author} {self.pages}' print(Book('Lazar', 'Galaxy', 8)) # class Book: # def __init__(self, name:str, author:str,...
b37a363c050a40a8f1e5741528ad9fbb9740039c
antares681/Python
/PythonFundamentals/Lecture06.Functions/Lab.03.Repeat_String.py
218
3.609375
4
text = input() repeat_times = int(input()) def text_repeater(entered_text, repeater_value): for times in range (repeater_value): print(entered_text, end = "") return text_repeater(text, repeat_times)
0afab2eba68140a5d74029351fabbcb2440ccd90
antares681/Python
/PythonFundamentals/!DISCORD/Robotics.py
1,470
3.609375
4
from collections import deque food = int(input()) queue = deque([int(el) for el in input().split()]) biggest_order = max(queue) print(biggest_order) while queue: current_order = queue.popleft() if food >= current_order: food -= current_order else: queue.appendleft(current_order) p...
5f4123716acd3ced88c852f8dddaf540ecf6a8e5
antares681/Python
/PythonFundamentals/Lecture09.Dictionaries/валя.py
1,281
4.03125
4
my_list = input().split("|") command = input() while not command == "Shop!": if "Important" in command: task = command.split("%") item = task[1] if item in my_list: my_list.remove(item) my_list.insert(0, item) elif "Add" in command: task = command.split(...
c4b17c5cbf60cf4550022d4fff5269afa1ef2f18
antares681/Python
/PythonFundamentals/Lecture.03.Conditional_Statements_and_Loops/Lecture.03.Lab.08.Mutate.Strings.py
675
3.65625
4
# string_1 = input() # string_2 = input() # current_result = "" # previous_result = string_1 # # for index in range(len(string_1)): # for i in range(index+1): # current_result += string_2[i] # for j in range(index+1, len(string_2)): # current_result += string_1[j] # if current_result != prev...
582bc0ab32a6ac454f3b31a353a6f3589125f859
antares681/Python
/PythonFundamentals/Lecture.05.Lists.Basics_Advanced/Ex.08.Seize_the_Fire_TBS.py
1,465
3.71875
4
# cells_list = input().split('#') # effort = 0 # water = int(input()) # total_fire = 0 # cell_value = [] # # for cell in cells_list: # cell = cell.split(" = ") # # print (cell) # type_of_fire = current_cell[0] # cell_value = int(current_cell[-1]) # # if type_of_fire == "High": # if not 81 <= ...
7370191e966ddff6240e5a9aef8ea7366c3cc40d
antares681/Python
/PythonOOP/L05_Encapsulation/examples_dunder_methods.py
1,201
4.25
4
class Employee: name = 'Harsh' salary = '25000' def show(self): print(self.name) print(self.salary) employee = Employee() print(getattr(employee, 'name')) # Harsh print(hasattr(employee, 'name')) # True setattr(employee, 'height', 152) print(getattr(employee, 'height')) # 152 delattr(E...
a2919f9aea7e9c215626d5c2406dbbfb3df5d8b7
antares681/Python
/PythonFundamentals/Final_Exam_1/TEST_Activation_Keys.py
845
3.828125
4
text = input() command = input() while not command == "Generate": command = command.split(">>>") todo = command[0] if command[0] == "Contains": if command[1] in text: print(f"{command[1]} contains {text}") else: print("Substring not found!") elif command[0] == "F...
bd4bbf63a0956513ebdedc69b373bb3b6095d92b
antares681/Python
/PythonAdvanced/L.01.Stack_and_Queues/Ex.05.Truck_Tour.py
4,496
3.765625
4
# def station_config(num_of_stations): # petrol_stations = [] # for i in range(1, num_of_stations+1): # petrol_amount, km_next_station = input().split(' ') # petrol_stations.append([int(petrol_amount), int(km_next_station)]) # return petrol_stations # # def reach_calculator(circle): # st...
ad3ba9a8897192aef3ba99c7abb98923c5aedaaf
antares681/Python
/PythonOOP/L.01.Defining_Classes/Lab.01.Rhombus_of_Stars.py
1,084
3.90625
4
# # TODO FUNCITONAL WAY OF WRITING CODE def draw_rhombus(n): for i in range(n): offset = (n - i - 1) * ' ' print(f'{offset}{("* " * (i + 1)).strip()}') for i in range(n - 2, -1, -1): offset = (n - i - 1) * ' ' print(f'{offset}{("* " * (i + 1)).strip()}') # # draw_rhombus(int(inp...
ef2fe4083561ee130f9f4a6dffa948ff54e0e784
antares681/Python
/PythonAdvanced/L.05.Advanced_Functions/test.py
1,342
4.0625
4
#ARGS KWARG # def sum_func(arg, *args): # return arg + sum(args) # # print(sum_func(5)) # # map() # # TODO REDUCE FUNCTION HOW IT WORKS # from functools import reduce # # def add(a, b): # print(f'a = {a}') # print(f'b = {b}') # return a + b # # res = reduce(add, [1, 2, 3, 4, 5, 6]) # print(f'res = {r...
1a741a557058d2d3ce5c4722b2bc4adc629b3ee8
kuss21/Connect-4
/Erik_Gameplay.py
4,629
3.96875
4
#variables for size of board, if changed, need to fix the array for the board in playGame() amtOfRow = 7 amtOfCol = 10 from enum import Enum, unique @unique class Piece(Enum): BLANK = 1 RED = 2 YELLOW = 3 #functions #drawBoard draws the current state of the board, the board that is passed stores ' ', 'X'...
ef5062e2c601af94b7a4b518f46ee9c085de3ba9
kuss21/Connect-4
/Erik_aiTest.py
12,024
3.828125
4
#virtual Connect Four board for AI testing #variables for size of board, if changed, need to fix the array for the board in playGame() amtOfRow = 6 amtOfCol = 10 from enum import Enum, unique @unique class Piece(Enum): BLANK = 1 RED = 2 YELLOW = 3 import random #variables used for decision tree #coun...
717ac5040cffcda4db196ce469db0194a38539bc
poojasgada/SomeCoolAlgorithms
/BST.py
2,217
3.734375
4
''' Created on Jul 17, 2013 @author: psgada ''' ''' This is a simple Binary Search Tree Library(Sounds cool when i say it as 'Library', Hence :-)) Functions available: 1. Inserting Node in BST 2. Traversals in BST - Inorder, Postorder, Preorder 3. Searching in BST 4. Deleting in BST ''' ''' Deletin...
e2684a0574e2861afb6f75711a8dc93ee81c6c22
Kundan93/kundan_new_code
/class_py.py
488
3.984375
4
class Person: def __init__(self,age,name): self.age=age self.name=name def display(self): print("Person Age = ", self.name, self.age) def main(): P1=Person(18,"Kundan") P2=Person(22,"Lucky") P1.display() P2.display() main() '''class A: def dis(self): print ("\n\n\t Im from A") class...
64b534a37a9de46484cdf7f7b5cbb6e045af8e37
KiranChavan326/sdet
/python/acc11.py
326
4.0625
4
fruit_shop = { "apple" : 10, "orange": 20, "banana": 30, "watermelon":50 } print(fruit_shop) fruitToCheck=input("what you are looking for ").lower() if(fruitToCheck in fruit_shop): print("Yes This is available :",fruitToCheck) else: print("No This is not available :",fruitToCh...
549ef55252ad300720898d0830292eaa3d68fa86
Ryan-Walsh-6/ICS3U-Unit4-06-Python
/rgb_values.py
541
4.125
4
#!/usr/bin/env python3 # created by: Ryan Walsh # created on: December 2020 # this program prints out all the valid RGB values def main(): # this program prints out all the valid RGB values counter1 = 0 counter2 = 0 counter3 = 0 # process & output for counter1 in range(256): for coun...
1e52aa3f4d81666dc4dc6e29e075fc235339356e
s-das1/data-classifier
/utils.py
2,457
4.03125
4
import re import csv #checks if a string in a number def is_number(s): try: float(s) return True except ValueError: return False #calculates the percentage of the rows in a column that are numeric def account_balance_match_percentage(column_array): i = 1 #This is to ignore header o...
ecf11c6f88153832ebf6b4529ea4f42c7470ad67
xiongxiong109/py_go
/funcs/my_abs.py
1,249
3.59375
4
import math # 用def定义一个函数 def myAbs(a): if not isinstance(a, (int, float)): # 添加数据类型判断 raise TypeError('bad type of', a); return abs(a); # abs函数需要接收数字 def pos(x, y): return myAbs(x), myAbs(y); # 有多个返回值的时候, 返回的是一个tuple(不可变列表) def abstractFun(str): # 定义一个空函数, 用pass来占位 if (str): pass # 给...
5b5b2a9fda33437ce489189a8b48ec3ae6b7c38a
OreNot/PythonRep
/src/func.py
136
3.515625
4
def min2(a, b): if a <= b: return a; else: return b; print(min2(5, 2)); def f(n): return n * 10 + 5;
2e0a97bd016484be5f0a032cea639753c1b4eee1
OreNot/PythonRep
/src/f2.py
412
3.59375
4
def min(*a): m = a[0] for x in a: if m > x: m = x return m print(min (5, 4, 2)); def my_range(start, stop, step = 1): res = [] if step > 0: x = start while x < stop: res += [x] x += step elif step < 0: x = start while ...
9b292455a37228389ad9df4cdaef78f0229dc70b
OreNot/PythonRep
/src/2.py
81
3.53125
4
a = int(input()); if a % 2 == 0: print('Chetnoe'); else: print('NeChet');
0a77a93b3ffd08009a62d4e3d23fb8a6476314af
RinitaBetsy/Assignment_L1
/30.py
581
3.5
4
''' Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. ''' def bubblesort(arr): n=len(arr) ...
453d70a07cb1fa7ca37f8e9b2a13dbd14fc4b143
ValeriyMartsyshyn/BLITZ_LABs
/Lab1/Task[13-15].py
374
3.828125
4
#task 13 import math e=float(input("Enter an engle: ")) e1=math.radians(e) s=round(math.sin(e1),4) print("Sine is: ", end="") print(s) #task 14 p=float(input("Enter a power: ")) a=2**p s=str(a)[-2:] print ("Last two digits : ", end="") print (s) #task 15 w=float(input("Enter a weight in kilograms: ")) p=round((w*2....
521897bbd53295f89a3559aff0a74159567660a0
ValeriyMartsyshyn/BLITZ_LABs
/Lab2/task[7-9].py
1,302
3.984375
4
# task 7#create a list and print it #remove any repeated items and print the result  list = [0, 0, 1, 2, 2, 2, 3, 1, 3, 1, 3, 1, 4, 5, 6, 5, 4] print ("The initial list : " +  str(list)) res = [] for i in list:     if i not in res:         res.append(i) print ("The eventual list : " + str(res)) #task 8#create a list#s...
ad0ca15a08ff7651eb552f0e69e18a11589eb848
SriganeshNk/ML
/question3_solver.py
1,812
3.546875
4
class Question3_Solver: def __init__(self): self.centroid = [(30,60), (150,60), (90,130)] return # Add your code here. # Return the centroids of clusters. # You must use [(30, 30), (150, 30), (90, 130)] as initial centroids def get_cluster(self, points, centroids): distance, cluster = [], [] for point ...
31ee22933175fb2346cd32b55ba22c8211f2b707
nogaems/project-euler-solutions
/utils/faulhaber.py
588
3.921875
4
def ff(n, p=1): n = int(n) """ the sum of the p-th powers of the first n positive integers """ if p is 1: result = (n**2 + n) / 2 elif p is 2: result = (2 * n**3 + 3 * n**2 + n) / 6 elif p is 3: result = (n**4 + 2 * n**3 + n**2) / 4 elif p is 4: result =...
6ab52b69bb3de34647fcbbd4f6ad72339e909146
angelaoj04/respostas-estrutura-python
/resposta03.py
174
3.9375
4
num1 = input("Informe o primeiro número: ") num2 = input("Informe o segundo número: ") num1 = int(num1) num2 = int(num2) print("A soma dos número é: ", num1+num2)
6b5abf0064ec55b6cf35565f5bfeade43397715f
ludoro/Algorithm_blog
/rev_int.py
275
3.8125
4
def my_function(number): stringed = str(number) length = len(stringed) - 1 if stringed[length] == "0": print("Error, the reverse is overflow") exit() if number > 0: return stringed[::-1] else: return "-" + stringed[:0:-1]
f5307915fd67254f85332920d5002adbf670ac63
AustinArrington87/dev_practice
/python/json-test.py
268
3.859375
4
import json # convert from JSON to Python x = '{"name":"John", "age":30, "city":"New York"}' #parse x y = json.loads(x) print(y["age"]) # convert from Python to JSON x = { "name": "John", "age": 30, "city": "New York" } y = json.dumps(x) print(y)
e4e77c915c72dfbe03d1e1f3c2a7e797bd877a3a
AustinArrington87/dev_practice
/pandas/DecisionTree/decision.py
1,168
3.71875
4
import pandas from sklearn import tree import pydotplus from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import matplotlib.image as pltimg df = pandas.read_csv("model.csv") print(df) # to make decision tree, all data has to be numerical # create dictionary to map values to numerical...
c034fcf5ef87c3458732b076480ddd28b46b4b51
codezoned/ScriptsDump
/Arrays-searching/src/interpolation_search/interpolation_search.py
1,124
4.21875
4
#Interpolation Search by Master-Fury #Time Complexity : O (log log n)) #Function for Interpolation Search def interpolationSearch(arr,n,x): #arr is an array of size n and x is our searching element low=0 #low is the index of first element high=(n-1) ...
243d1f1499b800eb8c36044d2dddcf476449605d
codezoned/ScriptsDump
/Mathematical_Algorithms/src/factors_of_number.py
192
3.65625
4
#Author - @2hands10fingers #Modified - @nishantcoder97 & @master-fury def factors_of(number): return [i for i in range(1, number + 1) if number % i == 0] #Driver Code print(factors_of(6))
8cf37778b42a0f30e5be40f04c02f00760f52e94
codezoned/ScriptsDump
/Image_Processing/src/cropping/Resizing.py
771
4.1875
4
""" This is small script used for resizing any image. Resizing is useful whenever we have an image dataset having images of different resolutions. Any model would accept a fixed sized image and so we need to resize the image. OpenCV provides a direct implementation of resizing the image. There are 3 arguments in resiz...
cae05876fbcbc2ff546677c4352ebe8dbd847dcd
codezoned/ScriptsDump
/Arrays-Sorting/src/Insertion_Sort/Insertion_Sort.py
741
4.25
4
#Insertion Sort by Master-Fury #Time Complexity: O(n*n) def Insertion_Sort(arr): for i in range(1,len(arr)): pos=arr[i] j=i-1 while j>=0 and pos<arr[j]: arr[j+1]=arr[j] j-=1 arr[j+1]=pos #Driver Code arr=[43,25,44,78,453,897,6,54] #Your array Inserti...
1b7e3bdea651d481a5c68ee04435367cbd912e73
codezoned/ScriptsDump
/Arrays-Sorting/src/Counting Sort/counting_sort.py
763
4.0625
4
# Author: Omkar Pathak # Time Complexities: # Best Case: O(n + k), # Average Case: O(n + k), # Worst Case: O(n + k) def sort(_list): """ counting sort algorithm :param _list: list of values to sort :return: sorted values """ try: max_value = 0 for i in range(len(_list)): ...
3778b4c01f68c3da436a80c1d23d375d1173f241
codezoned/ScriptsDump
/Arrays-Sorting/src/Bubble_Sort/Bubble_Sort.py
500
4.09375
4
#Bubble Sorting by Master-Fury #Worst and Average Case Time Complexity: O(n*n) def Bubble_Sort(arr): l=len(arr) for i in range(l): for j in range(0,l-i-1): if(arr[j]>arr[j+1]): arr[j],arr[j+1]=arr[j+1],arr[j] return (arr) #Driver Code #Your array res=Bubble_Sort([1,34...
d06780f3ac7e96adcddb57e8414a3bbce6140f2c
codezoned/ScriptsDump
/Data_Structure/src/Trees/trie.py
3,463
3.5625
4
""" Trie implementation in Python by @Tr-Jono A trie is a type of search tree that is used for storing strings. Visual representation of a trie with strings "ab", "ac", "ace", "ba", "boom": [root] / \ "a" "b" / \ / \ "b" "c" "a" "o" | | "e" "o" | ...
61922fb6db4faf56be741a11b520ec43af83ca61
codezoned/ScriptsDump
/Machine_Learning/src/Gradient_Descent/gradientDescent.py
1,870
4.0625
4
"""Gradient Descent from Scratch for implementing Linear Regression Code by Paritosh Mahajan, github - https://github.com/paritoshM9 """ import numpy as np import matplotlib.pyplot as plt def error(m_current, b_current, x, y): """ Calculates total squared error in the predicted y value and the actual y value"""...
43c4226985b6bc6edc07315e57f867d0d274134d
codezoned/ScriptsDump
/Arrays-Sorting/src/oddEvenSort.py
840
4.21875
4
#Python Program to implement Odd-Even / Brick Sort #A python program to implement odd-even sorting or Brick Sort. #It is a kind of bubble sort since it is divided into two phases, #i.e. odd phase & even phase and bubble sort is implemented on each of the phases. def oddEvenSort(arr, n): isSorted = 0 ...
919f2e5bd0f415a870434f1ad627db588fd9fee3
codezoned/ScriptsDump
/Arrays-Sorting/src/Recursive_Bubble_Sort/Recursive_Bubble_Sort.py
547
4.03125
4
#Recursive Bubble Sort by Master Fury def Bubble_sort_rec(arr,l): if l==1: return for i in range(l-1): if arr[i]>arr[i+1]: arr[i],arr[i+1]=arr[i+1],arr[i] Bubble_sort_rec(arr,l-1) #Recursion return arr #Driver Code arr=[34,76,45,342,54,6,788,23] ...
9c25dfe9743ffa3e3276c36011c3af83938f47a4
codezoned/ScriptsDump
/Arrays-searching/src/tenary_search/ternary_search.py
1,309
4.40625
4
""" Ternary Search in Python by @Tr-Jono Algorithm: (list must be sorted) 1. If list is empty, return False. 1. Assign m1 and m2 s.t. they are the boundaries when the list is cut into thirds. 2. If list[m1] or list[m2] is the desired value, return True. 3. Else, use the same algorithm on: a. The first third of th...
36438067a5363060ef022db37ba2b244a8cd92a8
codezoned/ScriptsDump
/Graph_Algorithms/src/Length_of_cycles/length_of_cycles.py
2,390
3.609375
4
''' If a node is visited again in DFS it means there is a cycle. To get the length of that cycle, we save the parent of current node at every stage of that DFS. Once a visited node is detected again, from this node go its parent and from there to its parent and so on till we reach the first node again. We keep track o...
c003e0c2fb96763dd347395161c54cd5b6eae10e
codezoned/ScriptsDump
/Automation/src/execution_timer/et.py
438
3.734375
4
""" Decorator for execution time evaluation Usage ===== # @exec_time # def function_name(): """ def exec_time(func): """Returns the execution time of a function""" import timeit def wrapper(*args, **kwargs): start_time = timeit.default_timer() res = func(*args, **kwargs) elapsed = t...
f39915330d220283780166a39c7a10bd4f3309b9
mareced/naloga-8
/ali_ali.py
335
3.578125
4
stevilo_prijavljenih = 135 if stevilo_prijavljenih > 100: print("Dovolj prijavljenih: " + str(stevilo_prijavljenih)) print("Druga vrstica telesa if") elif stevilo_prijavljenih>90: print ("skoraj dovolj prijav") else: print("Pogoj ni bil resničen") if 1 == 1: print("1 je enako 1") print("Kon...
3699c5b101ae11d1e84c5a879a879944fe710746
kdani777/Snake
/unit_tests.py
3,617
4.03125
4
''' Authors: Kunal Dani, Marina Morrow, Shyanne Salen Last Modified: April 29th, 2019 Snake Project Software Carpentry Classic Snake This file unit tests our functions in our snake game to see where the errors occur. ***CLASS*** Test_Snake This function test our snake game ***FUNCTIONS*** get_colors_UT tests...
400efbde24cd3501891b970f5b6d25b4604a2c26
jwkimani/Project-Euler
/id6_Sum_Square_Difference.py
1,369
4.1875
4
__author__ = 'James W. Kimani' import math ''' The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of the squares of the first ten natural numbers and ...
a0915e07c27fc96520fefa1115cf679443313902
WashinRibeiro/URI_Python
/URI em Python/URI 1011 - Esfera.py
88
3.828125
4
R = float(input()) pi = 3.14159 vol = (4.0/3) * pi * (R**3) print(f'VOLUME = {vol:.3f}')
db3793b20881cdbcf478a4f7ea172589c064d5a7
WashinRibeiro/URI_Python
/URI em Python/URI 1018 - Cédulas.py
304
3.796875
4
#ler valor valor = int(input()) #imprimir valor print(valor) #cedulas cedulas = [100, 50, 20, 10, 5, 2, 1] for cedula in cedulas: qtd_cedulas = int(valor / cedula) #imprime quantidade de cédulas print('{} nota(s) de R$ {},00'.format(qtd_cedulas,cedula)) valor -= qtd_cedulas * cedula
ceaa397e1de1deb0915c5d9c34ec0c66f0b8dae0
Gouravsingh21/Algorithms
/college_algorithms/dectobin.py
581
4
4
# Program to convert the decimal number to binary def dectobin(n): split_num = str(n).split('.') int_part = int(split_num[0]) decimal_part = '0.'+split_num[1] decimal_part=float(decimal_part) val1='' val2='' while(int_part!=0): rem=int_part%2 val1=str(rem)+val1 int_p...
145931238937f087fcc9bdfb5c9738835df127da
Gouravsingh21/Algorithms
/college_algorithms/comp_menu.py
2,906
3.96875
4
def main(): print('1 for binary input or 2 for decimal input') choice=int(input('enter the choice of input')) if choice==1: num = input("enter the binary number") ch = int(input("enter the choice \n1 for one's compliment \n2 for two's compliemnt")) if ch == 1: print("1's ...
1e2fff4ad8cd62f1ce98ce88cf54c6158bf1e9e8
Gouravsingh21/Algorithms
/college_algorithms/fact.py
250
4.21875
4
# write a program to find factorial of a number def fact(num): sum=1 for i in range (1,num+1): res=i*(sum) sum=res print("factorial of number is",sum) return sum def main(): fact(5) fact(4) return 0 main()
585d80b5ce4909de666293e7a465c9277308735c
Gouravsingh21/Algorithms
/college_algorithms/bitwise.py
584
4.375
4
# write a program to left shift or right shift of given number def main(): num=int(input('enter the first number')) sf=int(input('enter the second number')) print('Enter 1 for or \n 2 for and\n 3 for xor') ch=int(input('enter the choice')) shift(ch,num,sf) def shift(ch,num,sf): if ch==1: ...
77d3cea71ccdee0a83eda10fd76608db72627195
Python4ick/file_formats
/hw_json.py
929
3.515625
4
import json TOP = 10 FILE = 'newsafr.json' def words_from_news(filename): all_words = [] with open(filename, 'r', encoding='utf-8') as f: json_data = json.load(f) for news in json_data['rss']['channel']['items']: all_words += news['description'].lower().split(' ') return all_w...
bc5b0ec6cc2794d4a967c960b63b1e80ce4451d7
GHooN99/2021_SJU_BOJAlgorithm.py
/5.이진탐색/공유기설치_lys7442.py
1,208
3.515625
4
def binary(arr,c): def possible(gap): count=0 tmp=-gap for i in arr: if(tmp+gap<=i): tmp=i count+=1 if(count>=c): return True return False l,r=0,max(arr) while(l<=r): mid=(l+r)//2 ...
dcec612f300a025baf64fe13a8294c91e785d623
GHooN99/2021_SJU_BOJAlgorithm.py
/2.구현/단어 뒤집기 2_soyoonjeong.py
753
3.515625
4
# 17413 s = input() start = 0 i = 0 #문자열 인덱스 while True: if s[i] == ' ': # 태그모드가 아닐 때 공백문자 만나면 for j in range(i-1, start-1, -1): print(s[j], end='') print(" ", end='') start = i+1 elif s[i] == '<': # 태그모드 시작 for j in range(i-1, start-1, -1): # 태그시작 전에 있던 문자들 출력 ...
c4236e80067fae8b39682efe349bd1bcc330ae2f
Eliziejus/PycharmProjects
/pythonProject/Exercises/exercise1.py
133
3.828125
4
name = input("Koks tavo vardas?") age = int(input("Koks tavo amžius?")) year = str((2021-age)+50) print(name + "po 50 metu bus wtiek: " +year)
e2bedef005073512cbb676e519e674a2f625e1e3
JRKisch/Code-lessons
/equals.py
208
4.03125
4
s = input() if s == "Apple" or s == "Blueberry": print("Pie?") elif s == "Orange": print("Orange you clever?") elif s == "Lemon": print("Life gives them to you.") else: print("INVALID FRUIT")
bed1ed2a8a194a128d2d285248f26a7f11d6abe5
JRKisch/Code-lessons
/for_loop_example.py
80
3.53125
4
for x in range(10): print("x is now " + str(x)) print("Done looping")
3e9418da9283dc444873aebffa5d094a80a6363a
JRKisch/Code-lessons
/Calc2.py
391
3.890625
4
L=float(input()) Done=False while not Done: R=input() if R=="finshed": Done=True else: R=float(R) op=input() re=0 if op=="+": re=L+R elif op=="-": re=L-R elif op=="*": re=L*R elif op=="/": ...
1a8973cf446c36a015e782860aa61d80ae9d3c7f
pushkarkale07/Data_Science
/HomeWork/HW6_Pushkar Kale/problem1.py
4,380
3.875
4
import math import numpy as np from collections import Counter #------------------------------------------------------------------------- ''' Problem 1: k nearest neighbor In this problem, you will implement a classification method using k nearest neighbors. The main goal of this problem is to get familia...
114b8e68be148d875268eb238561d27969c0db61
NVOkunev/Python
/GetUniqueElementsOfList.py
510
4.4375
4
#!/usr/bin/env python # Create empty lists for user data and resulting list lst = [] uniq = [] # User define the number of elements in list n = int(input("Enter number of elements : ")) # User define the n values of list's elements for i in range(0, n): ele = input() lst.append(ele) print('Initial list is: ...
e0ddc4f3bb73ee6b9c5914ca7cde161c65f9d9fc
JamesBond0014/Euler-Project
/Problem 9 - Special Pythagorean triplet.py
314
3.671875
4
def pythagoreantriplet(x): upper_a = x//3 - 1 upper_b = x//2 - 1 for i in range(upper_a): for k in range(upper_b): c = 1000 - i - k if (i*i + k*k == c*c): if (i<k and k<c): return i*k*c return 0 print(pythagoreantriplet(1000))
4fab390801c8d3e16f150608f4005330f5033dca
TOsborn/toy_problems
/algoexpert/nth_fibonacci/solution.py
169
3.640625
4
# solution.py from typing import List def getNthFib(n): if n == 1: return 0 a, b = 0, 1 for _ in range(n-2): a, b = b, a+b return b
7ac60cfada63bd2028651f9fbf68c231ae9067b3
TOsborn/toy_problems
/algoexpert/min_height_bst/min_height_bst.py
777
3.6875
4
def minHeightBst(array): def rec(array): if array == []: return None median = len(array) // 2 head = BST(array[median]) head.left = rec(array[:median]) head.right = rec(array[median+1:]) return head array = sorted(array) return rec(array) cla...
9ae4b4a1d039e3595147f037e3d1473ef6d0d607
TOsborn/toy_problems
/algoexpert/invert_binary_tree/invert_binary_tree.py
629
4.03125
4
def invertBinaryTree(tree): """Invert a binary tree. For each node in the tree, swap its left node for its right node. """ if tree is None: return None tree.left, tree.right = invertBinaryTree(tree.right), invertBinaryTree(tree.left) return tree class BinaryTree: def __init_...
75bb44408e46517ac165cb4495fb8d25f1b0c410
TOsborn/toy_problems
/algoexpert/binary_tree_diameter/binary_tree_diameter.py
687
3.953125
4
def binaryTreeDiameter(tree): """Find the diameter of a tree.""" def helper(tree): if tree is None: return -1, 0 left_depth, left_diameter = helper(tree.left) right_depth, right_diameter = helper(tree.right) depth = 1 + max(left_depth, right_depth) ...
6ff9abb523442a5dca07c6439a59eb19b6fa303d
TOsborn/toy_problems
/algoexpert/product_sum/product_sum.py
457
3.9375
4
def productSum(array): """Computes a "product-sum". Returns the sum of the elements in a nested array multiplied by the factorial of their depth. """ def rec(array, depth): if type(array) is int: return array if array == []: return 0 re...