blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
dd6d10fe7dc64becc624f34a0a52fff923138b0a | airkve/Ejercicios | /Listas/Ejercicio20.py | 605 | 3.703125 | 4 | # Crear una funcion que decida si dos numeros enteros son amigos, utilizando listas.
def numAmigos(num1, num2):
lstNum1 = []
lstNum2 = []
for i in range(1, num1):
if num1 % i == 0:
lstNum1.append(i)
for j in range(1, num2):
if num2 % j == 0:
lstNum2.a... |
ee7dfb17a68db0008bbd5afdfea6cf40cd0282d0 | learlinian/Python-Leetcode-Solution | /921. Minimum Add to Make Parentheses Valid.py | 475 | 3.625 | 4 | class Solution(object):
def minAddToMakeValid(self, S):
S_len = len(S)
adding = count = 0
for i in range(S_len):
if S[i] == '(':
count += 1
elif count > 0:
count -= 1
else:
adding += 1
... |
31054284754ccb3562da175b37d9923d986d463a | lizhenggan/TwentyFour | /01_Language/05_Python/study/lesson_04/14.集合.py | 1,285 | 3.921875 | 4 | # 集合
# 使用 {} 来创建集合
s = {10, 3, 5, 1, 2, 1, 2, 3, 1, 1, 1, 1} # <class 'set'>
# s = {[1,2,3],[4,6,7]} TypeError: unhashable type: 'list'
# 使用 set() 函数来创建集合
s = set() # 空集合
# 可以通过set()来将序列和字典转换为集合
s = set([1, 2, 3, 4, 5, 1, 1, 2, 3, 4, 5])
s = set('hello')
s = set({'a': 1, 'b': 2, 'c': 3}) # 使用set()将字典转换为集合时,... |
2b0db4c4928c974959e6ca6479a5b035e29a9ba7 | TwistF/homework | /homework1/8.py | 870 | 3.671875 | 4 | #!usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:47539
@file: 8.py
@time: 2020/3/10 16:46
"""
# 8 设计一个数据结构,用来存放10个员工的信息并初始化,
# 每个员工信息包括:工号,姓名,工龄,工资; 将这10个员工,按照工资从高到低打印输出;
# 提示:可以组合使用我们的序列数据类型;
list1 = [(120, "Li", 3, 1000),
(121, "sun", 5, 3456),
(122, "sunny", 1, 2345),
... |
8e998d992708cb6dffa29a0f0d6cc038562f1b19 | CruzHenry56/lab-09-functions | /pluralize.py | 85 | 4 | 4 | word = input("Word please... ")
def pluralize():
return word
print(word +"s")
|
54349fa0ef9427899fdad5c9227068217f7c36a1 | Anthony-Harrison/QA_Python | /Practice/Iteration.py | 518 | 3.828125 | 4 |
listVar = ["bananas", "Screwdriver", 243, "Keys", 100, 10000001]
for i in listVar:
print(i)
if type(i) == str:
print([char for char in i])
print("-------------------------------------------------------------")
dictList = {"1" : "2", "3" : "4"}
for i in dictList :
print(dictList.items())
print... |
6f7051a854aacbd77be80d3cf62773701b75f219 | srtulon/ESP-Mesh-Home-Automation | /Codes/Test_files/Python_test_scripts/db_test(sqlite3).py | 538 | 3.59375 | 4 | import sqlite3
conn= sqlite3.connect('test.db')
c= conn.cursor()
def create_table():
c.execute('CREATE TABLE IF NOT EXISTS links (id int, link int,status int)')
def data_entry():
c.execute('INSERT INTO links VALUES (986094,89593859,0)')
conn.commit()
c.close()
conn.close()
def read_db():
c.e... |
382cec24c5a3171e62e84c8d7cfab9463af25025 | bankaboy/CACIITGDataScience | /Week2_caciitg/day1/mlt1.py | 149 | 3.59375 | 4 | from matplotlib import pyplot as plt
x = [1,2,3]
y = [4,5,1]
plt.title('Info')
plt.xlabel('X Axis')
plt.ylabel('Y Axis')
plt.plot(x,y)
plt.show() |
d209d7dc65cc455f8c2ffe10e8784c4e22df6cce | zNIKK/Exercicios-Python | /Python_2/WHILE/programa -- Tratando vários valores.py | 214 | 3.75 | 4 | n=z=u=0
n=int(input('Digite um número [999 para parar]: '))
while not n==999:
u+=n
z+=1
n=int(input('Digite um número [999 para parar]: '))
print('A soma entre {} números foi de {}'.format(z,u))
|
0b1c100231c6dbe5d970655a92f4baed0cbe1221 | firoj1705/git_Python | /V2-4.py | 1,745 | 4.3125 | 4 |
'''
1. PRINT FUNCTION IN PYTHON:
print('hello', 'welcome')
print('to', 'python', 'class')
#here by default it will take space between two values and new line between two print function
print('hello', 'welcome', end=' ')
print('to', 'python', 'class')
# here we can change end as per our requirement, by addind end=' ... |
0951fe1884ef2e3b44a6800460d43ac953e7acf6 | Sitabja/Machine_learning_Projects | /iris_data/iris_data.py | 3,247 | 3.90625 | 4 | # https://machinelearningmastery.com/machine-learning-in-python-step-by-step/
"""
Created on Mon Jan 22 19:40:52 2018
@author: Sitabja Ukil
"""
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Load dataset
url = "https://archive.ics.uci.edu/ml/machine-learning-databas... |
780c46c89a423937fbe35e1146a7bae6bdde5c40 | brandi1986/lektion12_functions | /game_func.py | 1,560 | 3.6875 | 4 | def play_game():
import random
import json
import datetime
secret = random.randint(1, 30)
attempts = 0
name = input("Wie ist dein Name?")
wrong_guesses = []
score_list_dict = get_score_list()
while True:
guess = int(input("Rate die geheime Nummer (zwischen 1 und 30): "))
... |
958580b042a442d7fccf7672017172fca464cfb9 | ortizjs/algorithms_ | /InterviewCakeProblems2/second_largest_in_bst.py | 3,516 | 4.1875 | 4 | class BinaryTreeNode(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
### InterviewCake solutions:
## Recursive solution
# def largest_in_bst(root):
# if root is None is None:
# raise ArgumentError("Tree must contain at least 1 no... |
428215632064f54fe595ce32efc443434054c21c | QuantEcon/QuantEcon.py | /quantecon/distributions.py | 3,164 | 3.75 | 4 | """
Probability distributions useful in economics.
References
----------
http://en.wikipedia.org/wiki/Beta-binomial_distribution
"""
from math import sqrt
import numpy as np
from scipy.special import binom, beta
class BetaBinomial:
"""
The Beta-Binomial distribution
Parameters
----------
n : s... |
c3aa1a164d063e57f36e2f2b156346b926339b98 | amyvdgun/project_prog | /ranker_airlines.py | 2,644 | 3.5 | 4 | """
Jesse Haenen
10670742
Creates a ranking for each airline where airport are ranked based on the times
they fly on time.
"""
import csv
import json
# variables
airline_list = []
airport_list = []
master_list = []
iata_list = []
print("Generating keys...")
with open("data/airlines_aggregated.csv", "r", newline="")... |
24edee3e07424560f3d90ab7109f4804c49472f5 | Aasthaengg/IBMdataset | /Python_codes/p03737/s876377249.py | 242 | 3.734375 | 4 | s_list = list(input().split())
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
string = ''
for s in s_list:
idx = ascii_lowercase.find(s[0])
string += ascii_uppercase[idx]
print(string) |
3a81b3e088b0c749eb40ec065ea7cf97409a46d4 | HazelIP/pands-problem-sheet | /plottask.py | 854 | 4 | 4 | # The program displays a plot of the functions,
# f(x)=x, g(x)=x2 and h(x)=x3 in the range [0, 4] on the one set of axes.
# author: Ka Ling Ip
import numpy as np
import matplotlib.pyplot as plt
f = np.array ([0,1,2,3,4]) #f(x) in range [0,4]
g = f * f #g(x) = f squared
h = f * f * f # h(x) = f cubed
# create a plo... |
a2405b92487f615632fb4b4c43eeaa9728dbdb0e | najuzilu/ucsd_algorithms | /Algorithms_on_Graphs/week5/assignment/1_connecting_points/connecting_points.py | 1,326 | 3.59375 | 4 | #Uses python3
import sys
import math
def union(u, v, set_dist):
v_index = find(v, set_dist)
u_index = find(u, set_dist)
for item in set_dist[v_index]:
set_dist[u_index].append(item)
set_dist.pop(v_index)
return set_dist
def find(u, set_dist):
for i in range(len(set_dist)):
if u in set_dist[i]:
return i... |
3f81013e1d1462d128b9a292de7fdd99b32fab83 | charleskim7/PythonTextGenerator | /TextGeneratorFinal.py | 2,744 | 3.90625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 8 13:15:07 2017
@author: charleskim
"""
def fileAndDict():
# Prompt user for input file
userInput = input("Enter a text file (include quotation marks).\n")
infile = open(userInput, 'r')
myList = []
myDictionary = {}
for line in infile.readlines():
... |
5dcceb1827b797667c6fb368d1fb96a8be5ae528 | gsudarshan1990/PythonSampleProjects | /Python/AccessSpecifier.py | 307 | 4.125 | 4 | class Car:
numberOfWheels = 4
_color='Black'
__year=2017
class Bmw(Car):
def __init__(self):
print('The color of the car is {}'.format(self._color))
car=Car()
print('number of wheels in the car is ',car.numberOfWheels)
bmw=Bmw()
print('The year of manufacture is ',car._Car__year)
|
39ff4c7dfbd507a5c8eb212622c1f6c49a0a2bc0 | cmigliorini/symoro | /pysymoro/screw.py | 3,404 | 3.78125 | 4 | # -*- coding: utf-8 -*-
"""
This module contains the Screw data structure.
"""
from sympy import zeros
from sympy import ShapeError
class Screw(object):
"""
Data structure:
Represent the screw notation - a 6x1 vector in which the first
three rows represent the linear term and the last thre... |
25ca7e4c90a577990911fc4444bedc8cb28c023b | yaole/LearnPython | /DictionaryAndSet.py | 1,421 | 3.65625 | 4 | # DictionaryAndSet.py
# dict
d = ['Harden': 13, 'Lebron': 23, 'Tracy': 1]
d['Harden']
# 13
# 将数据放入 dict,可以通过 key 的方式放入
d['Westbrook'] = 0
d['Westbrook']
# 0
# 一个 key 只能对应一个 value,多次对一个 key 放入 value,后面的值会把前面的值冲掉
d['Kobe'] = 8
d['Kobe']
# 8
d['Kobe'] = 24
d['Kobe']
# 24
d
# ['Harden': 13, 'Lebron': 23, 'Tracy': 1, 'K... |
08d5997278dec3887f42df7dc02916867d9ef05a | nerolin91/pythonPractice | /countDiffer.py | 238 | 3.515625 | 4 | def countDiffer(st):
Ucount=0
Lcount=0
for i in st:
if i.isupper():
Ucount+=1
if i.islower():
Lcount+=1
return Lcount-Ucount
st="Hello"
result=countDiffer(st)
print(result)
|
bceaeeb8305a10601777feda4749c3f954684138 | Geordous-Huxwell/threading-multithreading | /Threading.py | 759 | 3.921875 | 4 | import threading
import time
class MyThread(threading.Thread):
def __init__(self,name):
super().__init__()
self.name = name
def run(self):
threadLock.acquire()
print("hello from", self.name)
threadLock.release()
time.sleep(2) #sleep to simulate a large computation
threadLock.acquire()
... |
070883bd7b5537cb04cea3e95ad5926628c9c82a | notarealorganization/Bagels | /Bagels.py | 2,219 | 3.96875 | 4 | import random
# new version
def getSecretNum (numDigits):
#Returns a random number with numDigits digits
numbers = list(range(10))
random.shuffle (numbers)
secretNum = ' '
for i in range(numDigits):
secretNum += str(numbers[i])
return secretNum
def getClues (guess, secretNu... |
43815ab10b7af65236aff86fec476d95b2231dc7 | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/web-dev-notes-resource-site/2-content/ciriculumn/week-17/python/Introduction-Programming-Python/Solutions/Module7TaxesChallengeSolution.py | 1,675 | 4.3125 | 4 | # Declare and initialize your variables
country = ""
province = ""
orderTotal = 0
totalWithTax = 0
# I am declaring variables to hold the tax values used in the calculations
# That way if a tax rate changes, I only have to change it in one place instead
# of searching through my code to see where I had a specific nume... |
b37a67cf593984fba24b9db48fb27b947dbf5bcf | flannsmith/rosalind.info | /complementing_a_DNA_strand.py | 682 | 3.84375 | 4 | #A and T are complements of C and G
#reverse complement of GTCA ==> ACTG ==> AGAC
#DNA = ['AAAACCCGGT']
DNA_complement = ['ACCGGGTTTT']
DNA = open('rosalind_revc.txt', 'r')
def complement_DNA_strand(DNA):
DNA_strand_comp=''
for i in DNA:
DNA_reversed = ''.join(reversed(i))
for letter in DNA_... |
5b9a0ca1575079fa15cfed2dc8e6cbda8210abed | akimi-yano/algorithm-practice | /oc/RobotPathsFirstAttempt.py | 1,526 | 4.21875 | 4 | # 1. Robot Paths
# Given a matrix of zeroes, determine how many unique paths exist from the top left corner to the bottom right corner.
# Input/Output
# Input: An array of an array if integers (matrix)
# Output: Integer
# Robot Paths Example
# Example 1:
# Input:
# [[ 0, 0, 0, 0],
# [ 0, 0, 0, 0],
#... |
6db088bfcc2e9f13420675506b31e08833a2954d | AdamZhouSE/pythonHomework | /Code/CodeRecords/2956/60697/281449.py | 767 | 3.53125 | 4 | t=int(input())
size=26
str=input()
res=[[1 for i in range(26)] for j in range(26)]
def product(n,base):
global ans
while(n>0):
if(n&1==1):
matrix(ans,base)
matrix(base,base)
n=n>>1
def matrix(a,b):
tmp=[[0 for i in range(size)] for j in range(len(a))]
for i in range(l... |
b40e28b71b47ccc7a8856a3ec4bfab635a5b20fe | jaredlesser57/python_tutorials | /testing/assertions_intro.py | 999 | 4.53125 | 5 | """
Assertions:
- We can make simple assertions with the 'assert' keyword
- 'assert' accepts an expression
- Returns 'None' if the epxression is truthy
- Raises an 'AssertionError' if the epxression is falsy
- Accepts an optionsl error message as the second argument
ASSERTS are NOT guranteed to run (becau... |
70906402f58ecca9d3574e890aaff3bf58476015 | IzLeandro/Lab-Diccionarios | /archivos.py | 916 | 3.578125 | 4 | #Elaborado por: Leandro Camacho Aguilar y Celina Madrigal Murillo
#Fecha de Creación: 13/11/2020 6:00pm
#Fecha de última Modificación: 13/11/2020 8:00pm
#Versión: 3.8.5
import pickle
def grabar(nomArchGrabar,lista):
"""Funcionamiento: guarda el contenido del diccionario en un archivo.
Entradas: nombre del arc... |
5533fc7d5d0128ef45dd950d64be23d3c41ddefc | Aasthaengg/IBMdataset | /Python_codes/p02420/s006821719.py | 226 | 3.671875 | 4 | while(1):
str = raw_input()
if str == "-":
break
else:
m = int(raw_input())
for i in range(m):
h = int(raw_input())
str = str[h:len(str)] + str[0:h]
print str |
f39a330010836481a0ebb92ddf2b03f3b6190391 | 5h3rr1ll/kleineAufgabenOhneLoesung | /Aufgabe4.1.2.py | 538 | 4.15625 | 4 | def RechenHilfe():
zahl1 = int(input("Gibt eine Zahl ein: "))
operator = input("Waehle eine Rechenart +, -, * oder /: ")
zahl2 = int(input("Gib eine zweite Zahl ein: "))
ergebnis = 0
if operator == "+":
ergebnis = zahl1+zahl2
elif operator == "-":
ergebnis = zahl1-zahl2
elif ... |
c14965de74f34f64aa336a39cc984491f80465b6 | gitmaheendra/hangman | /myhang.py | 972 | 3.71875 | 4 | import random
def get_wordlist():
f=open("/usr/share/dict/words")
clean_words = []
for i in f:
i=i.strip()
if i.isalpha() and len(i)>5:
clean_words.append(i.lower())
return clean_words
def select_word(word_list):
return random.sample(wordlist,1)[0]
def play_hangman(s... |
47952223e02a70f511a6aaf45b0925ad6e089c13 | Claudia169/PrimerRepo | /prog3.py | 160 | 3.921875 | 4 | num1 = int(input("Ingresa un numero: "))
num2 = int(input("Ingresa otro numero: "))
suma = 0
for num in range (num1, num2 +1):
suma += num
print (suma)
|
070e5cafd3f04a82388fa16fcd1a3a00d26af4a5 | beffiom/Learn-Python-The-Hard-Way | /ex10.py | 592 | 4.09375 | 4 | # initializes a string variable 'tabby_cat' that begins with a tab
tabby_cat = "\tI'm tabbed in."
# initializes a string variable 'persian_cat' that splits half the statement to a new line
persian_cat = "I'm split\non a line."
# initializes a string variable "backslash_cat" with backslashes between words
backslash_cat ... |
fe6d48edc6514d1a6188682bc5fe00833104a650 | MukulSangani/python-code- | /Python codes/Day 1 code.py | 1,884 | 4.28125 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
a=10
b=20
a=5; d=10
b,c=3.2,"Hello"
x=y=z="World"
print(c)
print()
print("value of b",b)
print("value of a =\n",a)
print(b,c)
print(b,c,sep=",")
c
print(a)
# In[2]:
# Division operation in Python
print(1/3)
print(1//3)# floored division
print(7%3)
print(round(1/3,... |
1ec3d4691edf331178abc7496b292dbb57696d29 | crheacofc/UndergradMath | /245/cramers.py | 528 | 4.25 | 4 | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 26 15:26:17 2015
@author: crhea
"""
import numpy as np
def cramers(A,b):
##This program will use Cramer's rule to determine x values given a
##Matrix A and another b where Ax=b. type cramers(A,b).
[m,n]=A.shape;
if m != n:
print('MUST BE SQUARE!!!')
... |
a724f67a7a6822ab959574c48808b82d1ecce61e | ev-moon/boj-algorithms | /shortest_path/shortest_path.py | 1,130 | 3.609375 | 4 | # Problem No. 1753
import sys
from collections import defaultdict
from heapq import heappop, heappush
input = sys.stdin.readline
def dijkstra(num_nodes, graph, start):
min_cost = {i: float("inf") for i in range(1, num_nodes + 1)}
heap = [(0, start)]
while heap:
cost, node = heappop(heap)
... |
b815980113cbec080f7cbf4f9f3e628b8b1a70f2 | nelsonn1622/CTI110 | /Tutorial/practice.py | 354 | 4.0625 | 4 | # a sample program
# cti 110
# nelsonn1622
# program to add two numbers
# userTyped = ("Tpe a number: ")
#userNumber = int(userTyped)
# get the numbers
firstNumber = int(input("Typed a number: "))
secondNumber = int(input("Type another number: "))
# add them
answer = firstNumber + secondNumber
#print the result... |
7bd92346e4ab2b3980dcf36ea2aba8c03691e6e2 | Nagendra-Svknska/GCP-DataEngineering | /Week_1/Probability/Prob_P1_ace.py | 326 | 3.546875 | 4 | s=0 #total no of ways possible
tries=0 #toal no of possible outcomes
for i in range(1,53):
if(tries<4): #total no of aces =4
tries+=1
s+=1 #total no of cards 52
print("S:",s," tries:",tries)
print("Probabilit :", float(tries)/s) #probability= no of ways possible / total no of possible ou... |
364207aa6cd237f1edf2c35a6644aa74c361e2ce | RaphaTux/CursoPythonUdemy | /desafio03.py | 309 | 3.921875 | 4 |
iNum1 = int(input( 'Digite o primeiro numero para somar ' ))
iNum2 = int(input( 'Digite o segundo numero para somar ' ))
iResultado = iNum1+iNum2
#print( 'O resultado da soma é ', iResultado)
#usando uma outra forma para printar a mensagem na tela
print('A soma dos numeros é {}'.format(iResultado))
|
78af616cc5ff2c67633699e6b6cb6f0a55111b77 | edu-athensoft/ceit4101python | /stem1400_modules/module_10_gui/s07_event/s074_misc/bind_multi_event.py | 405 | 3.578125 | 4 | """
Binding multiple events
"""
from tkinter import *
def click1():
print("1. Command event handler")
def click2(event):
print("2. Bind event handler")
root = Tk()
root.title("Event Handling | Unbind")
# root.geometry("640x480")
btn = Button(root, text="Multiple Events", command=click1)
btn.pack(anchor=... |
1219571e20c95b0a86edefcce0638b37cb48b9fa | yurimalheiros/IP-2019-2 | /lista4/sandro/questao2.py | 168 | 3.9375 | 4 | numero = 2
lista = []
while numero != 0:
numero = int(input("Digite um número de 0 a 9: "))
if(numero != 0):
lista.append(numero)
print(lista)
|
18f82195924670fbc2d4d13ec9092c95559e05df | tainenko/Leetcode2019 | /leetcode/editor/en/[621]Task Scheduler.py | 2,072 | 3.65625 | 4 | # Given a characters array tasks, representing the tasks a CPU needs to do, wher
# e each letter represents a different task. Tasks could be done in any order. Eac
# h task is done in one unit of time. For each unit of time, the CPU could complet
# e either one task or just be idle.
#
# However, there is a non-negativ... |
8bb2b4ff9dedc1f1e1d2ee9b996256af898a2613 | EmersonAires/Introducao_a_ciencia_da_computacao_com_Python | /Exercicios_Resolvidos/Parte 1/Semana 9/detector_plagio.py | 7,280 | 3.984375 | 4 | import re
def le_assinatura():
'''A funcao le os valores dos tracos linguisticos do modelo e devolve uma assinatura a ser comparada com os textos fornecidos'''
print("Bem-vindo ao detector automático de COH-PIAH.")
print("Informe a assinatura típica de um aluno infectado:")
wal = float(input("Entre o ... |
fe8d318345ad50bbefa183a7e94b8e3a818516fb | kolis10/recursive | /main.py | 492 | 3.5625 | 4 | import json
with open('users.json') as jfile:
users = json.load(jfile)
#------------------------------
# obj = {
# 'one': 4,
# 'two': 2
# }
# x = [4,5,'one',7,'two']
# for key, values in obj.items():
# # print(x[values])
# print(obj[x[values]])
#-------------------------------
for user in users:... |
058e163966fa0bfc4f6fde74fc9104c80adec1b5 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4083/codes/1876_1643.py | 239 | 3.5 | 4 | from numpy import*
v = array(eval(input("digite as notas: ")))
a = size(v)
b = 0
for i in range(a):
if(v[i] >= 5 ):
b = b + 1
print(b)
k = zeros(b, dtype=int)
h = 0
for j in range(a):
if(v[j] >= 5):
k[h] = j
h = h + 1
print(k)
|
1d9baf4029a9da00f212defc3a9dd49b8172ba9a | TheXienator/improved-tribble | /sudokusat.py | 1,310 | 3.90625 | 4 | def sudokuSTP(starting):
nums = "123456789"
for i in nums:
for j in nums:
lst = []
for k in nums:
lst.append("v" + i+j+k)
print ', '.join(lst) + " : BOOLEAN;"
for num in starting:
print "ASSERT(v" + num + ");"
def section(i, j, k):
i, j = int(i), int(j)
lst = []
for a in range(3):
for b ... |
e23498c4130f6721db29486795f1bc9c251be5ee | crazywiden/Leetcode_daily_submit | /Widen/LC1057_Campus_Bikes.py | 3,820 | 4.125 | 4 | """
1057. Campus Bikes
On a campus represented as a 2D grid, there are N workers and M bikes, with N <= M. Each worker and bike is a 2D coordinate on this grid.
Our goal is to assign a bike to each worker. Among the available bikes and workers, we choose the (worker, bike) pair with the shortest Manhattan distance be... |
4d5893f15285739e891fe138f6fe096b1f7fe6c3 | Gazhole/AdventOfCode2019 | /day1.py | 548 | 3.53125 | 4 | """
Advent of Code 2019
Day 1
"""
def load(path):
with open(path, "r") as inputfile:
return [int(module.strip("\n")) for module in inputfile]
def calculate_fuel(module):
total_fuel = 0
fuel = int(module / 3) - 2
while fuel > 0:
total_fuel += fuel
fuel = int(fu... |
26f44021f15ec67a0a7c6616fb8834bfc5b31dcd | sureshmelvinsigera/linkedlist | /deleteIfGreaterElementOnRight.py | 1,281 | 4.15625 | 4 | '''
Given a singly linked list, remove all the nodes which have a greater value on right side.
Examples:
a) The list 12 -> 15 -> 10 -> 11 -> 5 -> 6 -> 2 -> 3 -> NULL should be changed to 15 -> 11 -> 6 -> 3 -> NULL.
b) The list 10 -> 20-> 30 -> 40 -> 50 -> 60 -> NULL should be changed to 60 -> NULL.
c) The list 60 -> 5... |
4b6031a7687a9bb17430be3cf9c2d894ca1d1318 | Lonitch/hackerRank | /leetcode/872.leaf-similar-trees.py | 1,657 | 3.921875 | 4 | #
# @lc app=leetcode id=872 lang=python3
#
# [872] Leaf-Similar Trees
#
# https://leetcode.com/problems/leaf-similar-trees/description/
#
# algorithms
# Easy (64.22%)
# Likes: 576
# Dislikes: 28
# Total Accepted: 71.4K
# Total Submissions: 110.2K
# Testcase Example: '[3,5,1,6,2,9,8,null,null,7,4]\n' +
'[3,5,1,... |
fe93410db4ed9569a267c7e434b493ccae886686 | poojithayadavalli/Zoho | /final destination.py | 1,148 | 4.125 | 4 | """
Consider a 2d plane and a Robot which is located at (0,0) who can move only one unit step at a time in any direction
ie if its initial position is (x,y) he can go to positions (x + 1, y), (x - 1, y), (x, y + 1) or (x, y - 1).
Now Given three integers a,b (denoting the final position where the robot has
to rea... |
34daf2116a6a03e7fc65409f5b8106a8bb0dbfbd | hanhansoul/PythonForDataAnalysis | /chapter_7/section_7_2/example2.py | 598 | 3.796875 | 4 | import pandas as pd
# map
data = pd.DataFrame({'food': ['bacon', 'pulled pork', 'bacon',
'Pastrami', 'corned beef', 'Bacon',
'pastrami', 'honey ham', 'nova lox'],
'ounces': [4, 3, 12, 6, 7.5, 8, 3, 5, 6]})
meat_to_animal = {
'bacon'... |
7d8cdf8980e9b01c59a69353afd872dd47d79054 | krskelton/Python-Projects | /Challenges/forloop.py | 195 | 4.15625 | 4 | fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
print(fruit)
if fruit == "banana":
continue
elif fruit == "cherry":
break
for x in range(6):
print(x)
|
1316f1e3eb4e213de192c7d2fe2180edbbb7940d | southpawgeek/perlweeklychallenge-club | /challenge-011/paulo-custodio/python/ch-1.py | 436 | 3.96875 | 4 | #!/usr/bin/python3
# Challenge 011
#
# Challenge #1
# Write a script that computes the equal point in the Fahrenheit and Celsius
# scales, knowing that the freezing point of water is 32oF and 0oC, and that
# the boiling point of water is 212oF and 100oC. This challenge was proposed
# by Laurent Rosenfeld.
#
# F = (C *... |
b7f8a60b945afd2252b21b92dbf9e48fe87191e9 | joseduc10/hackerrank | /regex/valid-pan-format/valid-pan-format.py | 308 | 3.65625 | 4 | #!/usr/bin/python
import re
def main():
n = int(raw_input())
pans = [raw_input() for i in xrange(n)]
regex = re.compile('[A-Z]{5}[0-9]{4}[A-Z]')
for p in pans:
if regex.search(p):
print 'YES'
else:
print 'NO'
if __name__=='__main__':
main()
|
92580a516f358dae71e62e1b20e87bb8f1977e4f | Mishakaveli1994/Python_Fundamentals_May | /Regular Expressions/1_Match_Full_Name.py | 133 | 3.546875 | 4 | import re
regex = r'(\b[A-Z][a-z]{1,} [A-Z][a-z]{1,}\b)'
names = input()
matches = re.findall(regex, names)
print(' '.join(matches))
|
ac4061c5671443fcf54ce4d871abb30d4689f400 | hmchen47/DataScience | /AppliedDS-UMich/4-TextMining/notebooks/03-Case+Study+-+Sentiment+Analysis.py | 4,760 | 3.78125 | 4 |
# coding: utf-8
# ---
#
# _You are currently looking at **version 1.0** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-text-mining/resources/d9pwm) course resource._
#
# ... |
9054cb7c658da9c8d7ee54e4aa10124dcf175e36 | shiwanibiradar/10days_python | /day6/Refunction/mailexample.py | 315 | 4 | 4 | #suppose you want to search mail id inside string 'zyx abc@gmail.com monkry'
import re
n=int(input())
for i in range(n):
str1=input()
#match = re.search(r'\w@\w+',str)
match = re.match(r'[\w.-]+@+[\w.-]+',str1)
print(str1)
for i in str1:
if match:
print("Valid mail")
break
else:
print("Invalid mail")
break... |
96179ffc018def0e7f240f67cf369ef5e1e14502 | AksR2/python | /LxTHW/ex29.py | 450 | 3.921875 | 4 | people=20
cats=30
dogs=15
if people<cats:
print "Too many cats! The world is doomed!"
print "line 2"
if people>cats:
print "Not many cat! The worls is saved!"
if people<dogs:
print"The world is drooled on!"
if people<dogs:
print "The world is dry!"
dogs+=5
if people>=dogs:
print "People are greater than o... |
60857b847155cf36e17da4c655652596fa632bb3 | JoshOY/Leetcode-Solutions-with-Script-Language | /013/solution.py | 715 | 3.875 | 4 | """
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
"""
class Solution:
# @return an integer
def romanToInt(self, s):
if not s:
return 0
numdic = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D':500, 'M': 1000}
res... |
b1496d112a587c1b5b058d1bcc961a225186d9c2 | sudoheader/TAOD | /python_calculator_app.py | 2,313 | 4.40625 | 4 | #!/usr/bin/env python3
def add(a, b):
"""Add two numbers and return the sum"""
summation = round(a + b, 4)
print("The sum of " + str(a) + " and " + str(b) + " is " + str(summation) + ".")
return str(a) + " + " + str(b) + " = " + str(summation)
def subtract(a, b):
"""Subtract two numbers and return the differenc... |
e67c72d98272b8956c13b30558709d957ddc39ed | kzd0039/leetcode_problems | /55.py | 433 | 3.53125 | 4 | def canJump(nums):
l = len(nums)
for i in range(l):
if i != l-1 and nums[i] == 0:
j = i
while j >= 0:
if nums[j] > i:
break
j = j - 1
if j < 0:
return False
nums[i] = nums[i] + i
... |
28b7ea10952620e99767f16d1778d6c115d7e7ee | ImtiazVision/Python | /HW Chp 8/ex4.py | 606 | 4.34375 | 4 | '''
Imtiaz Ahmed
Exercise 4
5/12/19
Syracuse sequence
'''
def main():
print("This program outputs a Syracuse sequence")
n = int(input("Enter the initial value that is greater than 1 : "))
while n != 1:
print(n, end=' ')
if n % 2 == 0:
n = n / 2
else:
n ... |
de9d7bc7fc6957a2e52396796f88aad7ef027681 | edwardwbli/ProjectA | /Python/Grades.py | 646 | 3.984375 | 4 | def print_grades(grades):
for grade in grades:
print grade
def grades_sum(scores):
total = 0
for score in scores:
total += score
return total
print grades_sum(grades)
def grades_average(grades):
return grades_sum(grades) / float(len(grades))
print grades_average(grades)
def... |
00cec7548b76a11f73ebeee6cf1a5f588cc7ec52 | aparker22/DC-Python | /list_exercises.py | 638 | 3.859375 | 4 | # Sum the numbers
numbers = [4, 7, 10, 5]
sum_numbers = 0
for number in numbers:
sum_numbers += number
print sum_numbers
largest = numbers[0]
for number in numbers:
if number > largest:
largest = number
print largest
print max(numbers)
smallest = numbers[0]
for number in numbers:
if number < sm... |
11e2dc89337dc1362f365b2465f971b0492173d6 | Conor134/python-challenge | /PyPoll/FINAL_main.py | 3,098 | 3.875 | 4 | # Modules
import os
import csv
count = 0
FullList=[]
VoteCount = []
PercentVotes = []
# Set path for file
csvpath = os.path.join("Resources", "election_data.csv")
# Open the CSV
with open(csvpath) as csvfile:
PyPoll = csv.reader(csvfile, delimiter=",")
# Read the header row first (skip this part if there i... |
3291970620fea7c32c3696cb71ae8b575249061b | eribertto/tiny_python_projects | /04_jump_the_five/jump.py | 1,164 | 4.375 | 4 | #!/usr/bin/env python3
"""
Author : Eriberto Mendez <erimendz@gmail.com>
Date : 2023-06-09
Purpose: Working with Dictionary data type
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
descript... |
c0f95629d5318274ae0fb757ab58eebca897fc3c | indu5500/Advanced-Data-Structures-through-Python | /EXPEREMENT 1/1 a/insertion bst.py | 947 | 4.15625 | 4 | class Tree:
def __init__(node, value):
node.value = value
node.left = None
node.right = None
def Inorder( node, Root ):
if( Root is None ):
return
node.Inorder(Root.left)
print(Root.value,end = ' ')
node.Inorder(Root... |
a76e47b46f891325693e4f98bde48820fb9b18b7 | lvuna/Algorithm | /tree/helper.py | 2,162 | 3.984375 | 4 | """All the helper functions of avl_tree implementation"""
from bst_tree import TreeNode
from avl_tree import AvlNode
# ***************The start of all rotation methods********************
def left_rotate(node: "AvlNode") -> None:
# set up node
rotate_node = node.right
# change the parent
rotate_node.... |
6d928ee81d16f67f8149440bfe67013818220312 | madeibao/PythonAlgorithm | /PartC/py验证二叉搜索树3.py | 1,340 | 3.8125 | 4 |
class TreeNode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def isValidBST(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
def helper(node, mina, ma... |
39840e1efbf37ce8ef6d58c3cbd57d2b21121876 | Tiffz-24/Discrete-Math-Algorithms | /PascalFormula.py | 264 | 3.828125 | 4 | def getCoefficient(n, k):
if k > n:
return 0
if k == 0 or k == n:
return 1
return getCoefficient(n-1, k-1) + getCoefficient(n-1, k)
def main():
n = int(input("enter n here: "))
k = int(input("enter k here: "))
print(getCoefficient(n, k))
main()
|
afc541e4bdf6b83cb34f41b526372a7aef9fdb9f | chantigit/pythonbatch1_june2021data | /Python_9to10_June21Apps/project1/functionapps/ex4.py | 584 | 3.765625 | 4 | '''
1.With parameters & With return value
2.With parameters & With out return value
3.With out parameters & With return value
4.With out parameters & With out return value
'''
#PS: Addition of 2 numbers
#Called Functions
def addition1(n1,n2):
result=n1+n2
return result
def addition2(n1,n2):
resul... |
afdd33f88dcaa781d675e9909c0aba80571a0f6c | nakuyabridget/pythonwork | /dating.py | 388 | 3.828125 | 4 | def allowed_dating_age(my_age):
girls_age_limit=my_age/2 + 7
return girls_age_limit
Olivias_limit = allowed_dating_age(27)
Solomons_limit = allowed_dating_age(32)
Bernabus_limit = allowed_dating_age(23)
print("Olivia can date girls",Olivias_limit,"and older")
print("Solomon can date girls", Solomons_limit ,"and old... |
fb5fd5074c09a6612dfaff86e02a5076bbb2d7f4 | congyingTech/Basic-Algorithm | /medium/backtrack/39-combination-sum.py | 1,392 | 3.78125 | 4 | """
给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。
candidates 中的数字可以无限制重复被选取。
说明:
所有数字(包括 target)都是正整数。
解集不能包含重复的组合。
示例 1:
输入:candidates = [2,3,6,7], target = 7,
所求解集为:
[
[7],
[2,2,3]
]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/combination-sum
"""
class Solution(objec... |
6cf00db1bc2f29cf0c9c6e45dfe796c2faf6151d | ICS3U-Programming-JonathanK/Unit1-04-Python | /basic_math.py | 505 | 3.75 | 4 | #!/usr/bin/env python3
# Created By: Jonathan Kene
# Date: April 28, 2021
# This does basic math
import math
def main():
print("4+4={}".format(4+4))
print("5-3={}".format(5-3))
print("3*3={}".format(3*3))
print("10/5={}".format(10/5))
print("2**3={}".format(2**3))
print("(8+8)/4={}".format((8+8)... |
a720dfd28402720544a6a2ca93f4feb6a027f3bd | mkylemartin/french-news-corpus | /1_google_searches.py | 2,498 | 3.625 | 4 | """ This script generates google search queries and uses requests to go get
the HTML from the google search page. This was the most time-consuming
step in the process.
Certain lines are commented out as evidence of debugging and
to help me remember what I had already done.
Anyways, this script ma... |
128a6b55e88389d5b1d351a7efd7ae07d5c992f3 | mkerimbay/Algorithms | /BinaryTrees/count_unival_subtrees.py | 1,209 | 4.09375 | 4 | '''
Given a binary tree, count the number of uni-value subtrees.
A Uni-value subtree means all nodes of the subtree have the same value.
Example :
Input: root = [5,1,5,5,5,null,5]
5
/ \
1 5
/ \ \
5 5 5
Output: 4
'''
class Node:
def __init__(... |
981e641dd7a9f9285e73258bc0cc82a5daba5371 | mebinjohnson/Basic-Python-Programs | /Class/Class-Car.py | 380 | 3.65625 | 4 | class Car(object):
condition="new"
def __init__(self,model,color,mpg):
self.model=model
self.color=color
self.mpg=mpg
def display_car(self):
print "This is a %s %s with %s MPG." %(self.color,self.model,str(self.mpg))
my_car=Car("delorean", "silver", 88)
#print my_car.model... |
74abee989ba574645087feaa28fc621e7b865309 | nihar-mukhiya/accounting | /acc2.py | 1,254 | 4.03125 | 4 | """
This program takes Product type along with it's price and quantity into a empty nested dictionary.
Output contains complete inventory list and the final cost to be paid.
Author : Nihar Mukhiya
Version: 2
Date: 02/09/2018
"""
import sys
import pprint
inventory = {1:{'product', 'price', 'quantity'}}
w... |
0e89f43161009efc79d682584518c8cce89196d6 | ngovanuc/UDA_NMLT_Python_chapter06 | /page_203_project_03.py | 925 | 4.3125 | 4 | """
author : Ngô Văn Úc
date: 30/08/2021
program: 3. Elena complains that the recursive newton function in Project 2 includes an extra
argument for the estimate. The function’s users should not have to provide this
value, which is always the same, when they call this function. Modify the definition
of the functio... |
2083a2dcfe7efb5edb9b058f31b3c8f1f6ff7315 | mdisieno/Learning | /Python/MOSH_PythonBeginner/14_dictionaries.py | 504 | 3.859375 | 4 | #first val is key
customer = {
"name":"John Smith",
"age" : 30,
"is_verified": True
}
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
#call key
print(customer["name"])
# Exercise
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
numbers = {
"1":"One ",
"2":"Two ",
"3":"Three ",
"4":"Four ",
"5"... |
e9315985848428009c18c35cccacd0a4ae7926d6 | watadarkstar/leetcode-solutions | /python/9-palindrome-number.py | 428 | 3.828125 | 4 | """
Determine whether an integer is a palindrome. Do this without extra space.
"""
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
rev = 0
copy = x
if x < 0:
return False
while x > 0:
... |
937f490e374ca97bb6d8798dd0e31816688878f8 | bobheck/tut | /python-master/HelloWorld2/HelloWorld.py | 500 | 3.9375 | 4 | # greeting = "Hello"
# name = input("Enter name: ")
# print(greeting + ' ' + name)
#comment
splitString = "This string has been\nsplit over\nseveral\nlines"
print(splitString)
tabbedString = "1\t2\t3\t4\t5"
print(tabbedString)
print('The pet shop owner said "No, no, he\'s resting')
splitString2 = """This string has... |
08057c0df442311dcd2000d3245e95bcebbb0c3f | mohanalearncoding/Leetcodepython | /buyandsellstockII.py | 202 | 3.53125 | 4 | def maxProfit( prices):
total=0
for i in range(1,len(prices)):
if prices[i]>prices[i-1]:
total+=(prices[i]-prices[i-1])
return total
print(maxProfit([1,2,3,4,5]))
|
db08f651c662ee35331f397238e390030dbdeb02 | S1lenix/PythonLabs | /Python2/13.4. Два Пути.py | 328 | 3.59375 | 4 | num = int(input())
first = [int(input()) for i in range(num)]
second = first
training = int(input())
for i in range(training):
brother = int(input())
if brother == 1:
first[int(input())] += int(input())
elif brother == 2:
second[int(input())] += int(input())
print(*first)
print(... |
c7209405581d96e8102205f6943d19746bb41f39 | KareliaConsolidated/Data-Structures-and-Algorithms | /47_Practice/51_WildWest/01_countZeros.py | 497 | 3.71875 | 4 | def countZeros(arr):
left = 0
right = len(arr) - 1
if arr[left] == 1 and arr[right] == 1: return 0
if arr[left] == 0 and arr[right] == 0: return len(arr)
while left < right:
mid = (left + right) // 2
if arr[mid] == 1:
left = mid + 1
elif arr[mid] == 0:
right = mid
return len(arr) - right
print(cou... |
78f4d61aa9ca196864c3e02b74d526805f407185 | doronfeldman/python-101 | /day_one/conditions.py | 1,884 | 4.0625 | 4 | from util import printer
class AnotherFalseClass:
def __len__(self):
return 0
class FalseClass(object):
def __bool__(self):
return False
def learn():
printer.print_explanation('● There are a lot of False/True conditions in python:')
if not False:
printer.print_runtime('Fals... |
1929e8b0fbb45098ba1464ff0fddd47a96c7a109 | vkrishan/Python | /Project1/TestMain.py | 238 | 3.859375 | 4 | def main():
print("Hello World from INside main")
print("Hello World OUTside main")
# To call a function, use if statement in Python2
#if __name__ == "__main__":
# main()
# Calling function in Python3
main()
print("End of file")
|
ffb142e3f6c5657e65a899ebb1ae71af34a65558 | chaojie-fu/Data_Structure_and_Algorithms_in_python | /Chapter_6/Stack_Class.py | 828 | 3.78125 | 4 | class Empty(Exception):
pass
class ArrayStack:
def __init__(self):
self._data = []
def __len__(self):
return len(self._data)
def is_empty(self):
return len(self._data) == 0
def push(self, e):
self._data.append(e)
def pop(self):
if self.is_empty():
... |
a94c93843731f3ced7f94a9110e75c4c95cee23b | horejsek/python-debugger | /examples/example.py | 1,128 | 3.625 | 4 | # -*- coding: utf-8 -*-
import debugger
import time
import logging
logging.basicConfig(level=logging.DEBUG)
# Python3:
# class C(object, metaclass=debugger.DebugMetaclass):
class C(object):
__metaclass__ = debugger.DebugMetaclass
def __init__(self):
pass
def pow(self, num, exponent=2):
... |
6a738eed72a2affe697e8cc78155b0e96bafcb79 | ysyfff/py | /chn_sort.py | 279 | 3.8125 | 4 | #coding:utf8
# char = ['中图法', '代码', '书评', '黑体辐射', '蔡司', '溯源', '论文']
# char.sort()
# for item in char:
# print item
char = ['不会吧', '怎么样', '不可能', '在一起', 'a', 'c', '1', '3']
char.sort()
for item in char:
print item
|
eee5c00964e135de2bc1c71fda2309b5796d8bda | isakss/Forritun1_Python | /cash_register.py | 1,467 | 3.578125 | 4 | class CashRegister(object):
def __init__(self, tax_rate = 0.0):
self.__tax_rate = tax_rate
self.__item_list = []
self.__item_count = 0
def add_item(self, price, is_taxed):
self.price = price
self.taxable = is_taxed
self.__item_list.append([self.price... |
a4d9f33d266d040ee665676b36149fb692b1cf85 | roachsinai/Coding_Interviews | /CtCI-6th-Edition-Python/Chapter5/2_binary_to_string.py | 3,253 | 3.546875 | 4 | # 返回一个浮点小数的二进制表示,如果32个二进制位无法表示该小数的精度,raise ERROR
#
# 解法一,得到小数的浮点表示:1个符号位,11个指数位,52个小数位的后20位如果非0,表示超出精度
# IEEE754标准中小数的整数部分都是1*符号位(但是二进制表示时去掉了1,转换为小数时再添上),所
# 以使用上述方法的输入为小数加上1
#
# 解法二,小数乘以2,如果大于1,说明对应浮点表示的小数部分第一位为1。将乘以2之后的数减去1之后
# 的小数部分即原来小数部分的第二位
#
# 解法三,小数如果大于0.5,说明浮点表示的小数部分的第一位是1。减去0.5之后如果大于0.25说明浮点
# 表示的第二位为1,然后减去0.... |
4016de398c2aab8907147406f793fa60928cf672 | RobertKashyap/terminalCalculator | /calci.py | 495 | 4.03125 | 4 | #!/usr/bin/python3
import re
print('THE CALCULATOR')
print("Type 'quit' to exit\n")
previous = 0
def performMath():
global previous
equation = ""
if previous == 0:
equation = input('enter equation : ')
else:
equation = input(str(previous))
if equation == 'quit':
print('Good Bye!!')
quit()
else:
e... |
9802096e49a86900c9273516b9583a9a4100ba28 | player-Ling/python | /exercise/生成器.py | 859 | 3.71875 | 4 | def triangles():
list1=['','','','','',1,'','','','','']
#print(list1)
while 1:
yield list1
list2 = []
for i in range(11):
try:
if type(list1[i - 1]) == int or type(list1[i + 1]) == int:
if type(list1[i - 1]) == int and type(list1[i + 1... |
224af02f63d08cd5df41872dfad96a987aa9ee7a | ChoiYoonJong/DataScience | /python_Pandas_Numpy/python/for_if_over.py | 574 | 3.8125 | 4 | #for + if
'''
n=int(input('n:'))
for i in range(1,n+1):
if i%3 ==0: # i 의 값이 3으로 나누었을때 나머지가 0인견우 , 3의배수
print('X')
else:
print(i)
'''
'''
#while + if
num1 = 0
num2 = int(input('n:'))
while True: #무한 루프상태 , 실행을 하게되면 1씩 늘어나는거...
num1 = num1 + 1
print(num1)
if num1== num2: #num1 에 1씩 추가 되면서 나... |
b7cf9e75249acd25fb9b83d9d75b955c7da4ac70 | django-group/python-itvdn | /домашка/essential/lesson 3/Sokolov Oleksandr/Task2_les3.py | 916 | 4.15625 | 4 | def add(a, b):
return a + b
def sub(a, b):
return a - b
def mul(a, b):
return a * b
def div(a, b):
try:
return a / b
except ZeroDivisionError:
print("Divide by 0 Error")
def pow(a, b):
try:
return a ** b
except ZeroDivisionError:
print("Raising ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.