blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
319e95ee89071a5402aaa30aac4f77e2f34a9168 | mkuentzler/AlgorithmsCourse | /LinkedList.py | 771 | 4.1875 | 4 | class Node:
"""
Implements a linked list. Cargo is the first entry of the list,
nextelem is a linked list.
"""
def __init__(self, cargo=None, nextelem=None):
self.car = cargo
self.nxt = nextelem
def __str__(self):
return str(self.car)
def display(self):
if s... | true |
43a5d6ca3431c87af401db8ceda677bca0a1a52e | AjsonZ/E01a-Control-Structues | /main10.py | 2,365 | 4.21875 | 4 | #!/usr/bin/env python3
import sys, utils, random # import the modules we will need
utils.check_version((3,7)) # make sure we are running at least Python 3.7
utils.clear() # clear the screen
print('Greetings!') # print out 'Greeting!'
colors = ['red','orange',... | true |
9ebc5c4273361512bd5828dee90938820b41f097 | Andrew-2609/pythonbasico_solyd | /pythonbasico/aula11-tratamento-de-erros.py | 872 | 4.21875 | 4 | def is_a_number(number):
try:
int(number)
return True
except ValueError:
print("Only numbers are allowed. Please, try again!")
return False
print("#" * 15, "Beginning", "#" * 15)
result = 0
divisor = input("\nPlease, type an integer divisor: ")
while not is_a_number(divisor):... | true |
bdc98a6f01d7d4a9663fd075ace95def2f25d35c | BipronathSaha99/GameDevelopment | /CurrencyConverter/currencyConverter.py | 608 | 4.34375 | 4 | # >>-----------CurrencyConverter-------------------<<
#To open currency list from text file .
with open("currency.txt") as file:
lines=file.readlines()
#to collect all information create a dictionary
currencyDic={}
for line in lines:
bipro=line.split("\t")
currencyDic[bipro[0]]=bipro[1]
... | true |
3e219c794ce22d0d97aaa6b45717717b337d0ca5 | 2019-fall-csc-226/a02-loopy-turtles-loopy-languages-mualcinp-a02 | /a02_mualcinp.py | 1,447 | 4.28125 | 4 | # Author: Phun Mualcin
# Username: mualcinp
# Assignment: A02: Exploring Turtles in Python
# Purpose: Draw something that brings a smile to your face using uses two turtles and one loop
import turtle
wn = turtle.Screen()
wn.bgcolor('black')
shape = turtle.Turtle()
turtle.color('blue')
turtle.pensize(20)
turtle... | false |
44b1b2af47b75a71a5fd37f284730a0cd5b29690 | LENAYL/pysublime | /MyStack_225.py | 2,482 | 4.1875 | 4 | # 用队列实现
#
# from queue import Queue
# class MyStack(object):
#
# def __init__(self):
# """
# Initialize your data structure here.
# """
# self.q1 = Queue()
# self.q2 = Queue()
#
# def push(self, x):
# """
# Push element x onto stack.
# :type x: int... | false |
163d79e904d442ee971f10f698b79a7ee7bf85fa | micahjonas/python-2048-ai | /game.py | 2,514 | 4.3125 | 4 | # -*- coding: UTF-8 -*-
import random
def merge_right(b):
"""
Merge the board right
Args: b (list) two dimensional board to merge
Returns: list
>>> merge_right(test)
[[0, 0, 2, 8], [0, 2, 4, 8], [0, 0, 0, 4], [0, 0, 4, 4]]
"""
def reverse(x):
return list(reversed(x))
t = m... | true |
f6422f0594441635eac2fd372428aa160ca3bbb3 | HamPUG/meetings | /2017/2017-05-08/ldo-generators-coroutines-asyncio/yield_expression | 1,190 | 4.53125 | 5 | #!/usr/bin/python3
#+
# Example of using “yield” in an expression.
#-
def generator1() :
# failed attempt to produce a generator that yields an output
# sequence one step behind its input.
print("enter generator")
value = "start"
while value != "stop" :
prev_value = value
print("abo... | true |
3af6228c9d8dcc735c52ae7d8375f007145ffe98 | MukundhBhushan/micro-workshop | /tectpy/if.py | 235 | 4.15625 | 4 | num=int(input("Enter the number to be tested: "))
if num > 0:
print(num, "is a positive number.")
print("This is always printed.")
num = -1
if num > 0:
print(num, "is a positive number.")
print("This is also always printed.")
| true |
f9f0e8f9212598847750967c8898eefed9e441ed | ryotokuro/hackerrank | /interviews/arrays/arrayLeft.py | 900 | 4.375 | 4 | #PROBLEM
# A left rotation operation on an array shifts each of the array's elements unit to the left.
# For example, if left rotations are performed on array , then the array would become .
# Given:
# - an array a of n integers
# - and a number, d
# perform d left rotations on the array.
# Return the updated array ... | true |
9af20e6ee68952b2f0b61685ce406d13c770cc00 | ryotokuro/hackerrank | /w36/acidNaming.py | 828 | 4.1875 | 4 | '''
https://www.hackerrank.com/contests/w36/challenges/acid-naming
Conditions for naming an acid:
- If the given input starts with hydro and ends with ic then it is a non-metal acid.
- If the input only ends with ic then it is a polyatomic acid.
- If it does not have either case, then output not an aci... | true |
3a9f486d54fe15bcea60d916047e4c478ca20f85 | fillipe-felix/ExerciciosPython | /Lista02/Ex004.py | 355 | 4.3125 | 4 | """
Faça um Programa que verifique se uma letra digitada é vogal ou consoante.
"""
letra = str(input("Digite uma letra para verificar se é vogal ou consoante: ")).upper()
if(letra == "A" or letra == "E" or letra == "I" or letra == "O" or letra == "U"):
print(f"A letra {letra} é uma vogal")
else:
print(f"A l... | false |
62ad0cdecbb43d25fbae24b2514210a2cd9e56dc | amarjeet-kaloty/Data-Structures-in-Python | /linkedList.py | 1,320 | 4.125 | 4 | class node:
def __init__(self, data=None):
self.data=data
self.next=None
class linkedList:
def __init__(self):
self.head = node()
#Insert new node in the Linked-List
def append(self, data):
new_node = node(data)
cur_node = self.head
while (c... | true |
da4e43d0cadfc4137a4f92da26d32203a9c07e54 | GilbertoSavisky/Python | /estruturas-de-dados.py | 580 | 4.15625 | 4 | pessoa_1= {'nome':'Gilberto Savisky', 'idade': 41, 'peso': 75}
pessoa_2 = {'nome':'João Arruda', 'idade': 28, 'peso': 65}
pessoa_3 = {'nome':'Reinaldo Cavalcante', 'idade': 53, 'peso': 87} # dicionario (dict)
lista_pessoas = [pessoa_1, pessoa_2, pessoa_3] # lista (list)
minha_tupla = ('Amadeu', 'Lourenço') # Tupla (t... | false |
e84ebb478878b0eba4403ddca10df99dda752a82 | martinloesethjensen/python-unit-test | /star_sign.py | 960 | 4.125 | 4 | def star_sign(month: int, day: int):
if type(month) == int and month <= 12 and type(day) == int and day <= 32: # todo: test case on .isnumeric()
if month == 1:
if day <= 20:
return "Capricorn"
else:
return "Aquarius"
elif month == 5:
... | true |
2e99e7a24fa53ad663d8d62ee3b2b59d06cf9f11 | Izzle/learning-and-practice | /Misc/decorators_ex.py | 2,915 | 4.53125 | 5 | """
*************************************************
This function shows why we use decorators.
Decorators simple wrap a fucntion, modifying its behavior.
*************************************************
"""
def my_decorator(some_function):
def wrapper():
num = 10
if num == 10:
p... | true |
9fd1d80b44dcea4693cb39f43ddc45a25e654a26 | Izzle/learning-and-practice | /theHardWay/ex6.py | 1,727 | 4.5625 | 5 | # Example 6
# Declares variable for the '2 types of people' joke
types_of_people = 10
# Saves a Format string which inputs the variable to make a joke about binary
x = f"There are {types_of_people} types of people."
# Declaring variables to show how to insert variables into strings.
binary = "binary"
do_not = "don't"... | true |
5fd329e733441ca67be649f8f604538c6697f6a3 | Izzle/learning-and-practice | /python_programming_net/sendEx05.py | 668 | 4.21875 | 4 | # Exercise 5 and 6
# While and For loops in python 3
# Basic while loop
condition = 1
while condition < 10:
print(condition)
condition += 1
# Basic For loop
exampleList = [1, 5, 6, 5, 8, 8, 6, 7, 5, 309, 23, 1]
for eachNumber in exampleList: # Iterates each item in the list and puts it into the variable ... | true |
a7f7957f2f66e22f7288a077fe773fb16bab4f02 | 6188506/LearnPythonHardWay | /ex29.py | 966 | 4.125 | 4 | people = 20
cats = 30
dogs = 15
if people < cats:
print "Too many cats! The world is doomed!"
if people > cats:
pass
print "Not many cats! The world 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 great... | false |
66dad62f348eb42e0d7196bdc87f4cfa0ef84520 | para-de-codar-alek/Respostas-Uri | /1037.py | 978 | 4.28125 | 4 | #Você deve fazer um programa que leia um valor qualquer
# e apresente uma mensagem dizendo em qual dos seguintes intervalos
# ([0,25], (25,50], (50,75], (75,100]) este valor se encontra.
# Obviamente se o valor não estiver em nenhum destes intervalos,
# deverá ser impressa a mensagem “Fora de intervalo”.
#O sí... | false |
7c3d1f965818058958bb143b72a6f03b2824a8d6 | dimatkach11/Torno_Subito | /base_python/the_dictionary.py | 2,936 | 4.625 | 5 | #
# ! A dictionary is a set of objects which we can extract from a key
# * The keys in question are the one we used in the phase of the assignment
print('\n\t\t\t\t\t\tDICTIONARY\n')
keynote = dict()
keynote['tizio'] = '333-3333333'
keynote['caio'] = '444-4444444'
print(keynote)
# * copy() :
keynote_copy = keynote.c... | true |
8c802650065dec7d5744576ebb7cb08744cc8087 | dimatkach11/Torno_Subito | /base_python/the_strings.py | 2,889 | 4.4375 | 4 | h = 'hello'
print(h[2])
print(h[1:3]) # stampa da 1 a 2, l'etremo destro 3 non viene compreso, il sinistro invece si
lower = 'dima'
upper = 'TKACH'
print(lower.capitalize() + upper.lower())
print(lower.islower())
print(upper.islower())
# * join
l1 = 'egg'
l2 = '123'
print(l1.join(l2)) # egg sarà inserito in mezzo a... | false |
cc0f2bc409cc9d72c792ae38c2b84b353d6bcb3d | ChakshuVerma/Python-SEM-3 | /Question 6/code.py | 1,333 | 4.46875 | 4 |
"""
Q6.Consider a tuplet1 ={1,2,5,7,9,2,4,6,8,10}.
Write a program to perform following operations :
a) Print another tuple whose values are even numbers in the given tuple .
b) Concatenate a tuplet2 = {11,13,15) with t1 .
c) Return maximum and minimum value from this tuple .
"""
ch=0
# Given
len=10
t1=(1,2,5,7,9,... | true |
82af59cee878318ba259e6ca73dabbc102b4e65c | zn-zyl/Blog | /python基础高阶编程/py_01day/py04_01day_06.py | 617 | 4.125 | 4 | """
============================
Author:柠檬班-木森
Time:2020/5/6 21:32
E-mail:3247119728@qq.com
Company:湖南零檬信息技术有限公司
============================
"""
"""
数值:int float
序列:list str tuple
散列:set dict
可迭代对象:
"""
from collections import namedtuple
tu = (11, 22, 33)
# stu = ('木森', 18, 'python自动化')
... | false |
8c67095e3342ea13f00743a814edd8bd25fc1b2c | AshishGoyal27/Tally-marks-using-python | /tally_marks_using_python.py | 301 | 4.25 | 4 | #Retrieve number form end-user
number = int(input("Input a positive number:"))
#how many blocks of 5 tallies: ||||- to include
quotient = number // 5
#Find out how many tallies are remaining
remainder = number % 5
tallyMarks = "||||- " * quotient + "|" * remainder
print(tallyMarks)
| true |
9858589924b5b2c4999c2cd3298a6c1697a64008 | kashyap92/python-training | /operatoroverloading2.py | 331 | 4.1875 | 4 | #!/usr/bin/python
class date():
def __init__(self):
self.dd=7;self.mm=10;self.yy=2016
def __add__(self,date1):
self.dd=self.dd+date1
return (self)
def printvalues(self):
print self.dd,self.mm,self.yy
today=date()
today+=5
today.pri... | false |
c9e58aa8af5424e5b96811dd63afa86492c47c48 | lucienne1986/Python-Projects | /pythonRevision.py | 1,692 | 4.40625 | 4 | animals = ['cat', 'dog', 'monkey']
for a in animals:
print(a)
#IF you want access to the index of each element within the body of a loop use enumerate
#enums are constants
#%-style formatting: %s and %r call the Enum class’s __str__() and __repr__() respectively;
#other codes (such as %i or %h for IntEnum) treat t... | true |
94ab43281970119ab3ffe8e723539c0866f5f12c | amsun10/LeetCodeOJ | /Algorithm/Python/palindrome-number-9.py | 1,068 | 4.125 | 4 | # https://leetcode.com/problems/palindrome-number/
# Determine whether an integer is a palindrome. An
# integer is a palindrome when it reads the same backward as forward.
#
# Example 1:
#
# Input: 121
# Output: true
# Example 2:
#
# Input: -121
# Output: false
# Explanation: From left to right, it reads -121. From ri... | true |
cc7abe19bda1f613b2d070d4a2c5ec4eb722107d | oojo12/algorithms | /sort/insertion_sort.py | 612 | 4.34375 | 4 | def insertion_sort(item, least = False):
"""Implementation of insertion sort"""
"""
Parameters:
item - is assumed to be a list item
least - if true returned order is least to greatest. Else it is greatest to least
"""
__author__ = "Femi"
__version__ = "1"
__status__ = "Done"
... | true |
238780e18aa4d804e2c1a07b4a7008719e4d1356 | FaezehAHassani/python_exercises | /syntax_function4.py | 781 | 4.25 | 4 | # Functions for returning something
# defining a few functions:
def add(a, b):
print(f"adding {a} + {b}")
return a + b
def subtract(a, b):
print(f"subtracting {a} - {b}")
return a - b
def multiply(a, b):
print(f"multiplying {a} * {b}")
return a * b
def divide(a, b):
print(f"dividing {a} ... | true |
9a0494e31845de5b3e38b2e1aaf8cae045185634 | vishnusak/DojoAssignments | /12-MAY-2016_Assignment/python/search.py | 1,219 | 4.28125 | 4 | # String.search
# string.search(val) - search string for val (another string). Return index position of first match ( -1 if not found).
# ---- Bonus: Implement regular expression support
def search(string, val):
val = str(val) #convert the to-be-searched string into a string type
if (len(val) == 0): #if the... | true |
ea4f181fd795b69f92fb4385f7fc9ecf00abee65 | vishnusak/DojoAssignments | /3-MAY-2016_Assignment/python/reversearray.py | 956 | 4.59375 | 5 | # Reverse array
# Given a numerical array, reverse the order of the values. The reversed array should have the same length, with existing elements moved to other indices so that the order of elements is reversed. Don't use a second array - move the values around within the array that you are given.
# steps:
# 1. find... | true |
0296ddc0d579edc89013f4034af9b0b0b6aec661 | vishnusak/DojoAssignments | /2-MAY-2016_Assignment/python/swap.py | 759 | 4.53125 | 5 | # Swap Array Pairs
# Swap positions of successive pairs of values of given array. If length is odd, do not change final element. For [1,2,3,4] , return [2,1,4,3] . For [false,true,42] , return [true,false,42] .
# steps:
# 1 - traverse array in for loop
# 2 - increment counter by 2 each time instead of one
# 3 - fo... | true |
f9d1fb27c3ced358419cad969dba71e8f1d56a75 | helderthh/leetcode | /medium/implement-trie-prefix-tree.py | 1,836 | 4.15625 | 4 | # 208. Implement Trie (Prefix Tree)
# https://leetcode.com/problems/implement-trie-prefix-tree/
class Trie:
def __init__(self, val=""):
"""
Initialize your data structure here.
"""
self.val = val
self.children = []
def insert(self, word: str) -> None:
... | true |
9043e7b4e966797c20d293d674767f63b9d1af56 | oliveiralenon/Learning_python | /Mundo 2/Desafios/071.py | 836 | 4.25 | 4 | """
Crie um programa que simule o funcionamento de um caixa eletrônico.
No início, pergunte ao usuário qual será o valor a ser sacado (número
inteiro) e o programa vai informar quantas cédulas de cada valor
serão entregues.
OBS: Considere que o caixa possui cédulas de RS50, R$20, R$10 e R$1.
"""
print('-=' * 20)
print... | false |
80964e8df8f8b7036736dbff1309f6478dedd805 | oliveiralenon/Learning_python | /Mundo 2/Desafios/036.py | 777 | 4.21875 | 4 | """
Escreva um programa para aprovar o empréstimo bancário
para a compra de uma casa. O programa vai perguntar o
valor da casa, o salário do comprador e em quantos anos
ele vai pagar.
Calcule o valor da prestação mensal, sabendo que ela não
pode exceder 30% do salário ou então o empréstimo será
negado.
"""
valor_casa =... | false |
047fb88ee80ddc5830ed77a99078812c58555e6a | oliveiralenon/Learning_python | /Mundo 1/Desafios/022.py | 568 | 4.28125 | 4 | """
Crie um progrma que leia o nome completo de uma pessoa e mostre:
- O nome com todas as letras maiúsculas
- O nome com todas minúsculos
- Quantas letras ao todo (sem considerar espaços)
= Quantas letras tem o primeiro nome.
"""
nome = str(input('Digite seu nome completo: '))
separado = nome.split()
print(f'Seu nome ... | false |
95d7346e60cb3ce345416da12bbe95cfb2bdf2ab | oliveiralenon/Learning_python | /Mundo 1/Desafios/028.py | 700 | 4.25 | 4 | """
Escreva um programa que faça o computador "pensar" em um
número inteiro entre 0 e 5 e faça para o usuário tentar
descobrir qual foi o número escolhido pelo computador.
O programa deverá escrever na tela se o usuário venceu
ou perdeu.
"""
from random import randint
from time import sleep
print('-=-' * 20)
print('Vo... | false |
af4caae1454e7fdb4b40d5192c45e7ca16783ff2 | juancadh/mycode | /collatz_conjecture.py | 1,118 | 4.59375 | 5 | """
======== COLLATZ CONJECTURE ========
The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n.
Then each term is obtained from the previous term as follows: if the previous term is even, the next term is one half the previous term.
If the... | true |
4d958cd5c394fd27e09703eaf02a5193c88523fa | tanadonparosin/Project-Psit | /time-count.py | 546 | 4.125 | 4 |
# import the time module
import time
# define the countdown func.
def countdown(t):
big = 0
t += 1
while t != big:
hours = big//3600
left = big%3600
mins, secs = divmod(left, 60)
timer = '{:02d}:{:02d}:{:02d}'.format(hours, mins, secs)
print(timer... | true |
e87191dbacfef51036b30f2fd84997367ddd5d89 | WakouTTD/learn-python | /attended/lesson11_codestype.py | 447 | 4.3125 | 4 | # pythonは1行が80文字を超えると折り返せというルール
# 長い文字列連結でバックスラッシュ
s = 'aaaaaaaaaaaaaaa' + \
'bbbbbbbbbbbbbbb'
print(s)
x = 1 + 1 + 1 + 1 + 1 + 1 + 1 + \
1 + 1 + 1 + 1 + 1 + 1
print(x)
print('------------------')
# もしくはパレンティス
s = ('aaaaaaaaaaaaaaa' +
'bbbbbbbbbbbbbbb')
print(s)
x = (1 + 1 + 1 + 1 + 1 + 1 + 1 +
... | false |
2286bac14fa3bbfdee27a85a0f4430c31ec8a07b | mf4lsb/Algorithms | /hackerrank/python/Validating Roman Numerals.py | 345 | 4.15625 | 4 | # https://www.hackerrank.com/challenges/validate-a-roman-number/
def validateRomanNumeral(roman_numeral):
import re
return True if re.search(r"^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$", roman_numeral) else False
if __name__ == "__main__":
roman_numeral = input()
print(validateRom... | false |
56973aedd81e2bd1bf651ba51237d634046f3598 | amber1710/Converter | /Temperature convertor/tester.py | 1,435 | 4.3125 | 4 | from tkinter import *
#function to create a window
root = Tk()
root.geometry('550x300')
root.title("Conversions")
root.configure(background="turquoise")
#functions to create a label
label = Label(root, text="Press")
label.grid(row=0, column=0, columnspan=3)
label2 = Label(root, text="°Celsius")
label2.grid(row=0, col... | false |
c02aa901d795f6ed60a09cb3aee1ee1c3e61ced3 | AnilKOC/some-scripts | /prime-num-is-it.py | 406 | 4.125 | 4 | import math
def main():
number = int(input("Enter your number :"))
isprime = True
for x in range(2, int(math.sqrt(number) + 1)):
if number % x == 0:
isprime = False
break
if isprime:
print("Your number is an prime number : "+str(number))
else:
print("S... | true |
2e4554a4e5d00dedfdf276f950446273d40f45c0 | LyndonGingerich/hunt-mouse | /input.py | 1,224 | 4.40625 | 4 | """Helper methods for getting user input"""
def get_bool_input(message):
"""Gets boolean input from the terminal"""
values = {'y': True, 'yes': True, 'n': False, 'no': False, '': False}
return get_dict_input(message, values)
def get_dict_input(message, values):
"""Selects value from a dictionary by ... | true |
c7a1ed5b4d9eff957d6cebf924aeeb9ab8e0da53 | codingXllama/Tkinter-with-Python | /FirstApp/app.py | 829 | 4.4375 | 4 | import tkinter as tk
# Creating the window
window = tk.Tk()
# Creating a window title
window.title("First Application")
# Creating the window size
window.geometry("400x400")
# creating the LABEL
title = tk.Label(text="Welcome to my First Tkinter APP!",
font=("Times New Roman", 20))
# Placing the ti... | true |
3813ccf85d5136d2e028717370697c331b9c98d7 | geocarvalho/python-ds | /python-base/escola_v2_com_sets.py | 1,180 | 4.1875 | 4 | #!/usr/bin/env python3
"""Exibe relatório de crianças por atividade.
Imprimir a lista de crianças agrupadas por sala
que frequentas cada uma das atividades.
"""
__version__ = "0.1.1"
########################################################
# ATENçÃO: MODIFIQUE ESSE CÓDIGO! #
# Tente utilizar dic... | false |
1d6b889ec8c0d1dbff4a7e7fcb063e0f3649969a | LeleCastanheira/cursoemvideo-python | /Exercicios/ex014.py | 235 | 4.28125 | 4 | # Conversor de temperatura: escreva um programa que converta uma temperatura digitada em ºC para ºF
c = float(input('Informe a temperatura em °C: '))
f = 1.8 * c + 32
print('A temperatura de {}°C corresponde a {}°F!'.format(c, f)) | false |
337904dc2450ebaf368a58984385087c15fe2395 | ss4328/project_euler | /problem4.py | 855 | 4.25 | 4 | #The purpose of this program is to find largest 3-digit palindrome product
print("Palindrome problem starting...")
n1 = 100
n2 = 100
ans = 0;
def reverse(num):
rev = 0
while num > 0:
rev = (10 * rev) + num % 10
num //= 10
return rev
def isPalindroms(input):
if(input == reverse(input... | true |
a58f314ff98de418dcf262957b2c336b2d5b12ea | ahsanfirdaus1/Ahsan-Personal-Project | /SimCal1.py | 2,324 | 4.15625 | 4 | print("Welcome To Ahsan Simple Calculator")
print("==================================")
print("Before The Program Starts, May I Know What's Your Name?")
UserName = input("Name: ")
i = 1
while i == 1:
print("Hello", UserName, "! Please Choose What Operator Do U Want")
print("1. + \n2. - \n3. x \... | false |
7692e3274550d7ef4dad4e0c3fb65d608d28f7d3 | Krishnaarunangsu/ArtificialIntelligence | /src/datascience/data_exercises/python_data_assignment_8.py | 1,206 | 4.28125 | 4 | # Difference of two columns in Pandas dataframe
# Difference of two columns in pandas dataframe in Python is carried out by using following methods :
# Method #1 : Using ” -” operator.
import pandas as pd
# Create a DataFrame
df1 = {'Name': ['George', 'Andrea', 'micheal',
'maggie', 'Ravi', 'Xien', 'Ja... | true |
c4988daadeb56b064ca9558f959a00ec031da04f | Krishnaarunangsu/ArtificialIntelligence | /src/datascience/data_exercises/python_dictionary_1.py | 660 | 4.28125 | 4 | # Creating an empty dictionary
dictionary_1 = dict()
dictionary_2 = {}
print(f'Dictionary-1:{dictionary_1} Type:{type(dictionary_1)}')
print(f'Dictionary-2:{dictionary_2} Type:{type(dictionary_2)}')
# Creating a Dictionary with Integer Keys
dictionary_3 = {1: 'God', 2: 'is', 3: 'Great'}
print(dictionary_3)
# Creating... | false |
fcc9c9b601411e05ff0d28f5a23f8f4502a3b139 | Krishnaarunangsu/ArtificialIntelligence | /src/datascience/data_exercises/python_list_comprehension_assignment_1.py | 2,033 | 4.59375 | 5 | # Python List Comprehension and Slicing
# List comprehension is an elegant way to define and create list in python. We can create lists just like mathematical statements and in one line only. The syntax of list comprehension is easier to grasp.
#
# A list comprehension generally consist of these parts :
# Output exp... | true |
14226708a9f5473ac80b76c4afe7bc47da5b403b | Krishnaarunangsu/ArtificialIntelligence | /src/datascience/data_exercises/python_data_assignment_2.py | 1,796 | 4.65625 | 5 | # Syntax:
# DataFrame.sort_values(by, axis=0, ascending=True, inplace=False, kind=’quicksort’, na_position=’last’)
# Every parameter has some default values execept the ‘by’ parameter.
# Parameters:
# by: Single/List of column names to sort Data Frame by.
# axis: 0 or ‘index’ for rows and 1 or ‘columns’ for Column.
# a... | true |
7292e151d67f39b26915ecbb13b9f6389674e2b0 | tracyvierra/vigilant-pancake | /TCPM-LPFS/text-2-speech/text_2_speech_live.py | 1,175 | 4.1875 | 4 | # Author: Tracy Vierra
# Date Created: 3/11/2022
# Date Modified: 3/11/2022
# Description: Text to speech example using user input to speech and saved as a file.
# Usage:
from turtle import right
from gtts import gTTS
import os
import tkinter as tk
from tkinter import filedialog as fd
from tkinter import *
# text ... | true |
768c71d6e2ee67bdba5e3de87ba309be9913270a | tracyvierra/vigilant-pancake | /TCPM-LPFS/examples/multiple_inheritance_example.py | 1,324 | 4.46875 | 4 | # Author: Tracy Vierra
# Date Created: 3/1/2022
# Date Modified: 3/1/2022
# Description: Multiple inheritance example
# Usage:
# class Student: # base class
# def __init__(self, name, age):
# self.name = name
# self.age = age
# def get_data(self):
# self.name = input("En... | false |
e0fab44a525cc912f7f8d43c618af3fc3f9ed711 | abdulwagab/Demopygit | /Operators1.py | 531 | 4.21875 | 4 |
'''Relational Operators Example in Python'''
def operator(x, y, z): # Functions name and its arguments
a = 1 # Assign variables in Function
b = 2
c = 0
x = a or c and b # Compare variables in Logical operators but not print
y = a and c or b # Compare variables in Logical operators but n... | true |
93d669e04066f345afe68017ab73c30d9145e53d | Vanderscycle/lighthouse-data-notes | /prep_work/Lighthouse lab prep mod katas/.ipynb_checkpoints/ch9-linear_algebra-checkpoint.py | 1,504 | 4.15625 | 4 | import numpy as np
x = np.array([1, 2, 3, 4])
print(x)
# Matrix A
A = np.array([[1,2],[3,4],[5,6]])
print(type(A))
# in which the result is a tuple of (columns, rows)|(3x,2y) of the matrix
print(A.shape)
print(x.shape)
print(len(x)) # returns the length of the array (#in the list)
# transpose an a mat... | true |
dee0620a9f930628a7ea44f4d73779e76686b4c2 | melphick/pybasics | /week6/w6e2.py | 342 | 4.28125 | 4 | #!/usr/bin/python
"""
Converts a list to a dictionary where the index of the list is used as the
key to the new dictionary (the function will return the new dictionary).
"""
def list_to_dict(a_list):
a_dict = {}
for i in a_list:
print i
a_dict[i] = a_list[i]
return a_dict
a = range(10)
... | true |
cbd0d974b4b636760e98b1a4da159129e025be14 | patidarjp87/ROCK-PAPER-SCISSOR-GAME | /ROCK.py | 1,438 | 4.1875 | 4 | import random
print("WELCOME TO ROCK PAPER SCISSOR GAME\n")
lst = ["Rock", "Paper", "Scissor"]
computer_score = 0
player_score = 0
game = 0
chance = 6
while game < chance:
choice = random.choice(lst)
turn = input("choose(rock, paper or scissor) : ").lower()
game +=1
if turn == "rock" and choice == "Scis... | true |
650074bf605a56ddb94a4a6ff9ab260cadf72467 | Souravdg/Python.Session_4.Assignment-4.1 | /Filter Long Words.py | 600 | 4.4375 | 4 | #!/usr/bin/env python
# coding: utf-8
# In[14]:
##############################################
# A function filter_long_words() that takes a list of words and an integer n and returns
# the list of words that are longer than n
def filter_long_words(lst,length):
newlst = []
for x in range(len(lst)):
i... | true |
4235257b90ca960999d780a44b1f7af7607b8fc8 | cyberchaud/automateBoring | /vid04/vid04.py | 1,183 | 4.1875 | 4 | # pythontutor.com/visualize.html
# Indentation in Python indicates a block of code
# Blocks start where the indentation begins and the block stops where the indentation stops
# if block statements are conditions/expressions
# if the condition evaluates to true; then Python executes the indented code
name = 'Bob'
if ... | true |
8189b5b2488e0f5f91a999c449089c618a576196 | cyberchaud/automateBoring | /vid22/vid22.py | 1,572 | 4.28125 | 4 | #! /usr/bin/python3
def isPhoneNumber(text):
if len(text) != 12:
return False
for i in range(0,3):
if not text[i].isdecimal():
return False
if text[3]!= '-':
return False
for i in range(4, 7):
if not text[i].isdecimal():
return False
if te... | true |
f407e16b8c2485680862c746d272b752b0d77eb5 | cyberchaud/automateBoring | /vid01/vid01.py | 601 | 4.28125 | 4 | # Python always evaluates down to a single value.
# Integers are whole number
# Any digits with a decimal is a floating point
# Expresssions are made from Values and Operators
print("Adding")
print(2+2)
print("Substraction")
print(5-3)
print("Multiplication")
print(3*7)
print("Division")
print(21/7)
print("PEMDAS")
... | true |
3b06c59a64a82f7fbaa7eeba84c04c2dc020568c | krausce/Integrify | /WEEK_1/Question_4.py | 1,954 | 4.125 | 4 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 01:24:18 2019
@author: chris
"""
'''
Question 4 asked us to write a function which looks through a list of int's
and returns '1' if a triplet exists and 0 if not.
My approach to this was to first sort the list using the builtin pyth... | true |
fe22ab33e33de67fa988d00f00d58eeb0bb8cb9d | neelima-j/MITOpenCourseware6.0001 | /ps1c.py | 1,967 | 4.3125 | 4 | '''
To simplify things, assume:
1. Your semiannual raise is .07 (7%)
2. Your investments have an annual return of 0.04 (4%)
3. The down payment is 0.25 (25%) of the cost of the house
4. The cost of the house that you are saving for is $1M.
You are now going to try to find the best rate of savings to achieve a down... | true |
361b4561b6a87cba7a2b35a603e86f04274e94bc | skgbanga/AOC | /2020/23/solution.py | 1,899 | 4.40625 | 4 | # The crab picks up the three cups that are immediately clockwise of the current cup. They are removed from the circle; cup spacing is adjusted as necessary to maintain the circle.
# The crab selects a destination cup: the cup with a label equal to the current cup's label minus one. If this would select one of the cups... | true |
d53d079e9e7be0e1d72e317cd090f82d7520861c | ann-ko/Python | /Lesson2_Task3.py | 1,386 | 4.21875 | 4 | while True:
month = int(input("Введите номер месяца в виде целого числа от 1 до 12: "))
if month in range(1, 13):
break
else:
print("Номер введен некорректно - повторите ввод")
# наименования времен года закодируем, чтобы в случае переименования изменяли в одном месте а не во всем ко... | false |
891c4f8c7b6e238686e43e4e637f988f4c5652b5 | RavensbourneWebMedia/Ravensbourne | /mymodule.py | 1,210 | 4.625 | 5 | ## mymodule: a module containing functions to print a message, convert temperatures and find the 3rd letter of a word ##
# INSTRUCTIONS
# Write code for the three functions below:
# This function should use 'raw_input' to ask for the user's name, and then print a friendly message including
# the user's name to the co... | true |
c47d32391b8c18705ab43c0129135a3ac36f1a3b | myanir/Campus.il_python | /self.py/dateconvert.py | 213 | 4.15625 | 4 | import calendar
user_input = input("Enter a date: ")
# 01/01/2000
year = int(user_input[-4:])
month = int(user_input[3:5])
day = int(user_input[:2])
print(calendar.day_name[calendar.weekday(year, month, day)]) | true |
221a8faf61fc8d5e507718cd06c76d905ffa22d2 | jeffreybrowning/algorithm_projects | /dynamic/minimum_steps.py | 1,583 | 4.34375 | 4 | def get_min_steps (num):
"""
For any positive integer num, returns the amount of steps necessary to reduce
the number to 1 given the following possible steps:
1) Subtract 1
2) Divide by 2
3) Divide by 3
>>>get_min_steps(15)
4
"""
if num <= 0 or type(num) != int: return None
min_steps_list = [... | true |
2692e538d72e8ac46ba2d2cb6db4256b2445e7b4 | henryHTH/Algo-Challenge | /Largest_prime_factor.py | 840 | 4.28125 | 4 | '''
Given a number N, the task is to find the largest prime factor of that number.
Input:
The first line of input contains an integer T, denoting the number of test cases. Then T test cases follow. Each test case contains an integer N.
Output:
For each test case, in a new line, print the largest prime factor o... | true |
8fe335582eab0cb9b8ca4ccf62193d04744df241 | FirzenYogesh/DynamicProgramming | /Python/CuttingRod.py | 908 | 4.15625 | 4 | """
http://www.geeksforgeeks.org/dynamic-programming-set-13-cutting-a-rod/
"""
# find the maximum price that can be obtained with the given price set with Space : O(n*x)
def cutting_rod(price, n):
t = [[0 for i in range(n + 1)] for i in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, n + 1):... | false |
eb30ff67f5f1ec9aadbf959d030da48723c85044 | FirzenYogesh/DynamicProgramming | /Python/LongestCommonSubsequence.py | 1,897 | 4.15625 | 4 | """
http://www.geeksforgeeks.org/longest-common-subsequence/
"""
# get the count of longest commom subsequence
def get_longest_common_subsequence(a, b):
r = len(a) + 1
c = len(b) + 1
# create table to store the longest common sub-sequence value
t = [[0 for i in range(c)] for i in range(r)]
# trave... | false |
0b5348cb514686eae1e95606a94c64043db7e51b | suhaylx/for-loops | /main.py | 535 | 4.34375 | 4 | for item in {1,2,3,4,6}:
for values in {'a', 'b','c'}:
print(item, values)
user = {
'name' : 'Suhaylx',
'age' : 18,
'can_swim' : False
}
for dictionary_items in user.values():
print(dictionary_items)
for dict_items in user.items():
print(dict_items)
for keys, item_s in user.items():
print(keys,item_s)
#... | true |
6c5dcf3f5ad4d00dca274e5fde09e3a378aac73f | ivyfangqian/python36-learning | /day1/input_output1.py | 2,218 | 4.34375 | 4 | # 我们的第一个程序
print('Hello World!')
# python2.x默认字符集为ASCII,打印中文需要设置coding为utf-8
# python3.x默认字符集为UTF-8
import sys
print(sys.getdefaultencoding())
print('你好!')
# 'print 可以同时打印多个字符串,两个字符串之间以逗号隔开
print('小明,', '你好!')
# python单行注释为#,
# 多行注释也推荐使用#
# print 'Hello World!'
# print 'Hello World!'
# print 'Hello World!'
# 多行注释... | false |
35bf351112ee5abeb120a3989d17e70c095ea189 | tsunny92/LinuxAcademyScripts | /ex1.py | 301 | 4.21875 | 4 | #!/usr/bin/env python3.6
msg = input("Enter the message to echo : ")
count = int(input("Enter the number of times to display message ").strip())
def displaymsg(msg , count):
if count > 0:
for i in range(count):
print(msg)
else:
print(msg)
displaymsg(msg , count)
| true |
da643f117987410670878690fdfea9807efca07a | yiorgosk/python | /polynomials.py | 1,498 | 4.34375 | 4 | import numpy.polynomial.polynomial as poly
import numpy as np
'''The user can enter 2 polynomial functions and perform the basic math praxis of addition, subtraction, multiplication and division.
Also the user is able to discover the roots of the two function and perform for instance an addiction praxis with a polynomi... | true |
ee742e94e08e5898e5369699c4d0d64e74556283 | oJacker/_python | /numpy_code/04/urn.py | 1,474 | 4.125 | 4 | '''
超几何分布(hypergeometric distribution)是一种离散概率分布,它描述的是一个罐子里有
两种物件,无放回地从中抽取指定数量的物件后,抽出指定种类物件的数量。 NumPy random模
块中的hypergeometric函数可以模拟这种分布
设想有这样一个游戏秀节目,每当参赛者回答对一个问题,他们可以从一个罐子里摸出3个
球并放回。罐子里有一个“倒霉球”,一旦这个球被摸出,参赛者会被扣去6分。而如果他们摸出
的3个球全部来自其余的25个普通球,那么可以得到1分。因此,如果一共有100道问题被正确回
答,得分情况会是怎样的呢?为了解决这个问题,请完成如下步骤
'''
import numpy as np... | false |
b496fb679a87ad1087198a2a09b5073397ee531e | Seongkyun-Yu/TIL | /algorithm-study/baekjoon/Fibonacci.py | 222 | 4.125 | 4 | wantCount = int(input())
def fibonacci(count, num1, num2):
if wantCount == count:
return num1
sum = num1 + num2
num1 = num2
num2 = sum
return fibonacci(count+1, num1, num2)
print(fibonacci(0, 0, 1))
| false |
04b818d3a8e91e3ec412d008dd23bae7ddafdedb | wenyaowu/leetcode | /algorithm/wildcardMatching/wildcardMatching.py | 1,190 | 4.1875 | 4 | # Wildcard Matching
"""
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
isMatch("aa","a") → false
isMat... | true |
bf3194d31daa0fde740f70f19ef4b502c1d82708 | wenyaowu/leetcode | /algorithm/spiralMatrix/spiralMatrix.py | 948 | 4.1875 | 4 | # Spiral Matrix
"""
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,
Given the following matrix:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
You should return [1,2,3,6,9,8,7,4,5].
"""
class Solution:
# @param {integer[][]} matrix
# @return ... | true |
bc8cab306a5c13eb063336a46464b3f29bc03e26 | wenyaowu/leetcode | /algorithm/maximumSubArray/maximumSubarray.py | 525 | 4.15625 | 4 | # Maximum Subarray
"""
Find the contiguous subarray within an array
(containing at least one number) which has the largest sum.
For example, given the array [−2,1,−3,4,−1,2,1,−5,4],
the contiguous subarray [4,−1,2,1] has the largest sum = 6.
"""
class Solution:
# @param {integer[]} nums
# @return {integer}
... | true |
3bfe490ced270299d618ae3bce36dc5bf93bed6b | gonzaloquiroga/neptunescripts | /dnacalc3.py | 1,583 | 4.25 | 4 | #! /usr/bin/env python
# Ponemos env python para que lo encuentre en cualquier ordenador,
# sea donde sea que este instalado.
#DNASeq = raw_input ("Enter a DNA sequence: ") #Prompts you to write stuff
DNASeq = "ATCACGAGCTTTATTCGGGC"
DNASeq = DNASeq.upper() #Takes DNASeq and creates a new string with an uppercase ve... | false |
e02a06155c71117dd210e57c5cf0e0d3c4ff9987 | mzimecki/MyPythonRepo | /binary_tree_walk.py | 1,615 | 4.25 | 4 | class Node:
rightNode = None
leftNode = None
name = None
def __init__(self, l, r, n):
self.rightNode = r
self.leftNode = l
self.name = n
# a
# / \
# b e
# /\
# c d
#
# Reversed:
# a
# / \
# e b
#... | false |
6c1af79866f6e74500b78fbc1bae00e005ed66dc | ghydric/05-Python-Programming | /Class_Practice_Exercises/Lists/List_Functions_Review/append_list.py | 673 | 4.53125 | 5 | ## Append to list
# This function demonstrates how the append method
# can be usesd to add items to a list
def main():
# initialize empty list
name_list = []
# create a variable to control our loop
again = 'y'
# add some names to the list
while again == 'y':
# get a name from the user... | true |
b2c495513f454f4c992e7c6b89f0a8cb79b7ea69 | ghydric/05-Python-Programming | /Class_Practice_Exercises/Advanced_Functions/map_func.py | 593 | 4.4375 | 4 | # map() function
# calls the specified function and applies it to each item of an iterable
def square(x):
return x*x
numbers = [1, 2, 3, 4, 5]
sqrList = map(square, numbers)
# print(next(sqrList))
# print(next(sqrList))
# print(next(sqrList))
# print(next(sqrList))
# print(next(sqrList))
# print(next(sqrList))
... | true |
643dc0c7f87421eac8ee5e124dd038f9f1c6a57f | ghydric/05-Python-Programming | /Class_Practice_Exercises/Classes/Inheritance/car_truck_suv_demo.py | 1,269 | 4.25 | 4 | # This program creates a Car, Truck, and SUV object
import vehicles
def main():
# create Car object
car = vehicles.Car('Bugatti', 'Veyron', 0, 3000000, 2)
# create a Truck object
truck = vehicles.Truck('Dodge', 'Power Wagon', 0, 57000, '4WD')
# create a SUV object
suv = vehicles.SUV('Jeep', ... | false |
dbbfec55fae84308c068d8b2db6f5502c6ef29a3 | ghydric/05-Python-Programming | /Class_Practice_Exercises/Advanced_Functions/iter.py | 485 | 4.34375 | 4 | # Python iterator
#old way:
myList = [1,2,3,4]
for item in myList:
print(item)
# what is actually happening using iterators
def traverse(iterable):
it = iter(iterable)
while True:
try:
item = next(it)
print(item)
except StopIteration:
break
L1 = [1,2,3]... | true |
8450a626f5b9179e35e75c4a6296c036913eb583 | ghydric/05-Python-Programming | /Class_Practice_Exercises/Classes/Classes_Exercises_2.py | 2,739 | 4.75 | 5 | """
2. Car Class
Write a class named Car that has the following data attributes:
• __year_model (for the car’s year model)
• __make (for the make of the car)
• __speed (for the car’s current speed)
The Car class should have an __init__ method that accept the car’s year model and make... | true |
679154f4340225e10a6dce151354fd1a1588df40 | bhavyajain190/Guess | /un.py | 553 | 4.125 | 4 | import random
print('Hey what is your name?')
name = input()
print('Welcome ' + name + ' I am thinking of a number between 1 and 10')
Num = random.randint(1,10)
for guessesTaken in range(1,3):
print('Take a guess')
guess = int(input())
if guess < Num:
print('Your guess is a lttle low')
el... | true |
2018b85801fb06a3001e38c32a02978c57aaf2a8 | Jhon-G/lesson1 | /types.py | 608 | 4.28125 | 4 | '''
Практика
'''
#Float
a = 2
b = 0.5
print(a + b)
#string
name = 'Иван'
print(f'Привет, {name}!')
#Приктика числа
v = int(input('Введите число от 1 до 10: ')) #Ввод целого числа
print(v + 10)
#Строки
name = input('Введите имя: ')
name = name.capitalize() #Делаем первую букву большой
print(f'Привет, {name}! Как дела?'... | false |
75df037a3564e30b1c2ed8b11598ea52bfdf2fc7 | 01FE16BME072/TensorflowBasics | /Tensor_handling3.py | 1,279 | 4.40625 | 4 | '''
TensorFlow is designed to handle tensors of all sizes and operators that can be used to
manipulate them. In this example, in order to see array manipulations, we are going to
work with a digital image. As you probably know, a color digital image that is a MxNx3
size matrix (a three order tensor), whose components ... | true |
8d1d69b2606b0b5fc2e06b907271525a27ef7d6e | maniac-tech/Web-scraping-using-php-and-RSS-feeds | /testFiles/dictonaries.py | 290 | 4.40625 | 4 | dict = {
"key1":"value1",
"key2":"value2",
"key3":"value3",
"key4":"value4"
}
#iterating over keys:
# for x in dict.iterkeys():
# print (x)
#iteraing over values:
# for x in dict.itervalues():
# print(x)
#iterating over values using keys:
for x in dict.iterkeys():
print(dict[x]) | false |
176313e02cb527f58beefa6a979118618da5446e | BohanHsu/developer | /python/io/ioString.py | 1,776 | 4.78125 | 5 | #in this file we learn string in python
s = 'Hello, world.'
#what str() deal with this string
print(str(s))
#what repr() deal with this string
print(repr(s))
#repr() make a object to a string for the interpreter
print(str(1/7))
print(repr(1/7))
#deal with some transforming characters
hello = 'hello, world\n'
helloS... | true |
e1be98d672f2925301e0c273a5c00a69c3d30213 | BohanHsu/developer | /nlp/assign1/hw1-files/my_regexs.py | 655 | 4.1875 | 4 | import re
import sys
# the first argument is a regular expression
# from the second argument are file path
pattern = sys.argv[1]
files = sys.argv[2:]
# reg_find : regular_expression, list_of_file_path -> list of words
# return a list of words which match the regular expression
# this method will concatenate all the l... | true |
4739f2dcad276d9967f2f0d36479e217db737356 | himIoT19/python3_assignments | /assignment_1/Q4.py | 328 | 4.4375 | 4 | # reverse string
def reverse(a_str: str) -> str:
"""
Function used for reversing the string
:param a_str: String
:return: String
"""
string_1 = a_str[::-1]
return string_1
# String to work on
s = "I love python"
print("Old string : {}".format(s))
print(f"New string after reversal: {revers... | true |
014c4247f563ba43e78dd5cc4d3f4f0e19cd41ed | seefs/Source_Insight | /node/Pythons/py_test/test_while.py | 371 | 4.15625 | 4 | #!/usr/bin/python
count = 0
while (count < 9):
print ('The count is:', count)
count = count + 1
for j in range(9):
print ('The j is:', j)
#// The count is: 0
#// The count is: 1
#// The count is: 2
#// The count is: 3
#// The count is: 4
#// The count is: 5
#// The count is: 6
#// The count is: 7
#// The ... | true |
50fa0e9be4d7dadc0aad8eada7de2ecb362e3ba0 | seefs/Source_Insight | /node/Pythons/py_test/test_list_trans.py | 1,163 | 4.25 | 4 |
dict = {'name': 'Zara', 'age': 7, 'class': 'First'}
# 字典转为字符串,返回:<type 'str'> {'age': 7, 'name': 'Zara', 'class': 'First'}
print
type(str(dict)), str(dict)
# 字典可以转为元组,返回:('age', 'name', 'class')
print
tuple(dict)
# 字典可以转为元组,返回:(7, 'Zara', 'First')
print
tuple(dict.values())
# 字典转为列表,返回:['age', 'name', 'class']
p... | false |
4bea2aa9f65dc46094022529b2666bd0ebd4a252 | chinatsui/DimondDog | /algorithm/exercise/hash_table/find_two_squares_sum.py | 943 | 4.3125 | 4 | """
Given a number 'num', find another two numbers 'a' and 'b' to make pow(a,2) + pow(b,2) = num, then return [a,b]
If there doesn't exist such a pair of numbers, return an empty array.
Example 1:
Input: 58.
Output: [3, 7]
Explanation: 3^2 + 7^2 = 58
Example 2:
Input: 12.
Output: []
Explanation: There doesn't exist a... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.