blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
bcf0ea0073f1ff6635e224542e025db935224de2 | victor-da-costa/Aprendendo-Python | /Curso-Em-Video-Python/Mundo-3/EXs/EX079.py | 413 | 4.15625 | 4 | numeros = []
while True:
num = int(input('Digite um número: '))
if num in numeros:
print(f'O número {num} já existe na lista, portanto não será adicionado')
else:
numeros.append(num)
continuar = str(input('Quer adicionar mais um número na lista? S/N ')).upper()
if continuar == 'N':
... | false |
da100cf4a30bed21264a673ed585ce508ca89115 | victor-da-costa/Aprendendo-Python | /Curso-Em-Video-Python/Mundo-2/EXs/EX037.py | 579 | 4.1875 | 4 | num = int(input('Digite um número inteiro qualquer: '))
print('''Escolha uma base de conversão:
[1] Converter para Binário
[2] Converter para Octal
[3] Converter para Hexadecimal''')
escolha = int(input('Converter para: '))
if escolha == 1:
print('{} convertido para Binário é igual a {}'.format(num, bin(num) [2:]))... | false |
9a16c181418ba0fb5d6118d89d95a179942b7f05 | GitSmurff/LABA-2-Python | /laba6/laba1.py | 1,002 | 4.21875 | 4 | import abc
class Abstract(abc.ABC):
@abc.abstractmethod
def __init__(self, x):
self.x = 0
class Queen(Abstract):
def __init__(self):
self.x = int(input('Введите число от 1 до 9: '))
if self.x >= 1 and self.x <= 3:
s =str(input("Введите строку: "))
n... | false |
3ed6e13c885c7e666fd318e32e3b20278581df18 | kaiyaprovost/algobio_scripts_python | /windChill.py | 1,076 | 4.1875 | 4 | import random
import math
def welcome():
print("This program computes wind chill for temps 20 to -25 degF")
print("in intervals of 5, and for winds 5 to 50mph in intervals of 5")
def computeWindChill(temp,wind):
## input the formula, replacing T with temp and W with wind
wchill = 35.74 + 0.62... | true |
7f5e66623babc6919733bec982bbd4d4baa10176 | Ojhowribeiro/PythonProjects | /exercicios/PycharmProjects/exepython/ex014.py | 315 | 4.125 | 4 | c = float(input('Qual a temperatura em c°:'))
f = float((c*1.8)+32)
k = float(c+273)
print('{}°C é igual a {:.2f}°F e {:.2f}°K'.format(c, f, k))
'''c = float (input('qual o valor em °c: '))
f = float (((9*c) /5 ) + 32)
k = float (c + 273)
print('{}°C é igual a {:.2f}°F e {:.2f}°K'.format(c, f, k))''' | false |
0369b41812b9cdd3bd66f2dacbd728497b6525c8 | Ojhowribeiro/PythonProjects | /exercicios/PycharmProjects/exepython/ex006.py | 370 | 4.15625 | 4 | n = int(input('digite um numero: '))
dobro = int(n*2)
triplo = int(n*3)
raiz = float(n**(1/2))
print('O dobro de {} é {}, o triplo é {} e a raiz é {:.2f}'.format(n, dobro, triplo, raiz))
'''n = int(input('digite um numero: '))
mul = n*2
tri = n*3
rai = n**(1/2)
print('o dobro de {} é {}, o triplo é {} e a raiz quad... | false |
d5db4d147d1a96ba1713d98198e9c596b6d9e84c | Ojhowribeiro/PythonProjects | /exercicios/PycharmProjects/exepython/ex008.py | 396 | 4.21875 | 4 | medida = float(input('Qual o valor em metros: '))
cm = float(medida*100)
mm = float(medida*1000)
km = float(medida/1000)
print('{} metros: \n{:.3f} cm \n{:.3f} mm\n{:.3f} km'.format(medida, cm, mm, km))
'''medida = float(input('qual a distancia em metros:'))
cm = medida * 100
mm = medida * 1000
km = medida / 1000
pri... | false |
9de3fd928aecb53938eb1ced384dfb9deeb3a5b9 | lzaugg/giphy-streamer | /scroll.py | 1,426 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Console Text Scroller
~~~~~~~~~~~~~~~~~~~~~
Scroll a text on the console.
Don't forget to play with the modifier arguments!
:Copyright: 2007-2008 Jochen Kupperschmidt
:Date: 31-Aug-2008
:License: MIT_
.. _MIT: http://www.opensource.org/licenses/mit-license.php
"""
... | true |
f8f775245f38f0553c139bf3253c449e7bf851d8 | judeinno/CodeInterview | /test/test_Piglatin.py | 941 | 4.15625 | 4 | import unittest
from app.Piglatin import PigLatinConverter
""" These tests are for the piglatin converter"""
class TestConverter(unittest.TestCase):
"""This test makes sure that once the first letters are not vowels they are moved to the end"""
def test_for_none_vowel(self):
self.pig = PigLatinConve... | true |
5b2887021b660dfb5bca37a6b395b121759fed0a | Kontetsu/pythonProject | /example24.py | 659 | 4.375 | 4 | import sys
total = len(sys.argv) - 1 # because we put 3 args
print("Total number of args {}".format(total))
if total > 2:
print("Too many arguments")
elif total < 2:
print("Too less arguments")
elif total == 2:
print("It's correct")
arg1 = int(sys.argv[1])
arg2 = int(sys.argv[2])
if arg1 ... | true |
e8310a33a0ee94dfa39dc00ff5027d61c74e6d94 | Kontetsu/pythonProject | /example27.py | 748 | 4.28125 | 4 | animals = ["Dog", "Cat", "Fish"]
lower_animal = []
fruits = ("apple", "pinnaple", "peach")
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
#for anima in animals:
# lower_animal.append(anima.lower())
print("List of animals ", animals)
for animal in animals:
fave_animal = input("Ent... | false |
1688c93855bda769c0e21a5cbfb463cfe3cc0299 | JimVargas5/LC101-Crypto | /caesar.py | 798 | 4.25 | 4 | #Jim Vargas caesar
import string
from helpers import rotate_character, alphabet_position
from sys import argv, exit
def encrypt(text, rot):
'''Encrypts a text based on a pseudo ord circle caesar style'''
NewString = ""
for character in text:
NewChar = rotate_character(character, rot)
NewStr... | true |
b211b888702bbb1ebed8b6ee2b21fec7329a7b59 | deyoung1028/Python | /to_do_list.py | 1,738 | 4.625 | 5 | #In this assignment you are going to create a TODO app. When the app starts it should present user with the following menu:
#Press 1 to add task
#Press 2 to delete task (HARD MODE)
#Press 3 to view all tasks
#Press q to quit
#The user should only be allowed to quit when they press 'q'.
#Add Task:
#Ask the user f... | true |
e41796d392658024498869143c8b8879a7916968 | deyoung1028/Python | /dictionary.py | 487 | 4.21875 | 4 | #Take inputs for firstname and lastname and then create a dictionary with your first and last name.
#Finally, print out the contents of the dictionary on the screen in the following format.
users=[]
while True:
first = input("Enter first name:")
last = input("Enter last name:")
user = {"first" ... | true |
74dee8921f4db66c458a0c53cd08cb54a2d1ba63 | KritikRawal/Lab_Exercise-all | /4.l.2.py | 322 | 4.21875 | 4 | """ Write a Python program to multiplies all the items in a list"""
total=1
list1 = [11, 5, 17, 18, 23]
# Iterate each element in list
# and add them in variable total
for ele in range(0, len(list1)):
total = total * list1[ele]
# printing total value
print("product of all elements in given list: ", tota... | true |
d71d9e8c02f405e55e493d1955451c12d50f7b9b | KritikRawal/Lab_Exercise-all | /3.11.py | 220 | 4.28125 | 4 | """ find the factorial of a number using functions"""
def factorial(n):
if n == 1:
return 1
else:
return n * factorial(n - 1)
num = int(input('enter the number'))
print(factorial)
| true |
53b8278af9a4a98b4de820d91054d80e9f1247f4 | KritikRawal/Lab_Exercise-all | /3.8.py | 393 | 4.125 | 4 | """takes a number as a parameter and check the number is prime or not"""
def is_prime(num):
for i in range(2, num):
if num % i == 0:
return False
return True
print('Start')
val = int(input('Enter the number to check prime:\n'))
ans = is_prime(val)
if ans:
print(val,... | true |
ae6ae8cfe7e655b1ffc9617eb8d87480a97e8f27 | KritikRawal/Lab_Exercise-all | /4.2.py | 635 | 4.4375 | 4 | """. Write a Python program to convert temperatures to and from celsius,
fahrenheit.
C = (5/9) * (F - 32)"""
print("Choose the conversion: ")
print(" [c] for celsius to fahrenheit")
print(" [f] for fahrenheit to celsius")
ans = input()
conversion = 0
cs = ""
if ans == "c":
ans = "Celsius"
elif an... | true |
b9e75d0b9d9605330c54818d1dd643cc764032cf | KritikRawal/Lab_Exercise-all | /2.5.py | 277 | 4.21875 | 4 | """For given integer x,
print ‘True’ if it is positive,
print ‘False’ if it is negative and
print ‘zero’ if it is 0"""
x = int(input("Enter a number: "))
if x > 0:
print('positive')
elif x<0:
print('negative')
else:
print('zero') | true |
d0c28518a33bf41c9945d97690e3891eeba277ad | AANICK007/STEPPING_IN_PYTHON_WORLD | /programme_8.py | 413 | 4.53125 | 5 | # This is a programme to study bitwise operators in python
x =5 & 6 ; # this is and operator between bit numbers of 5 and 6
print ( x ) ;
x = 5 | 6 ;
print ( x ) ; # this is or operator between bit numbers of 5 and 6
x = ~ 5 ;
print ( x ) ; # this is not operator
x = 5 ^ 6 ;
print ( x ) ; # this is xor ope... | false |
5a1e59a9c6fb569a22357aeabb61952d112f9e98 | marvjaramillo/ulima-intro210-clases | /s021-selectivas/selectiva.py | 713 | 4.28125 | 4 | '''
Implemente un programa que lea la calificacion de un alumno y su cantidad de
participaciones. Si la cantidad de participaciones es mayor que 10, entonces
recibe un punto de bonificacion. Su programa debe mostrar en pantalla la
nota final
'''
def main():
nota = int(input("Ingrese nota: "))
participaci... | false |
2a5f44807795975b2d7d392a2295811399606980 | marvjaramillo/ulima-intro210-clases | /s036-guia05/p06.1.py | 711 | 4.375 | 4 | '''
Estrategia:
1) Leemos el valor como cadena (con el punto decimal)
2) LLamamos a una funcion para quitar el punto decimal
3) aplicamos la funcion que maneja enteros para hallar la suma de digitos
'''
import p06
def convertir(numero):
res = ""
#Convertimos a cadena para procesarlo
numero = str(numero)
... | false |
31f9b34ad89fdaafb0f232c5783a35fc811a1d70 | marvjaramillo/ulima-intro210-clases | /s054-guia08/p08.py | 1,030 | 4.25 | 4 | '''
Formato de los datos (ambos son cadenas):
- clave: termino
- valor: definicion del termino
Ejemplo:
glosario = {"termino1": "El termino1 es <definicion>"}
'''
#Lee los valores del usuario y crea el diccionario
def leer_glosario():
res = {}
#Leemos la cantidad de terminos
n = int(input(... | false |
99e3a484814475a5ccc0627f5d875507a5213b0c | Mattias-/interview_bootcamp | /python/fizzbuzz.py | 520 | 4.15625 | 4 |
# Using any language you want (even pseudocode), write a program or subroutine
# that prints the numbers from 1 to 100, each number on a line, except for every
# third number write "fizz", for every fifth number write "buzz", and if a
# number is divisible by both 3 and 5 write "fizzbuzz".
def fb():
for i in xr... | true |
1aae789149cce977556e11683e898dc039bdb9ad | derek-baker/Random-CS-Stuff | /python/SetCover/Implementation.py | 1,542 | 4.1875 | 4 | # INSPIRED BY: http://www.martinbroadhurst.com/greedy-set-cover-in-python.html
# def test_that_subset_elements_contain_universe(universe, elements):
# if elements != universe:
# return False
# return True
def compute_set_cover(universe, subsets):
# Get distinct set of elements from all subsets
... | true |
e74add4e61a90087bb085b51a8734a718fd554f7 | sador23/cc_assignment | /helloworld.py | 602 | 4.28125 | 4 | '''The program asks for a string input, and welcomes the person, or welcomes the world if nothing was given.'''
def inputname():
'''Keeps asking until a string is inputted'''
while True:
try:
name=input("Please enter your name!")
int(name)
print("This is not a string... | true |
2abe2c2de6d54d9a44b3abb3fc03c88997840e61 | maria1226/Basics_Python | /aquarium.py | 801 | 4.53125 | 5 | # For his birthday, Lubomir received an aquarium in the shape of a parallelepiped. You have to calculate how much
# liters of water will collect the aquarium if it is known that a certain percentage of its capacity is occupied by sand,
# plants, heater and pump.
# Its dimensions - length, width and height in centimete... | true |
56a13bb22f6d53ef4e149941d2d4119cc8d4edd3 | lagzda/Exercises | /PythonEx/intersection.py | 450 | 4.125 | 4 | def intersection(arr1, arr2):
#This is so we always use the smallest array
if len(arr1) > len(arr2): arr1, arr2 = arr2, arr1
#Initialise the intersection holder
inter = []
for i in arr1:
#If it is an intersection and avoid duplicates
if i in arr2 and i not in inter:
... | true |
6f77c3a1e04eb47c490eb339cf39fc5c925e453c | rudiirawan26/Bank-Saya | /bank_saya.py | 1,114 | 4.15625 | 4 | while True:
if option == "x":
print("============================")
print("Selamat Datang di ATM saya")
print("============================")
print('')
option1 = print("1. Chek Uang saya")
option2 = print("2. Ambil Uang saya")
option3 = print("3. Tabung Uang s... | false |
2c9da507053689dee6cc34724324521983ea0c8c | miroslavgasparek/python_intro | /numpy_practice.py | 1,834 | 4.125 | 4 | # 21 February 2018 Miroslav Gasparek
# Practice with NumPy
import numpy as np
# Practice 1
# Generate array of 0 to 10
my_ar1 = np.arange(0,11,dtype='float')
print(my_ar1)
my_ar2 = np.linspace(0,10,11,dtype='float')
print(my_ar2)
# Practice 2
# Load in data
xa_high = np.loadtxt('data/xa_high_food.csv',comments='#')... | true |
877150ed0d4fb9185a633ee923daee0ba3d745e4 | nmessa/Raspberry-Pi | /Programming/SimplePython/name4.py | 550 | 4.125 | 4 | # iteration (looping) with selection (conditions)
again = True
while again:
name = raw_input("What is your name? ")
print "Hello", name
age = int(raw_input("How old are you? "))
newage = age + 1
print "Next year you will be ", newage
if age>=5 and age<19:
print "You are still in school... | true |
cd0c13a1013724e1ec7920a706ee52e2aa0e9a96 | Teslothorcha/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/0-add_integer.py | 411 | 4.15625 | 4 | #!/usr/bin/python3
"""
This function will add two values
casted values if necessary (int/float)
and return the addition
"""
def add_integer(a, b=98):
"""
check if args are ints to add'em'
"""
if not isinstance(a, (int, float)):
raise TypeError("a must be an integer")
if not isinstance(b, (... | true |
353bb70b7acbbedf2381635d1d554d117edc6b7f | valoto/python_trainning | /aula2/strings.py | 780 | 4.125 | 4 | var = "PYT''\"HON"
var = 'PYTH"ON'
# TODAS MAIUSCULAS
print(var.upper())
# TODAS MINUSCULAS
print(var.upper())
# SUBSTITUI T POR X
print(var.replace('T', 'X'))
# PRIMEIRA LETRA MAIUSCULA0
print(var.title())
# CONTA QUANTIDADE DE LETRAS T
print(var.count('T'))
# PROCURAR POSIÇÃO DA LETRA T
print(var.find('T'))
# ... | false |
5e6e2e5e3d29dc46c9e5a9e7bc49a5172fbbb3cb | wbsth/mooc-da | /part01-e07_areas_of_shapes/src/areas_of_shapes.py | 935 | 4.1875 | 4 | #!/usr/bin/env python3
import math
def main():
while True:
shape = input('Choose a shape (triangle, rectangle, circle): ')
if shape == '':
break
else:
if shape == 'rectangle':
r_width = int(input("Give width of the rectangle: "))
r_h... | true |
f613fa6f9dbf7713a764a6e45f29ef8d67a5f39c | abhishek0chauhan/rock-paper-scissors-game | /main.py | 1,431 | 4.25 | 4 | import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
-... | false |
a0516d0ca0791c8584b51cee2e354113f03a74f1 | LFBianchi/pythonWs | /Learning Python/Chap 4/p4e6.py | 839 | 4.125 | 4 | # -*- coding: utf-8 -*-
"""
Exercise 5 of the Part IV of the book "Learning Python"
Function "addDict" - Returns a union of dictionaries
Created on Mon Nov 9 11:06:47 2020
@author: lfbia
"""
def addList(list1, list2):
return list1 + list2
def addDict(aurelio, michaellis):
D = {}
for i in aurelio.keys():
... | false |
d3e64c5bfe6b5508c458a2bc76e40fa6ef0f4019 | nasrinsultana014/HackerRank-Python-Problems | /Solutions/Problem14.py | 536 | 4.21875 | 4 | def swap_case(s):
characters = list(s)
convertedCharacters = []
convertedStr = ""
for i in range(len(characters)):
if characters[i].isupper():
convertedCharacters.append(characters[i].lower())
elif characters[i].islower():
convertedCharacters.append(characters[i]... | true |
0f28ba6d84069ffabf1a733ca4f4980c28674290 | ngoc123321/nguyentuanngoc-c4e-gen30 | /session2/baiq.py | 480 | 4.15625 | 4 | weight = float(input('Your weight in kilos: ')) # <=== 79
height = float(input('Your height in meters: ')) # <=== 1.75
BMI = weight / height ** 2
BMI = round(BMI, 1)
if BMI < 16: result = 'Severely underweight.'
elif 16 < BMI <= 18.5: result = 'Underweight.'
elif 18.5 < BMI <= 25: result = 'Normal.'
elif 25 < BMI <= 3... | true |
7601d4e5c01fe1e0f377ae459465a4cb0a4f3edf | sam505/Median-of-3-integers | /Median.py | 1,423 | 4.34375 | 4 | # Obtains the median of three integers that the user inputs
def median():
Num_one = input ("Enter your first integer: ")
Num_two = input ("Enter your second integer: ")
Num_three = input("Enter the third integer: ")
if (int (Num_one) < int (Num_two) and int (Num_one) > int (Num_three)):
print ("... | false |
d63f3014189730c8afbe7f91add852ef729e22f0 | inwk6312fall2019/dss-Tarang97 | /Chapter12-Tuples/Ex12.2.py | 1,579 | 4.21875 | 4 | fin = open('words.txt')
# is_anagram() will take a single text from 'words.txt', sorts it and lower the cases and
# append the original word in the list which will be the default value of sorted_dict() values;
# but, the sorted_word will be in sorted_dict() dictionary along with its value.
def is_anagram(text):
... | true |
c65858019b12bc00cc9733a9fa2de5fd5dda8d14 | asadali08/asadali08 | /Dictionaries.py | 1,662 | 4.375 | 4 | # Chapter 9. Dictionaries
# Dictionary is like a set of items with any label without any organization
purse = dict()# Right now, purse is an empty variable of dictionary category
purse['money'] = 12
purse['candy'] = 3
purse['tissues'] = 75
print(purse)
print(purse['candy'])
purse['money'] = purse['money'] + 8... | true |
f8327a56682bd0b9e4057defb9b016fd0b56afdd | karagdon/pypy | /48.py | 671 | 4.1875 | 4 | # lexicon = allwoed owrds list
stuff = raw_input('> ')
words = stuff.split()
print "A TUPLE IS SIMPLY A LIST YOU CANT MODIFY"
# lexicon tuples
first_word = ('verb', 'go')
second_word = ('direction', 'north')
third_word = ('direction', 'west')
sentence = [first_word, second_word, third_word]
def convert_numbers(s):
... | true |
80a5137b9ab2d2ec77805ef71c2513d8fcdf81a0 | karagdon/pypy | /Python_codeAcademy/binary_rep.py | 1,384 | 4.625 | 5 | #bitwise represention
#Base 2:
print bin(1)
#base8
print hex(7)
#base 16
print oct(11)
#BITWISE OPERATORS#
# AND FUNCTION, A&B
# 0b1110
# 0b0101
# 0b0100
print "AND FUNCTION, A&B"
print "======================\n"
print "bin(0b1110 & 0b101)"
print "= ",bin(0b1110&0b101)
# THIS OR THAT, A|B
#The bitwise OR (|... | true |
729099b198e045ce3cfe0904f325b62ce3e3dc5e | karagdon/pypy | /diveintopython/707.py | 579 | 4.28125 | 4 | ### Regex Summary
# ^ matches
# $ matches the end of a string
# \b matches a word boundary
# \d matches any numeric digit
# \D matches any non-numeric character
# x? matches an optional x character (in other words, it matches an x zero or one times)
# x* matches x zero or more times
# x+ matches x one or more ti... | true |
bd00c3566cf764ca82bba1a4af1090581a84d50f | f1uk3r/Daily-Programmer | /Problem-3/dp3-caeser-cipher.py | 715 | 4.1875 | 4 | def translateMessage(do, message, key):
if do == "d":
key = -key
transMessage = ""
for symbol in message:
if symbol.isalpha():
num = ord(symbol)
num += key
if symbol.isupper():
if num > ord("Z"):
num -= 26
elif num < ord("A"):
num += 26
if symbol.islower():
if num > ord("z"):
... | true |
e2b0a7d7bc76ef3739eace98f62081e78df24b67 | f1uk3r/Daily-Programmer | /Problem-11/Easy/tell-day-from-date.py | 540 | 4.5 | 4 | # python 3
# tell-day-from-date.py #give arguments for date returns day of week
# The program should take three arguments. The first will be a day,
# the second will be month, and the third will be year. Then,
# your program should compute the day of the week that date will fall on.
import datetime
import calendar... | true |
c452668b786727a3438a06c22230e08c3eb01914 | Eunbae-kim/python | /basic9.py | 850 | 4.1875 | 4 | # 파이썬
# 튜플 (Tuple) : 리스트(list)와 비슷하지마, 다만 한번 설정되면 변경 불가
# 튜플은 변경 불과
tuple = (1, 2, 3)
print(tuple ," : tuple type ", type(tuple))
# 리스트는 하나의 원소로 취급가능하기 때문에 리스트를 튜플의 각 원소로 사용가능
list1 = [1,3,5]
list2 = [2,4,6]
tuple2 = (list1, list2)
print(tuple2) #2개의 리스트가 각각 원소로 들어감
print(tuple2[0][1])
#하지만, 튜플은 변경불가능 하기 떄문에 tuple[0]... | false |
d2417f9b2a06ca9447d554ecc34998fac1f1d59d | yossef21-meet/meet2019y1lab1 | /turtleLab1-Yossi.py | 1,457 | 4.5 | 4 | import turtle
# Everything that comes after the # is a
# comment.
# It is a note to the person reading the code.
# The computer ignores it.
# Write your code below here...
turtle.penup() #Pick up the pen so it doesn’t
#draw
turtle.goto(-200,-100) #Move the turtle to the
#position (-200, -100)
#on... | false |
8d888e53b71da82ae029c0ffc4563edc84b8283d | EdwardMoseley/HackerRank | /Python/INTRO Find The Second Largest Number.py | 661 | 4.15625 | 4 | #!/bin/python3
import sys
"""
https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list
Find the second largest number in a list
"""
#Pull the first integer-- we don't need it
junk = input()
def secondLargest(arg):
dat = []
for line in arg:
dat.append(line)
... | true |
bbe8b6100246aa2f58fca457929827a0897e9be5 | arickels11/Module4Topic3 | /topic_3_main/main_calc.py | 1,637 | 4.15625 | 4 | """CIS 189
Author: Alex Rickels
Module 4 Topic 3 Assignment"""
# You may apply one $5 or $10 cash off per order.
# The second is percent discount coupons for 10%, 15%, or 20% off.
# If you have cash-off coupons, those must be applied first, then apply the percent discount coupons on the pre-tax
# Then you add tax at... | true |
27006f8290968a5d89a8d0d25355538212718075 | Manny-Ventura/FFC-Beginner-Python-Projects | /madlibs.py | 1,733 | 4.1875 | 4 | # string concatenation (akka how to put strings together)
# # suppose we want to create a string that says "subscribe to ____ "
# youtuber = "Manny Ventura" # some string variable
# # a few ways...
# print("Subscribe to " + youtuber)
# print("Subscribe to {}".format(youtuber))
# print(f"subscribe to {youtuber}")
adj ... | true |
de25e31fa817bc6347566c021edc50f1868de959 | gohjunyi/RegEx | /google_ex.py | 1,167 | 4.125 | 4 | import re
string = 'an example word:cat!!'
match = re.search(r'word:\w\w\w', string)
# If-statement after search() tests if it succeeded
if match:
print('found', match.group()) # 'found word:cat')
else:
print('did not find')
# i+ = one or more i's, as many as possible.
match = re.search(r'pi+', 'piiig') # fo... | true |
491454a81d8ee0e33fa142d93260c72e23345631 | ammalik221/Python-Data-Structures | /Trees/Depth_first_traversal.py | 2,866 | 4.25 | 4 | """
Depth First Search implementation on a binary Tree in Python 3.0
Working -
recursion calls associated with printing the tree are in the following order -
- print(1, "")
|- traversal = "1"
|- print(2, "1")
| |- traversal = "12"
| |- print(4, "12")
| | ... | false |
f01d7fab6569e318399eee144b7310d39433d061 | ammalik221/Python-Data-Structures | /Collections/Queues_using_queue_module.py | 411 | 4.1875 | 4 | """
Queues Implementation in Python 3.0 using deque module.
For implementations from scratch, check out the other files in this repository.
"""
from collections import deque
# test cases
# make a deque
q = deque()
# add elements
q.append(20)
q.append(30)
q.append(40)
# output is - 10 20 30 40
print(q)
# remove el... | true |
73c2bcf27da231afe7d9af4425683c006799e7a9 | razzanamani/pythonCalculator | /calculator.py | 1,515 | 4.375 | 4 | #!usr/bin/python
#Interpreter: Python3
#Program to create a functioning calculator
def welcome():
print('Welcome to the Calculator.')
def again():
again_input = input('''
Do you want to calculate again?
Press Y for YES and N for NO
''')
# if user types Y, run the calculate() function
if again_input == 'Y':
c... | true |
5938614ce9d3181ed59c2e56e4df3adaa17ab91b | williamsyb/mycookbook | /algorithms/BAT-algorithms/Math/判断一个数是否为两个数的平方和.py | 735 | 4.1875 | 4 | """
题目:
判断一个数是否是两个数的平方和
示例:
Input: 5
Output: True
Explanation: 1 * 1 + 2 * 2 = 5
思路: 双指针
本题是要判断一个数是否等于两个数的平方和 <=等价=> 在自然数数组中,是否存在两个数的平方和是否等于一个数。
所以本题的思路与 “/数组/Two sum - 有序数组”基本一致。
"""
def judge_square_sum(c):
start = 0
end = int(c ** 0.5)
while start <= end:
temp = start... | false |
ee1e7bff3095782f4886eeefc0558543c091ddc6 | williamsyb/mycookbook | /thread_prac/different_way_kill_thread/de04.py | 1,153 | 4.59375 | 5 | # Python program killing
# a thread using multiprocessing
# module
"""
Though the interface of the two modules is similar, the two modules have very different implementations.
All the threads share global variables, whereas processes are completely separate from each other.
Hence, killing processes is much safer as co... | true |
353a3606af9aa9b5c5065edaa2e35d88f9e8ec5f | Imsurajkr/Cod001 | /challenge2.py | 662 | 4.1875 | 4 | #!/usr/bin/python3
import random
highestNumber = 10
answer = random.randint(1, highestNumber)
print("Enter the number betweeen 1 and {}".format(highestNumber))
guess = 0 #initialize to any number outside of the range
while guess != answer:
guess = int(input())
if guess > answer:
print("please Select Lo... | true |
6ca787eac5185c966f539079a8d2b890d9dc6447 | OldPanda/The-Analysis-of-Algorithms-Code | /Chapter_2/2.4.py | 897 | 4.15625 | 4 | """
Random Hashing:
Data structure: a key array X with entries x_i for 0 <= i <= N-1 and a corresponding record array R.
Initial conditions: the number of entries, k, is zero and each key location, x_i, contains the value empty, a special value that is not the value of any key.
Input: a query, q.
Output: a loca... | true |
2ca5b9fd677edf64a50c6687803c91b721bee140 | basakmugdha/Python-Workout | /1. Numeric Types/Excercise 1 (Number Guessing Game)/Ex1c_word_GG.py | 848 | 4.375 | 4 | #Excercise 1 beyond 3: Word Guessing Game
from random_word import RandomWords
def guessing_game():
'''returns a random integer between 1 and 100'''
r = RandomWords()
return r.get_random_word()
if __name__ == '__main__':
print('Hmmmm.... let me pick a word')
word = guessing_game()
gu... | true |
942d67e9bbad4dc5a890de12ef0317b6af4f571f | danebista/Python | /suzan/python3.py | 2,143 | 4.1875 | 4 | #!/usr/bin/env python
# coding: utf-8
# Print formatting
# In[1]:
print ("hurry makes a bad curry")
# In[3]:
print("{1} makes a bad {0}".format("curry","hurry"))
# In[7]:
print("The {e} rotates {a} a {s}".format(e="Earth",a="around",s="Sun"))
# In[8]:
result=9/5
print(result)
# In[9]:
result=100/3
p... | false |
c26c3fa52692454bd47cfab92253715ed461f4f2 | DiegoRmsR/holbertonschool-higher_level_programming | /0x03-python-data_structures/3-print_reversed_list_integer.py | 223 | 4.28125 | 4 | #!/usr/bin/python3
def print_reversed_list_integer(my_list=[]):
if not my_list:
pass
else:
for list_reverse in reversed(my_list):
str = "{:d}"
print(str.format(list_reverse))
| true |
0254ed479c00b3f5140df3546c06612dca233557 | Andriy63/- | /lesson 4-4.py | 686 | 4.15625 | 4 | '''
Представлен список чисел. Определить элементы списка, не имеющие повторений.
Сформировать итоговый массив чисел, соответствующих требованию.
Элементы вывести в порядке их следования в исходном списке.
Для выполнения задания обязательно использовать генератор.'''
from itertools import permutations
from itertools im... | false |
440fb62ef8a3a4144b3082ca38c478fc78357c6b | mohitciet/CorePython | /LearnPython/PythonBasics/Dictionary.py | 2,077 | 4.3125 | 4 | """DICTIONARY"""
dictionary={'key1' : 'india','key2' : 'USA'}
#Access Elements from Dictionary
print(dictionary['key1'])
print("===================")
#Adding Elements from Dictionary
dictionary={'key1' : 'india','key2' : 'USA'}
dictionary['key3']='Pakistan'
print(dictionary)
print("===================")
#Modify E... | false |
8ba63fdd070ef490570285c17d8669b8d8ffb5b0 | lukelu389/programming-class | /python_demo_programs/2020/prime_number.py | 273 | 4.375 | 4 | # write a python program to check if a number is prime or not
number = int(input('enter a number:'))
n = 1
counter = 0
while n <= number:
if number % n == 0:
counter += 1
n += 1
if counter > 2:
print('not prime number')
else:
print('prime number') | true |
3404c6cc7af2350bf12592921226a9f4a87da618 | lukelu389/programming-class | /python_demo_programs/2021/example_20210319.py | 1,529 | 4.1875 | 4 | # s = 'abcdefgh'
# print(s[0:2])
# print(s[:2]) # implicitly start at 0
# print(s[3:]) # implicitly end at the end
#
# # slice from index 4 to the end
# print(s[4:])
# to achieve the conditional, need to use if keyword
# a = 6
# b = 5
# if b > a:
# print('inside if statement')
# print('b is bigger than a')
# ... | true |
1d4bac21899ddd993ad41cdf80a0c2ad350b8104 | lukelu389/programming-class | /python_demo_programs/2021/example_20210815.py | 1,644 | 4.1875 | 4 | # class Person:
# def __init__(self, name):
# self.name = name
# def method1(self):
# return 'hello'
# p1 = Person('jerry')
# print(p1.name)
# Person.method1()
# class = variables + methods
# variable: static variable vs instance variable
# method: static method vs instance method
# class is... | true |
6d7f89a6f38bcb3765ff3e6f5a954bfed6b27f3c | lukelu389/programming-class | /python_demo_programs/2020/factorial.py | 231 | 4.15625 | 4 |
# use a loop to calculate n*(n-1)*(n-2)*(n-3)*...2*1,
# and return the result
def factorial(n):
result = 1
while n > 0:
result = result * n
n -= 1
return result
print(factorial(5))
print(factorial(3)) | true |
ea53f0ecbeee4c3c1a35d5a2d2569b8a70cf4ea2 | lukelu389/programming-class | /python_demo_programs/2020/example_20201018.py | 1,389 | 4.125 | 4 | # homework
# write a python function takes two lists as input, check if one list contains another list
# [1, 2, 3] [1, 2] -> true
# [1] [1, 2, 3] -> true
# [1, 2] [1, 3] -> false
def contain(list1, list2):
# loop through list1 check if each element in list1 is also in list2
list2_contains_list1 = True
for... | true |
9e63c534debc5b8bb2adcfd7493ce18e8acd1bf7 | lukelu389/programming-class | /python_demo_programs/2020/example_20201025.py | 1,532 | 4.25 | 4 | # # write a python function that takes a list and a int, check if list contains any two values that diff of the two values
# # is the input int
# # [1, 2, 3] 1 -> true
# # [1, 2, 3] 4 -> false
#
# def find_diff(list, target):
# for i in list:
# for j in list:
# if j - i == target:
# ... | true |
12720f4c953a952aaebf3737a248c5e61c947773 | lukelu389/programming-class | /python_demo_programs/2020/nested_conditionals.py | 1,370 | 4.15625 | 4 | # a = 3
# b = 20
# c = 90
#
# # method 1
# if a > b:
# # compare a and c
# if a > c:
# print('a is the biggest')
# else:
# print('c is the biggest')
# else:
# # a is smaller than b, compare b and c
# if b > c:
# print('b is the biggest')
# else:
# print('c is the ... | false |
a0b7bbca5f8d4cbd1638a54e0e7c5d78302139f8 | vijaykanth1729/Python-Programs-Interview-Purpose | /list_remove_duplicates.py | 776 | 4.3125 | 4 | '''
Write a program (function!) that takes a list and returns a new
list that contains all the elements of the first list minus all the duplicates.
Extras:
Write two different functions to do this - one using a loop and constructing a
list, and another using sets.
Go back and do Exercise 5 using sets, and write the so... | true |
bb3c2b979426ab217b7cf3bbdadb12d4c8aa2e05 | ThtGuyBro/Python-sample | /Dict.py | 307 | 4.125 | 4 | words = {"favorite dessert": "apple pie","never eat": "scallop","always have" : "parachute","don't have" :"accident","do this" : "fare","bug" : "flea"}
print(words['bug'])
words['parachute']= 'water'
words['oar']= 'girrafe'
del words['never eat']
for key, value in words.items():
print(key)
| true |
a5c89600f1343b8059680634e0ca7caed0bcebe9 | felipemlrt/begginer-python-exercises | /06_FuntionsI/Exercise.py | 1,923 | 4.3125 | 4 | #!/usr/bin/env python3
#1)
#Create a function that receives a operator ( + - * or / ), values X and Y, calculates the result and prints it.
#Crie uma função que receva um oprador ( + - * or / ), valores X e Y, e calcule o resultando apresentando este ao usuário.
#2)
#Create a function that tell if a number is odd or... | false |
8320e270cc0ef7f8767336dfcb0dcf7ffe538e01 | tocodeil/webinar-live-demos | /20200326-clojure/patterns/04_recursion.py | 658 | 4.15625 | 4 | """
Iteration (looping) in functional languages is usually accomplished
via recursion.
Recursive functions invoke themselves,
letting an operation be repeated until it reaches the base case.
"""
import os.path
# Iterative code
def find_available_filename_iter(base):
i = 0
while os.path.exists(f"{base}_{i}"):... | true |
fc0d283efec47c1f9a4b19eeeff42ba58db258c7 | EdmondTongyou/Rock-Paper-Scissors | /main.py | 2,479 | 4.3125 | 4 | # -*- coding: utf-8 -*-
"""
Edmond Tongyou
CPSC 223P-01
Tues March 9 14:47:33 2021
tongyouedmond@fullerton.edu
"""
# Importing random for randint()
import random
computerScore = 0
ties = 0
userScore = 0
computerChoice = ""
userChoice = ""
# Loops until the exit condition (Q) is met otherwise keeps asking for
# on... | true |
ccbbeda5e9f600eb58bec8894a1f2118eed329bb | chinaxiaobin/python_study | /练习Python/python-基础-01/08-打印一个名片.py | 789 | 4.34375 | 4 | # 先做啥再做啥,可以用注释搭框架
# 1.使用input获取必要信息
name = input("请输入你的名字:")
phone = input("请输入你的电话:")
wx = input("请输入你的微信:")
# 2.使用print来打印一个名片
print("=====================")
print("名字是:%s"%name)
print("电话是:%s"%phone)
print("微信好是:%s"%wx)
print("=====================")
"""
python2中input是将输入的内容当作代码了,而python3是把输入的内容当作一个字符串
name = input... | false |
89cb76c58b6814fb2a074d5be82b32d6775f9793 | mileuc/100-days-of-python | /Day 22: Pong/ball.py | 1,223 | 4.3125 | 4 | # step 3: create and move the ball
from turtle import Turtle
class Ball(Turtle):
def __init__(self):
super().__init__()
self.shape("circle")
self.color("white")
self.penup()
self.goto(x=0, y=0)
self.x_move = 10
self.y_move = 10
self.move... | false |
ca9040e2f67a9ef6e1e15e9b5fa73c8df6295877 | mileuc/100-days-of-python | /Day 10: Calculator/main.py | 1,544 | 4.3125 | 4 | from art import logo
from replit import clear
def calculate(operation, first_num, second_num):
"""Takes two input numbers, a chosen mathematical operation, and performs the operation on the two numbers and returns the output."""
if operation == '+':
output = first_num + second_num
return output
elif oper... | true |
7e6caaea40c2ca56d00cf95dce934fb338a55ca1 | dlingerfelt/DSC-510-Fall2019 | /FRAKSO_MOHAMMED_DSC51/loops-week5.py | 2,983 | 4.53125 | 5 | '''
File: Loops.py
Name: Mohammed A. Frakso
Date: 12/01/2020
Course: DSC_510 - Introduction to Programming
Desc: This program will contain a variety of loops and functions:
The program will add, subtract, multiply, divide two numbers and provide the average of multiple numbers input by the user.
Define a functio... | true |
88333bcf49ae0f01c6f7d4cca37c1dae5ddb64a2 | dlingerfelt/DSC-510-Fall2019 | /JALADI_DSC510/final/WeatherDisplay.py | 1,791 | 4.34375 | 4 | # File : WeatherDisplay.py
# Name : Pradeep Jaladi
# Date : 02/22/2020
# Course : DSC-510 - Introduction to Programming
# Desc : Weather Display class displays the weather details to output.
class WeatherDisplay:
def __init__(self, desc, city, country, temp, feels_like, min_temp, max_temp, lat, lon, wind)... | true |
433d5b3ed946f1f84893a9eed708b49e902af6c0 | dlingerfelt/DSC-510-Fall2019 | /NERALLA_DSC510/NERALLA_DSC510_WEEK11.py | 2,521 | 4.15625 | 4 | '''
File: NERALLA_DSC510_WEEK10.py
Name: Ravindra Neralla
Course:DSC510-T303
Date:02/23/2020
Description: This program is to create a simple cash register program.
The program will have one class called CashRegister.
The program will have an instance method called addItem which takes one parameter for price. The method... | true |
78eee39d5b2e07f640f8be3968acdec0b7c8e13f | dlingerfelt/DSC-510-Fall2019 | /Safari_Edris_DSC510/Week4/Safari_DSC510_Cable_Cost.py | 1,951 | 4.4375 | 4 | # File : Safari_DSC510_Cable_Cost.py
# Name:Edris Safari
# Date:9/18/2019
# Course: DSC510 - Introduction To Programming
# Desc: Get name of company and length in feet of fiber cable. compute cost at $.87 per foot. display result in recipt format.
# Usage: Provide input when prompted.
def welcome_screen():
"""Pr... | true |
d2587b87036af1d39d478e5db8c6d03b19c6da83 | dlingerfelt/DSC-510-Fall2019 | /SMILINSKAS_DSC510/Temperatures.py | 1,290 | 4.21875 | 4 | # File: Temperatures.py
# Name: Vilius Smilinskas
# Date: 1/18/2020
# Course: DSC510: Introduction to Programming
# Desc: Program will collect multiple temperature inputs, find the max and min values and present the total
# number of values in the list
# Usage: Input information when prompted, input go to retriev... | true |
7faffa27e0944548717be676c521fcb8ed1653a8 | dlingerfelt/DSC-510-Fall2019 | /FRAKSO_MOHAMMED_DSC51/week6-lists.py | 1,257 | 4.46875 | 4 | '''
File: lists.py
Name: Mohammed A. Frakso
Date: 19/01/2020
Course: DSC_510 - Introduction to Programming
Desc: This program will work with lists:
The program will contains a list of temperatures, it will populate the list based upon user input.
The program will determine the number of temperatures in the prog... | true |
42d37509986bc3233ab711cef2496ab4fa17602a | dlingerfelt/DSC-510-Fall2019 | /Ndingwan_DSC510/week4.py | 2,921 | 4.28125 | 4 | # File: week4.py
# Name: Awah Ndingwan
# Date: 09/17/2019
# Desc: Program calculates total cost by multiplying length of feet by cost per feet
# Usage: This program receives input from the user and calculates total cost by multiplying the number of feet
# by the cost per feet. Finally the program returns a summary of t... | true |
8c70251443a384255c610a8a96d4977c5da28947 | dlingerfelt/DSC-510-Fall2019 | /JALADI_DSC510/TEMPERATURE_OPERATIONS.py | 1,536 | 4.53125 | 5 | # File : MATH_OPERATIONS.py
# Name : Pradeep Jaladi
# Date : 01/11/2020
# Course : DSC-510 - Introduction to Programming
# Assignment :
# Program :
# Create an empty list called temperatures.
# Allow the user to input a series of temperatures along with a sentinel value which will stop the user input.
#... | true |
f5428333663e7da9d39bdff3e25f6a34c07ebd08 | dlingerfelt/DSC-510-Fall2019 | /Steen_DSC510/Assignment 3.1 - Jonathan Steen.py | 1,186 | 4.34375 | 4 | # File: Assignment 3.1 - Jonathan Steen.py
# Name: Jonathan Steen
# Date: 12/9/2019
# Course: DSC510 - Introduction to Programing
# Desc: Program calculates cost of fiber optic installation.
# Usage: The program gets company name,
# number of feet of fiber optic cable, calculate
# installation cost, bu... | true |
af093e824555df86dc56d2b1b581270fd1671d1c | dlingerfelt/DSC-510-Fall2019 | /Stone_DSC510/Assignment2_1/Assignment2_1.py | 751 | 4.21875 | 4 | # 2.1 Programming Assignment Calculate Cost of Cabling
# Name: Zachary Stone
# File: Assignment 2.1.py
# Date: 09/08/2019
# Course: DSC510-Introduction to Programming
# Greeting
print('Welcome to the ABC Cabling Company')
# Get Company Name
companyName = input('What is the name of you company?\n')
# Get Num of feet
fe... | true |
edc28c6d0a7bd72d9a875d7716f8957874455fd0 | dlingerfelt/DSC-510-Fall2019 | /Steen_DSC510/Assignment 4.1 - Jonathan Steen.py | 1,364 | 4.15625 | 4 | # File: Assignment 4.1 - Jonathan Steen.py
# Name: Jonathan Steen
# Date: 12/17/2019
# Course: DSC510 - Introduction to Programing
# Desc: Program calculates cost of fiber optic installation.
# Usage: The program gets company name,
# number of feet of fiber optic cable, calculate
# installation ... | true |
f70f72b4d449726be0bb53878d32116d999756f5 | dlingerfelt/DSC-510-Fall2019 | /Steen_DSC510/Assignment 2.1 - Jonathan Steen.py | 1,105 | 4.28125 | 4 | # File: Assignment 2.1 - Jonathan Steen.py
# Name: Jonathan Steen
# Date: 12/2/2019
# Course: DSC510 - Introduction to Programing
# Desc: Program calculates cost of fiber optic installation.
# Usage: The program gets company name,
# number of feet of fiber optic cable, calculate
# installation c... | true |
2155f32ff8af7f310124f09964e576fe5b464398 | dlingerfelt/DSC-510-Fall2019 | /DSC510- Week 5 Nguyen.py | 2,139 | 4.3125 | 4 | '''
File: DSC510-Week 5 Nguyen.py
Name: Chau Nguyen
Date: 1/12/2020
Course: DSC_510 Intro to Programming
Desc: This program helps implement variety of loops and functions.
The program will add, subtract, multiply, divide two numbers and provide the average of multiple numbers input by the user.
'''
def performCa... | true |
7bd2456b0c77f97e11f16454bfa9890c28d93f35 | mun5424/ProgrammingInterviewQuestions | /MergeTwoSortedLinkedLists.py | 1,468 | 4.15625 | 4 | # given two sorted linked lists, merge them into a new sorted linkedlist
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
# set iterators
dummy = ListNode(0)
... | true |
ee04bfff8656142d1abd103c4994d257af6e64c9 | JaydeepKachare/Python-Classwork | /Session11/05.py | 838 | 4.21875 | 4 | # Inheritance in Python
class Base1 :
def __init__(self):
self.i = 10
self.j = 20
print("Inside Base Constructor")
def fun(self) :
print("Inside Base1 fun")
class Base2 :
def __init__(self):
self.x = 30
self.y = 40
print("Inside Base Constru... | false |
199da8145e506f6e08900a15431258286e8216dc | JaydeepKachare/Python-Classwork | /Recursion/7_7 PrimeFactors.py | 718 | 4.1875 | 4 | # find prime factors of given number
# using while loop
def primeFactors(num) :
i = 2
while (i <= num ) :
if num % i == 0 :
print(i,end=" ")
num = int(num/i)
i = 1
i+=1
print()
# using recursion
def primeFactorsR(num,i) :
if i >= num :
... | false |
65fc4f293f441ff863eb83dc60cdf7e7935b5121 | JaydeepKachare/Python-Classwork | /Session6/practice/01 isPrime.py | 432 | 4.15625 | 4 | # check whether given number is prime or not
def isPrime (num) :
for i in range(2,num) :
if num % i == 0 :
return False
return True
# main function
def main() :
num = int(input("Enter any number : "))
if isPrime(num) == True :
print("{} is prime number ".format(n... | false |
a0033278eee5f2ce160875caa8bd5d270989d3ea | JaydeepKachare/Python-Classwork | /Recursion/7_9 nth term of fibo.py | 278 | 4.1875 | 4 | # calculate nth term of fibonacci series
def fibo(num) :
if num == 0 or num == 1 :
return 1
return fibo(num-1) + fibo(num-2)
def main() :
n = int(input("Enter term to find : "))
print(fibo(n))
if __name__ == "__main__" :
main() | false |
b9d16e4a06e0485a6e4e5c26bf4673d063c1eb7e | JaydeepKachare/Python-Classwork | /Session3/Arithematic6.py | 429 | 4.125 | 4 | # addition of two number
def addition(num1, num2):
ans = num1+num2
return ans
num1 = int(input("Enter num1 : "))
num2 = int(input("Enter num2 : "))
ans = addition(num1,num2)
print("Addition : ",ans)
num1 = int(input("Enter num1 : "))
num2 = int(input("Enter num2 : "))
ans = ad... | true |
e200d189bee58ad51f7ad8721ef54aaf2d5d63e0 | JaydeepKachare/Python-Classwork | /Recursion/540.py | 366 | 4.375 | 4 | # check whether if string is palindrome or not
def isPalindrome(str) :
if len(str)==0 or len(str)==1 :
return True
if str[0] == str[-1] :
return isPalindrome(str[1:-1])
else :
return False
str = input("Enter string : " )
if isPalindrome(str) == True :
print("Pa... | false |
8bf5ca07b63351502911b50328ca0a6eac240187 | AndrewGEvans95/foobar | /breedinglikerabbits.py | 675 | 4.125 | 4 | def BinSearch(a, b, target, parity):
#Standard binary search w/ recursion
if b <= a:
return None
n = a + ((b - a)/2)
n += parity != n & 1
S = Scan(n)
if S == target:
return n
if S > target:
b = n - 1
else:
a = n + 1
return BinSearch(a, b, target, parit... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.