blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
5657687ff5fd3a24269241833c650ef87d2bd8d0 | biswaranjanroul/Python-Logical-Programms | /Fresher Lavel Logical Programms/Python program to check if a string is palindrome or not.py | 596 | 4.21875 | 4 | #using sRting Built in function
'''str=input("Enter a string:")
if str[::-1]==str:
print('it is a palindrom')
else:
print("it is not palindrom")'''
#function With reverse string
'''def reverse(s):
return s[::-1]
def ispalindrome(s):
rev=reverse(s)
if s==rev:
return True
return False
... | false |
968ec4600f28007d7a84b5068b7d2b185f6f684f | olafironfoot/CS50_Web | /Lectures/Lecture4/src4/Testing and questions for classes4.py/TestingClass.py | 2,009 | 4.4375 | 4 | # class User:
# def __init__ (self, full_name, birthday):
# self.name = full_name
# self.birthday = birthday
#
# #Can assign a variable to store infomation within a class User()
# Thisperson = User("Dave", 192832)
#
# print(Thisperson.name, Thisperson.birthday)
#
# #this needs to be assigned, otherw... | true |
c501f289e485673870ab507cde6938e037fd20ee | gerardogtn/matescomputacionales | /matescomputacionales/project02/recursive_definitions.py | 1,790 | 4.21875 | 4 | """ All strings used as patterns in a recursive definition"""
patternStrings = ['u', 'v', 'w', 'x', 'y', 'z']
def getAllCombinationsForStep(step, combinations, out):
"""" Given a single recursive definition and all possible combinations to fill
each pattern with, return all possible combinations
Keyword a... | true |
5a6110d12a5f4882796302209952a91cfc3d43b1 | IvanJeremiahAng/cp1404practicals | /prac_03/lecture ex.py | 488 | 4.15625 | 4 | min_age = 0
max_age = 150
valid_age = False
while not valid_age:
try:
age = int(input("Enter your age: "))
if min_age <= age <= max_age:
valid_age = True
else:
print("Age must be 0 - 150 inclusive.")
except ValueError as e:
print("Age must be an integer")
... | true |
144373f5a1545d765447e2b1557e9d92361a02ea | MightyElemental/SoftwareOne | /Week Four/turtlefunctionstemplate.py | 1,916 | 4.40625 | 4 | '''
Created on 24 Jul 2020
@author: Lilian
'''
import time
import turtle
import math
my_turtle = turtle.Turtle()
my_turtle.showturtle()
#################### WRITE YOUR CODE BELOW #########################
# ---- Question 1 ----
# design a function draw_triangle to draw a triangle. Using this ... | false |
f22ee0714af9a4727ee3311b5a15ee083e004c76 | urjits25/leetcode-solutions | /LC92.py | 1,880 | 4.125 | 4 | '''
REVERSE LINKED LIST II
Reverse a linked list from position m to n. Do it in one-pass.
Note: 1 ≤ m ≤ n ≤ length of list.
'''
def reverseBetween(head: ListNode, m: int, n:int) -> ListNode:
'''
:type head: ListNode
:type m: int
:type n: int
:rtype: ListNode
'''
# Function to rever... | true |
cd4f1bd46e15ca494d59ca9650839d313f51847b | urjits25/leetcode-solutions | /LC53.py | 758 | 4.1875 | 4 | '''
MAXIMUM SUBARRAY
Given an integer array nums, find the contiguous subarray (containing at least one number)
which has the largest sum and return its sum.
'''
# Dynamic Programming, Time : O(N); Space: O(N)
# Better solution (O(1) space): https://leetcode.com/problems/maximum-subarray/discuss/20194, Explanation:... | true |
58c93fd24db3aadf5899654ba7f63b724ae96bd3 | rubleen1903/Python-BubbleSort | /sort.py | 413 | 4.28125 | 4 | # Creating a bubble sort function
def bubblesort(lista):
#outer for loop
for i in range(0,len(lista)-1):
for j in range(len(lista)-1):
if(lista[j]>lista[i]):
temp = lista[j]
lista[j]=lista[j+1]
lista[j+1]=temp
return lista
lista=[12,42,8... | true |
0d79d97a228c8e133511f3d6d10a4fa9af1c7a12 | LeenaKH123/Python2 | /02_more-datatypes/02_14_char_count_dict.py | 347 | 4.25 | 4 | # Write a script that takes a text input from the user
# and creates a dictionary that maps the letters in the string
# to the number of times they occur. For example:
#
# user_input = "hello"
# result = {"h": 1, "e": 1, "l": 2, "o": 1}
x = input("type your string without spaces ")
freq = {}
for c in set(x):
freq[c... | true |
6c01755380160bfc34cb1067e9c2d05546b336d9 | LeenaKH123/Python2 | /02_more-datatypes/02_10_pairing_tuples.py | 871 | 4.40625 | 4 | # The import below gives you a new random list of numbers,
# called `randlist`, every time you run the script.
#
# Write a script that takes this list of numbers and:
# - sorts the numbers
# - stores the numbers in tuples of two in a new list
# - prints each tuple
#
# If the list has an odd number of items,... | true |
21f4c5fdebc4f4ecb80f42d20e364ca29b276377 | LeenaKH123/Python2 | /04_functions-and-scopes/04_10_type_annotations.py | 692 | 4.21875 | 4 | # Add type annotations to the three functions shown below.
# type annotations are also known as type signatures and they are used to indicate the data type of variables and the input
# and output of functions and methods in a programming language
# static type: performs type checking at compile-time and requires datatt... | true |
9bfea5d550eb6f62ad3dff93d63fa4f6058f28ee | uabua/rosalind | /bioinformatics-stronghold/rabbits-and-recurrence-relations/fib.py | 689 | 4.25 | 4 | """
ID: FIB
Title: Rabbits and Recurrence Relations
URL: http://rosalind.info/problems/fib/
"""
def count_rabbits(month, pair):
"""
Counts the total number of rabbit pairs that will be present after n(month) months, if we begin with 1 pair and
in each generation, every pair of reproduction-age rabbits pr... | true |
9061b877b160147aa4ad5a49172dafebd6d1db64 | Faresa/debugging-and-testing | /calendar_utils.py | 2,704 | 4.25 | 4 | # Mphephu Faresa
# CSC1010H
def is_leap_year(year) :
#code for leap year
a =year%4
b =year%100
c = year%400
if a==0 :
if b == 0 :
if c==0 : return True
else : return False
if b!=0 : return True
else: return False
def month_n... | false |
a41367b78fab098494c13035c415c4394baf2a8c | mohammed-ysn/online-safety-quiz | /main.py | 2,929 | 4.125 | 4 | import random
import json
class Quiz:
def __init__(self):
# Store score
self.score = 0
# Store current question number
self.q_num = 0
# Read json file into dict
with open('quiz_data.json') as json_file:
self.quiz_data = json.load(json_file)
# ... | false |
7153eecf22609652b057f756a8aff5bd17c931a1 | NoroffNIS/Python_Examples | /src/week 2/day 2/while_loop_exit.py | 385 | 4.25 | 4 | what_to_do = ''
while what_to_do != 'Exit':
what_to_do = input('Type in Exit to quit, '
'or something else to continue: ')
if what_to_do == 'Exit':
print('You typed in Exit, program stopped')
elif what_to_do == 'exit':
print('You typed in Exit, loop break, program stop... | true |
23a35831d935fef121dea84bd9c38b779bea44b1 | NoroffNIS/Python_Examples | /src/week 2/day 4/km_t_to_m_s.py | 708 | 4.125 | 4 |
def km_h_to_m_s():
print('You choose to convert km/t -> m/s')
km_h = float(input('Type in a km/h:'))
m_s = km_h * 0.2778
print(km_h, 'km/h = ', m_s,'m/s', sep='')
def m_s_to_km_h():
print('You choose to convert m/s -> km/t')
m_s = float(input('Type in a m/s:'))
km_h = m_s * 3.6
print(m... | false |
22048e72c64345b993e87c6183c1b0a31c257d7a | NoroffNIS/Python_Examples | /src/week 2/day 3/letter_count.py | 257 | 4.125 | 4 | word = input('Type in a word:').upper()
letter = input('Type in a letter you want to count:').upper()
count = 0
for l in word:
if l == letter:
count += 1
else:
pass
print('In you word', word, 'there is', count, 'letters of', letter) | true |
09d3553282f07aebe1220d22a9a614eea96c470d | maizzuu/ot-harjoitustyo | /src/entities/user.py | 534 | 4.15625 | 4 | class User:
"""Class that depicts a User.
Attributes:
username: String that represents the users username.
password: String that represents the users password.
"""
def __init__(self, username:str, password:str):
"""Class constructor that creates a new user.
Args:
... | true |
af23b5795bbb6d606222cc34ea0dc4088e9a81f0 | Salman42Sabir/Python3-Programming-Specialization | /Tuples_course_2_assessment_5.py | 1,704 | 4.40625 | 4 | # 1. Create a tuple called olympics with four elements: “Beijing”, “London”, “Rio”, “Tokyo”.
olympics = ("Beijing", "London", "Rio", "Tokyo")
print(olympics)
# 2. The list below, tuples_lst, is a list of tuples. Create a list of the second elements of each tuple and assign this list to the variable country.
tuples_l... | true |
d3182b67f95423e2679d3b9b9c00b6c401ec3ceb | qiuyucc/pythonRoad | /Day1- 15/Day9 OOAdvanced/override.py | 1,531 | 4.15625 | 4 | #override, poly-morphism
# 子类在继承了父类的方法后,可以对父类已有的方法给出新的实现版本,这个动作称之为方法重写(override)。
# 通过方法重写我们可以让父类的同一个行为在子类中拥有不同的实现版本,
# 当我们调用这个经过子类重写的方法时,不同的子类对象会表现出不同的行为,这个就是多态(poly-morphism)。
from abc import ABCMeta, abstractmethod
class Pet(object,metaclass=ABCMeta):
"""PET
"""
def __init__(self,nickname):
s... | false |
8ca4330f75344811b46435ec2b92cabdaf601e89 | omwaga/Python-loop-programs | /Factorial_of_a_Number.py | 501 | 4.1875 | 4 | """
Factorial is a non-negative integer.
It is the product of all positive integers less than or equal to that number for which you ask for factorial.
It is denoted by exclamation sign (!).
"""
num = int(input("Enter a number:"))
factorial = 1
if num < 0:
print("Sorry, factorial does not exist for negative numb... | true |
b1739be0b25eb2d1d4ec11c915e6243f2d51b242 | tedmik/classwork | /python-workbook/37.py | 613 | 4.375 | 4 | num_sides = int(input("How many sides does your shape have?: "))
if(num_sides == 3):
print("Your shape is a triangle")
elif(num_sides == 4):
print("Your shape is a square or rectangle")
elif(num_sides == 5):
print("Your shape is a pentagon")
elif(num_sides == 6):
print("Your shape is a hexagon")
elif(num_sides ... | true |
34b2cc012e22fc7015c4058c2534e7be382a91b0 | imharshr/7thSemCSEnotes | /ML Lab/Sample Programs Assignment/samplePrograms.py | 263 | 4.3125 | 4 | tuplex = "w", 3, "r", "s", "o", "u", "r", "c", "e"
print(tuplex)
#tuples are immutable, so you can not remove elements
#using merge of tuples with the + operator you can remove an item and it will create a new tuple
tuplex = tuplex[:2] + tuplex[3:]
print(tuplex)
| true |
04bda63d98d93b8974566500024579a16631ae58 | iidyachenko/GB_Python_Kurs1 | /Lesson1/Ex5.py | 751 | 4.15625 | 4 | # Расчет экономической деятельности фирмы
revenue = int(input("Введите выручку фирмы: "))
cost = int(input("Введите издержки фирмы: "))
profit = revenue - cost
if profit > 0:
rent = (profit/revenue)*100
print("Ваша прибыль составила: ", profit)
print(f"Ваша рентабльность: {rent:.2f}%")
staff = int(inpu... | false |
cca17409f94e59fee2a880609d828f6dad0deafa | iidyachenko/GB_Python_Kurs1 | /Lesson3/Ex1.py | 648 | 4.1875 | 4 | # Реализовать функцию, принимающую два числа (позиционные аргументы) и выполняющую их деление.
# Числа запрашивать у пользователя, предусмотреть обработку ситуации деления на ноль.
def division(a, b):
try:
return a / b
except ZeroDivisionError:
print("На ноль делить нельязя!")
a = int(input(... | false |
53bcd34a0336d4aeb77d6cc619e63532dd13a2c6 | tylerharter/caraza-harter-com | /tyler/cs301/fall18/materials3/code/lec-06-functions/example17.py | 223 | 4.3125 | 4 | x = 'A'
def f(x):
x = 'B'
print('inside: ' + x)
print('before: ' + x)
f(x)
print('after: ' + x)
# LESSON 10: it's irrelevant whether the
# argument (outside) and parameter (inside)
# have the same variable name | false |
d2ca6150538c96deef484881d7271a20d02d1b48 | tylerharter/caraza-harter-com | /tyler/cs301/fall18/materials3/code/lec-07-conditionals-loops/code04_with_functions.py | 268 | 4.46875 | 4 | def is_positive_or_negative(num):
if num > 0:
return 'POSITIVE'
elif num < 0:
return 'NEGATIVE'
else:
return 'ZERO'
number = input('Enter a number: ')
number = int(number)
num_type = is_positive_or_negative(number)
print(num_type) | false |
e12ab5d88436f7882b3a3d5891f48b5d4a16a63f | tylerharter/caraza-harter-com | /tyler/cs301/fall18/materials3/code/lec-06-functions/example12.py | 261 | 4.25 | 4 | # show global frame in PythonTutor
msg = 'hello' # global, because outside any function
def greeting():
print(msg)
print('before: ' + msg)
greeting()
print('after: ' + msg)
# LESSON 5: you can generally just use
# global variables inside a function
| true |
b41de77e9bad479e1220a76ef543d66065cf5f27 | programmingwithjack/python_course | /variables.py | 365 | 4.1875 | 4 | # variable python
a=5 # int
b="hello" #string
print(a)
print(b)
# assign multiple variable
x,y,z="hello","world","good"
print(x)
print(y)
print(z)
# output variable
x = "awesome"
print("Python is " + x)
x = "Python is "
y = "awesome"
z = x + y
print(z)
x = 5
y = 10
print(x + y)
# global varibale
# when functio... | false |
ad15dbee9408784ef55eb62222df7b892febf92d | GitRAK07/my_python_programs_learning | /Documents/python/dictionary.py | 714 | 4.25 | 4 | ####### Dictionary ########
user = {
'name': 'Anand',
'Age': 26,
'occupation': 'Software Engineer'
}
print(user['name'],user['Age'])
print(user.get('age')) #Use get method to avoid the program throwing the errors.
print(user.get('Age', 90)) #Returns value 90 if Age value is not found in the dict.
print( 'n... | true |
d4ba1f5b6867e176f47a329ac2741275894bd62f | animesh2411/python-udacity-course-movies-app | /flower.py | 828 | 4.21875 | 4 | import turtle
def draw_square(some_turtle):
for i in range(1,3):
some_turtle.forward(100)
some_turtle.right(120)
def draw_art():
#drwa square
window=turtle.Screen()
window.bgcolor("white")
brad=turtle.Turtle()
brad.speed(3)
brad.shape("turtle")
brad.color("blue")
f... | false |
1d2df47f0beaf079e3e79b40ece8905592eb71bd | jblanco75/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/4-print_square.py | 474 | 4.40625 | 4 | #!/usr/bin/python3
"""Function: print_square"""
def print_square(size):
"""Prints a square with '#'
'size' is the size length of the square
'size' must be an integer"""
if type(size) != int:
raise TypeError("size must be an integer")
if size < 0:
raise V... | true |
488b87e2df6b9aef7780edaeb85b199d88882c07 | sadragw/projekt | /Kolikov A. E/02/les01_02.py | 2,025 | 4.3125 | 4 | # coding: utf-8
# Python. Быстрый старт.
# Занятие 2.
# Домашнее задание: в случае, если пользователь ввел Y, то придумать и вывести список действий,
# спросить, какое он хочет выполнить;
# ознакомиться с PEP8
import os
print("Great Python Program!")
print("Привет, прогр... | false |
7e5f9e75db1723f379b360afb8ed88937b3783e3 | RSP123/python_puzzles | /minus_duplicates.py | 436 | 4.21875 | 4 | # Program for removing duplicate element in tthe list using set
# function to remove the duplicates
def duplicate(input):
result = []
res = set(input) # Converting list to set
for i in res:
result.append(i)
return result
# Main
if __name__=="__main__":
input = [1, 2, 2, 3, 4, 8, 8, 7,... | true |
c2eff0cf6036a8e991ff80e7acd9b69cac631a40 | RSP123/python_puzzles | /prime_num.py | 846 | 4.40625 | 4 | # This program check weather the given number is prime or not
# Function to check prime number
def prime_number(number):
# Returning False for number 1 and less then 1
if number == 2 or number == 1:
return True
elif number < 1 or number%2 == 0:
return False
else:
# Iterating from 2 to check the number is pri... | true |
87e0ace6902aca39ce6e71a3c4b3ddb3456df7d0 | Yaseen315/pres-excercise | /yq-grace-exercise-logic1.py | 932 | 4.25 | 4 | """This is my random number generator, I have a few problems with it. The turns don't seem to be working properly- I want them to start from 1
and increase each turn. Also the print statements seem to not be coming out the way I want them. I also can't make the game finish."""
print "Random number generator"
from ran... | true |
374f5b9459446d1c2dec30776fc2c8a13bda7a4b | MarRoar/Python-code | /00-sxt/02-shujujiegou/01-yinru/08_dequeue.py | 1,015 | 4.3125 | 4 | '''
双端队列
Deque() 创建一个空的双端队列
add_front(item) 从队头加入一个item元素
add_rear(item) 从队尾加入一个item元素
remove_front() 从队头删除一个item元素
remove_rear() 从队尾删除一个item元素
is_empty() 判断双端队列是否为空
size() 返回队列的大小
'''
class Deque(object):
def __init__(self):
self.items = []
def add_front(self, item):
'''从队头加入一个item元素'''
... | false |
911831018533759e6ff2bf4fcca1caba1a88306c | MarRoar/Python-code | /00-sxt/02-shujujiegou/01-yinru/07_queue.py | 706 | 4.28125 | 4 | '''
队列的操作
Queue() 创建一个空的队列
enqueue(item) 往队列中添加一个item元素
dequeue() 从队列头部删除一个元素
is_empty() 判断一个队列是否为空
size() 返回队列的大小
'''
class Queue(object):
def __init__(self):
self.items = []
def enqueue(self, item):
'''往队列中添加一个item 元素'''
self.items.insert(0, item)
def dequeue(self):
'''... | false |
f6f15763778e1c9adbeddba0956c1ab04fb40259 | alyson1907/CodeWars | /6-kyu/python/IsIntegerArray.py | 892 | 4.125 | 4 | # https://www.codewars.com/kata/52a112d9488f506ae7000b95/train/python
# Write a function with the signature shown below:
# def is_int_array(arr):
# return True
# returns true / True if every element in an array is an integer or a float with no decimals.
# returns true / True if array is empty.
# returns false / F... | true |
e50e1e88ce23c03852a7bbd34f703ce22bf6471b | rvsreeni/ACD_MDS_Python_Session-3_Assignment-3.3 | /ACD_MDS_Python_Session#3_Assignment#3.3.py | 307 | 4.21875 | 4 | # Program to print longest word
def longest_word(wdlist):
maxlen = 0
maxwd = ""
for wd in wdlist:
if len(wd) > maxlen:
maxwd = wd
maxlen= len(wd)
return(maxwd)
input_list = ['one','three','four','two']
print(longest_word(input_list))
| false |
aa54193adecee918fa5762535ffda5dd8470d6e1 | dancaps/python_playground | /cw_titleCase.py | 2,296 | 4.40625 | 4 | #!/use/bin/env python3
'''https://www.codewars.com/kata/5202ef17a402dd033c000009/train/python
A string is considered to be in title case if each word in the string is either (a) capitalised (that is, only the first letter of the word is in upper case) or (b) considered to be an exception and put entirely into lower c... | true |
1736446a61e22d6c931fd7ea09648771e545b743 | dancaps/python_playground | /cw_summation.py | 455 | 4.375 | 4 | #!/usr/bin/env python3
'''
https://www.codewars.com/kata/grasshopper-summation/train/python
Summation
Write a program that finds the summation of every number between 1 and num. The number will always be a positive
integer greater than 0.
For example:
summation(2) -> 3
1 + 2
summation(8) -> 36
1 + 2 + 3 + 4 + 5 + ... | true |
7602a619d5f9c3f16c886f59c1c70fdd134f2de3 | sonofmun/FK-python-course | /pyhum/pig_latin.py | 891 | 4.40625 | 4 | #! /usr/bin/env python3
# -*- coding: utf8 -*-
VOWELS = 'aeiouAEIOU'
def starts_with_vowel(word):
"Does the word start with a vowel?"
return word[0] in VOWELS
def add_ay(word):
"Add 'ay' at the end of the word."
return word + 'ay'
def convert_word(word):
"Convert a word to latin (recursive styl... | true |
8669a1a2503e9546d1d8a3a0c0c9e309152133f3 | mstoiovici/module2 | /ch03_functions_importingModules/ch3_file1_Mariana_functions.py | 2,509 | 4.15625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 3 15:45:32 2018
@author: maria
"""
################################## task1 ###########################
def add_two_numbers():
number1=1
number2=2
result=number1+number2
#print(result)
print(str(number1)+" plus "+str(number2)+" ... | false |
c86ebebbe6eb2c4b51b731ffb8d49cd5679528bd | mstoiovici/module2 | /Codingbat/String_1/String_1_first_half.py | 437 | 4.34375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 15:52:31 2018
@author: maria
"""
"""
Given a string of even length, return the first half. So the string "WooHoo" yields "Woo".
first_half('WooHoo') → 'Woo'
first_half('HelloThere') → 'Hello'S
first_half('abcdef') → 'abc'
"""
def first_half(st... | true |
e057e238d978fb2b6043f1810963e3f86a5b03cf | HugoPhibbs/COSC262_lab_work | /Lab_11/binary_search_tree.py | 1,187 | 4.15625 | 4 | # Do not alter the next two lines
from collections import namedtuple
Node = namedtuple("Node", ["value", "left", "right"])
# Rewrite the following function to avoid slicing
def binary_search_tree(nums, is_sorted=False, start=None, end=None):
"""Return a balanced binary search tree with the given nums
at t... | true |
92e483d42f1b5deba9df5b7efce92ccd22bbf551 | HugoPhibbs/COSC262_lab_work | /Lab_2/fib_matrix.py | 1,787 | 4.125 | 4 | def fib(n, matrix=None):
"""finds the nth fibonacci sequence using divide and conquer and
fast exponentiation"""
#how to use martix multiplication in python??
#how can i implement 2x2 matrix multiplicatoin in python, look at the general formula.
# fib matrix = [[fn+1, fn], [fn, fn-1]]
if n == 1 ... | true |
0e48158e10ae5c8672c3c4b58cd1679a6afdaec1 | HugoPhibbs/COSC262_lab_work | /Lab_4/dijkstras.py | 1,825 | 4.1875 | 4 | def dijkstra(adj_list, next_node):
"""does dijkstras algorithm on a graph"""
parent_array = [None for i in range(0, len(adj_list))]
distance_array = [float('inf') for i in range(0, len(adj_list))]
in_tree = [False for i in range(0, len(adj_list))]
distance_array[next_node] = 0
true_array = [Tr... | true |
489714e74b951da5b5cd093d33ce3618440a5edc | ifpb-cz-ads/pw1-2020-2-ac04-team-josecatanao | /questao_06.py | 330 | 4.1875 | 4 | #6) Modifique o programa anterior de forma que o usuário também digite o início e o fim da tabuada, em vez de começar com 1 e 10.
n = int(input("Tabuada de: "))
inicio = int(input("digite o inicio da Tabuada :"))
fim = int(input("digite o fim da Tabuada :"))
x = inicio
while x <= fim:
print(n ,'*', x,'=',n*x)
x =... | false |
8ca7053bbf67d2a95481a4cd7dc58e54defb37e0 | failedpeanut/Python | /day1/MoreAboutFunctions.py | 1,137 | 4.28125 | 4 | #Default Argument Values
#can give default argument values for functions.
def defaultArguments(name, age=18, gender='Not Applicable',somethingelse=None):
print("name",name)
print("age",age)
print("gender",gender)
print("somethingelse", somethingelse)
defaultArguments("Peanut",20,"Male","Nothing!")
defau... | true |
489444bb8d5a6526728879c779bba58c35b45534 | Christinaty/holbertonschool-higher_level_programming-1 | /0x0B-python-input_output/7-add_item.py | 584 | 4.3125 | 4 | #!/usr/bin/python3
"""Write a script that adds all arguments to a Python list, and then save
them to a file:
*If the file doesnt exist, it should be created
"""
from sys import argv
from os import path
save_to_json_file = __import__('5-save_to_json_file').save_to_json_file
load_from_json_file = __import__('6... | true |
aae741e19ab69d1b916ad414e0b6db207f5dc3e0 | tyriem/PY | /CISCO/CISCO 33 - Tax Calc.py | 2,193 | 4.28125 | 4 | ### AUTHOR: TMRM
### PROJECT: CISCO DevNet - Tax Calc
### VER: 1.0
### DATE: 05-XX-2021
### OBJECTIVE ###
# Your task is to write a tax calculator.
# It should accept one floating-point value: the income.
# Next, it should print the calculated tax, rounded to full dollars. There's a function named round() which wil... | true |
ffbfc2d58564e2cad36dac052f517cb9632f4d4d | tyriem/PY | /Intro To Python/14 -While Loop - Password TMRM.py | 322 | 4.15625 | 4 | ### AUTHOR: TMRM
### PROJECT: INTRO TO PYTHON - While Loop Password
### VER: 1.0
### DATE: 05-XX-2020
##Declare CALLs
##LOOPs and VARs
password = ''
while password != 'test':
print('What is the password?')
password = input()
##OUTPUTs
print('Yes, the password is ' + password + '. You may enter.'... | true |
339ac9fc350ddedccd8667e9288dc25facda7c82 | tyriem/PY | /Intro To Python/25 - Function - Param-Default-Return TMRM.py | 1,542 | 4.8125 | 5 | ### AUTHOR: TMRM
### PROJECT: INTRO TO PYTHON - FUNCTIONS
### VER: 1.0
### DATE: 05-28-2020
##Declare CALLs & DEFs
### PARAMETERS ###
# Parameters are used to pass information to functions
# Parameters are specified after the function name, inside the parentheses. You can add as many parameters as you want, just s... | true |
c4613f6ad8a571db354d428c78a9f5441cdc62a0 | tyriem/PY | /Intro To Python/41 - GUI - Radio Button SelectGet - TMRM.py | 1,047 | 4.25 | 4 | ### AUTHOR: TMRM
### PROJECT: INTRO TO PYTHON - GUI: Radio Buttons Select & Get
### VER: 1.0
### DATE: 06-06-2020
#####################
### GUIs ###
#####################
### OBJECTIVE ###
#Code a basic GUI for user
#
### OBJECTIVE ###
##Declare CALLs & DEFs
from tkinter import*
#First, we import the t... | true |
a39b5eec1a8262f0e693f662b6664a79e42a7888 | tyriem/PY | /Intro To Python/6 - Perform CALCs using Formulae.py | 1,985 | 4.34375 | 4 | ### AUTHOR: TMRM
### PROJECT: Perform Calculations using Formulas
### VER: 1.0
### DATE: 05-18-2020
#Task #1: Find the area of a circle
print ("\n [TASK #1: Find the area of a circle using the formula pi(3.14) x radius^2]")
#Declare STRINGs & VALs
rad = float(input("\n Enter the Radius of The Circle = "))
measure... | true |
8c5f731509903fbfe23c7fa8e09b304218cdad80 | vaylon-fernandes/simple-python-projects | /guess_the_number/guess_the_number_with_levels.py | 2,677 | 4.375 | 4 | #Number Guessing Game Objectives:
# Include an ASCII art logo.
# Allow the player to submit a guess for a number between 1 and 100.
# Check user's guess against actual answer. Print "Too high." or "Too low." depending on the user's answer.
# If they got the answer correct, show the actual answer to the player.
# Trac... | true |
74ecde0261b07b9503333ccfc83ee50c0a4dac95 | vivian2yu/python-demo | /python-beginner/do_fun.py | 473 | 4.1875 | 4 | #比如在游戏中经常需要从一个点移动到另一个点,给出坐标、位移和角度,就可以计算出新的新的坐标:
import math
# def move(x, y, step, angle=0):
# nx = x + step * math.cos(angle)
# ny = y - step * math.sin(angle)
# return nx, ny
# x, y = move(100, 100, 60, math.pi / 6)
# print(x, y)
# r = move(100, 100, 60, math.pi / 6)
# print(r)
#高阶函数
def add(x, ... | false |
fae1263cfa2e8e3516c453acc70173377717b3a9 | mladenangel/scripts | /pyLessions/lles8.py | 254 | 4.15625 | 4 | print('demo - iteration for')
for i in range(1,5):
print(i)
print('demo - nested for')
for i in range(1,3):
for j in range(5,10):
print(str(i) + '-' + str(j))
print('demo - iteration while')
i = 0
while i < 10:
print(i)
i += 1
| false |
d3e11df9c61642894bc613cebf4f9a2f7b4e7360 | lt393/pythonlearning | /s5_data_structure/dict/dict_create.py | 670 | 4.25 | 4 |
# Python's dictionaries are kind of hash table type which consist of key-value pairs of unordered elements.
# Keys : must be immutable data types ,usually numbers or strings.
# Values : can be any arbitrary Python object.
d = {} # empty dict
d = {
1: 1,
2: 2,
3: 3
}
# Python Dictionaries are mutabl... | true |
5561b4532dfe1986fa37e26beaf7490584acc298 | lt393/pythonlearning | /s12_date_time/datetime.py | 2,149 | 4.25 | 4 | # datetime
# datetime对象的构建
"""
>>> from datetime import datetime
>>> cur = datetime(year=2016, month=9, day=2, hour=10, minute=30,second=13, microsecond=2)
>>> cur
datetime.datetime(2016, 9, 2, 10, 30, 13, 2)
>>> cur.date()
datetime.date(2016, 9, 2)
>>> cur.time()
datetime.time(10, 30, 13, 2)
>>>
"""
# 获取当前时间的datet... | false |
b6aabafceb7b1b07d5952b5e48a959e1100821fc | lt393/pythonlearning | /s7_python_functions/lambda.py | 1,260 | 4.21875 | 4 |
"""
The lambda’s general form is the keyword lambda,
followed by one or more arguments (exactly like the arguments list you enclose in parentheses in a def header),
followed by an expression after a colon:
lambda argument1, argument2,... argumentN :expression using arguments
"""
def sum(x, y ,z):
return x + y + ... | true |
032321af56c3fe1f915dc0c5abe8a0dde7993d3e | AndersonANascimento/PythonExercicios | /desafio035.py | 626 | 4.1875 | 4 | # Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um trângulo.
# Obs: Em todo triângulo, a medida de qualquer lado é maior que a diferença entre as medidas dos outros dois.
r1 = int(input('Informe a medida da 1ª reta: '))
r2 = int(input('Informe a medida da 2ª ... | false |
4592872fbd9b93e6a1a8d3dec72d04c438bc7a7e | AndersonANascimento/PythonExercicios | /desafio04.py | 517 | 4.15625 | 4 | # Faça um programa que leia algo pelo teclado e mostre o seu tipo primitivo e todas as informações possíveis sobre ele
obj = input('Digite algo: ')
print('O tipo primitivo desse valor é {}'.format(type(obj)))
print('Só tem espaços?', obj.isspace())
print('É um número?', obj.isnumeric())
print('É alfabético?', obj.isal... | false |
c82d806ab02b2e467699dab1d57461474f8e9bce | Czbenton/HelloPython | /src/Main.py | 1,377 | 4.21875 | 4 | accountList = {"zach": 343}
def login():
global userName
print("Welcome to The Bank of Python. Please enter your name.")
userName = input()
print("Hi ", userName, "!! How much would you like to deposit to start your account?", sep="")
initDeposit = float(input())
accountList[userName] = initDe... | true |
95af735aa251c5d148acf1b04761d7f7eec5851d | emanuelvianna/algos | /algo/sorting/heapsort.py | 2,914 | 4.21875 | 4 | import heapq
from algo.utils.list_utils import swap
def _min_heapify_at_a_range(numbers, left, right):
"""
Build max-heap in a range of the array.
Parameters
----------
numbers: list
List of numbers to be sorted.
left: int
Initial index.
right: int
Final index.
... | true |
dce86aff42a17c01304f326cb7a55574fcd2b097 | mkhalil7625/hello_sqlite_python | /sqlite/db_context_manager_error_handling.py | 1,673 | 4.21875 | 4 | """
sqlite3 context manager and try-except error handling
"""
import sqlite3
def create_table(db):
try:
with db:
cur = db.cursor()
cur.execute('create table phones (brand text, version int)')
except sqlite3.Error as e:
print(f'error creating table because {e}')
def ... | true |
f3b56bd393ca33e532baa4e4eaacbae7fd9ebe9c | sakshimaan/Python | /palindrome.py | 590 | 4.3125 | 4 | #python code to check whether the given string is palindrome or not
def check(string):
n=len(string)
first=0
mid=(n-1)//2
last=n-1
flag=1
while(first<mid):
if (string[first]==string[last]):
first=first+1
last=last-1
else:
flag=0
... | true |
1ee0023d2c872565e5405a8d850b11094b392fe4 | LachezarKostov/SoftUni | /01_Python-Basics/functions/Password Validator.py | 1,161 | 4.15625 | 4 | def is_six_to_ten_char(password):
valid = False
if 6 <= len(password) <= 10:
valid = True
return valid
def is_letters_and_digits(password):
valid = True
for char in password:
ascii = ord(char)
if (ascii < 48) or (57 < ascii < 65) or (90 < ascii < 97) or (ascii > 122):
... | true |
8020457b677aa37c4765a8bf014178adcd6d98b6 | Fay321/leetcode-exercise | /solution/problem 75.py | 1,696 | 4.15625 | 4 | # -*- coding: utf-8 -*-
"""
判断链表是否有环
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution1(object):
def hasCycle(self, head):
"""
:type head: ListNode
:rtype: bool... | false |
d4c79eb2a3a0673e078c907808a187a25853d825 | phibzy/InterviewQPractice | /Solutions/LongestCommonPrefix/solution.py | 1,002 | 4.25 | 4 | #!/usr/bin/python3
"""
@author : Chris Phibbs
@created : Wednesday Sep 16, 2020 17:07:49 AEST
@file : solution
"""
"""
The "column" approach
Compare each sequential character of each string.
Return as soon as a character in one string is not the same.
Complexity:
Time: O( N * M) - Where ... | true |
be104d8d168f501796507c6b58a15bb49d2c9314 | phibzy/InterviewQPractice | /Solutions/DistributeCandies/candies.py | 1,124 | 4.4375 | 4 | #!/usr/bin/python3
"""
@author : Chris Phibbs
@created : Thursday Mar 04, 2021 12:00:57 AEDT
@file : candies
"""
"""
Questions:
- Range of number of candies?
- Will number of candies always be even? Need to floor if odd?
- Will candy types just be ints >= 0?
- Neg ints?
- Em... | true |
85938d4ff2bad05052c6158c29525d45d74a9428 | naumanurrehman/ekhumba | /problem3/recursion/reverseString.py | 1,012 | 4.1875 | 4 | '''
Given a string, Write recursive function that reverses the string.
Input Format
A String.
Constraints
x
Output Format
Reverse of Strings.
Sample Input
Being
Sample Output
gnieB
Explanation
Self explanatory.
'''
def recur(content, num, length):
if num >= length:
return ''
return recur(c... | true |
4050182c72685750fd92c6fb0bdca5c5879db964 | JanakSharma2055/Cryptopals | /challenge6.py | 613 | 4.5 | 4 | def find_hamming_distance(string1: bytes, string2: bytes) -> int:
"""
Find hamming distance between two strings.
The Hamming distance is just the number of differing bits.
:param string1: The first string to be compared, as bytes
:param string2: The second string to be compared, as bytes
:retur... | true |
16a17fc8a65afedb33d9cd32c49b27f2d12559b8 | jermcmahan/ATM | /ATM/simulator/tree.py | 1,546 | 4.4375 | 4 |
"""
Tree --- class to represent an accepting computation tree of an Alternating Turing Machine
:author Jeremy McMahan
"""
class Tree:
"""
Creates the tree from the root data and a list of subtrees. A leaf is denoted by having the empty list
as its children
:param root the data associated with the tre... | true |
08a8f2c334e8bc7ea3e064c3fb0da40055e30618 | OneDayOneCode/1D1C_julio_2017 | /funciones.py | 1,132 | 4.25 | 4 | #-*-coding: utf-8 -*-
# Declarando una función en python 3
def operaciones(a, b):
# Las siguientes líneas imprimen suma de variables y concatenación
print ('la suma de', a, 'y', b, 'da como resultado:\n', a + b)
print ('la multiplicación de', a, 'y', b, 'da como resultado:\n', a * b)
print ('la división... | false |
9b2cb3097309c1b454167420187600bcb73293f4 | OneDayOneCode/1D1C_julio_2017 | /tablaMult.py | 1,222 | 4.46875 | 4 | # -*- coding: utf-8 -*-
# El siguiente programa es en la versión 2.7 de python, aún vigente
# se hace en esta versión para conocer la diferencia en la sintaxis
# Diferencias entre versión 2 y 3 de python
# Ambas utilizadas , diferencias como la falta de parentesis en la función print
# raw_input entre las versiones y ... | false |
70cbc8e51a38048c50c5bdd0cc765b97ecbe0fa2 | dylanplayer/ACS-1100 | /lesson-7/example_4.py | 337 | 4.1875 | 4 | # This while loop prints count until 100, but it breaks when
# the counter reaches 25
counter = 0
while counter < 100:
print(f"Counter: {counter}")
counter += 1
# If counter is 25, loop breaks
if counter == 25:
break
# Write a for loop that counts backwards from 50 to
# 0.
for num in range(50, 0, ... | true |
92ece88144930e7c5988738c24ca00c903a09d1c | dylanplayer/ACS-1100 | /lesson-10/example-3.py | 808 | 4.59375 | 5 | '''
Let's practice accessing values from a dictionary!
To access a value, we access it using its key.
'''
# Imagine that a customer places the following order
# at your empanada shop:
'''
Order:
1 cheese empanada
2 beef empanadas
'''
menu = {"chicken": 1.99, "beef":1.99, "cheese":1.00, "guava": 2.50}
# Get the p... | true |
90c220bac3f0f604e7ad0352859940d1729c40f9 | dylanplayer/ACS-1100 | /lesson-7/example_2.py | 403 | 4.25 | 4 | '''
Use while loops to solve the problems below.
'''
# TODO - Exercise 1: Repeatedly print the value of the variable price,
# decreasing it by 0.7 each time, as long as it remains positive.
from typing import Counter
price = 5
while price > 0:
print(price)
price -= 1
print("--------------")
# TODO - Exe... | true |
7fe979cb792ebdf4ccaf4f199c7a43466da3a7c4 | dylanplayer/ACS-1100 | /lesson-2/example-4.py | 905 | 4.125 | 4 | # Types
# Challenge: Guess the type for each of these and define a value
# write the type as a comment then define a value.
# Then test your work
# For example
height_in_inches = 72
print("int")
print(type(height_in_inches))
# Your age: type and value
age = 15
print("int")
print(type(age))
# Your shoe size: Type an... | true |
714c14a6b333ab2ac08deb00a132cf5a9dbccc20 | dylanplayer/ACS-1100 | /lesson-2/example-10.py | 399 | 4.625 | 5 | print("Welcome to the snowboard length calculator!")
height = input("Please enter your height in inches: ")
height = float(height) # Converts str to float!
# Input sees the user input as a string
# Before we can calculate it, we need to convert it to the correct
# data type... in this case, height should be an float... | true |
01b2a5e8659fedd193ada2f2bdf3869eab30f2ed | moritzemm/Ch.09_Functions | /9.7_BB8.py | 1,968 | 4.34375 | 4 | '''
BB8 DRAWING PROGRAM
-------------------
Back to the drawing board! Get it? Let's say we want to draw many BB8 robots
of varying sizes at various locations. We can make a function called draw_BB8().
We've made some basic changes to our original drawing program. We still have the
first two lines as importing arcade a... | true |
8fcfa372d51f99068336f9896d44edd6255c8d1f | rynoschni/python_dictionaries | /dictionary.py | 603 | 4.15625 | 4 | meal = {
"drink": "Beer",
"appetizer": "chips & salsa",
"entree": "fajita's",
# "dessert": "churros"
}
#print(meal["drink"])
#print("This Thursday, I will have a %s and %s for dinner!") % (meal("drink"), meal("entree"))
# if "dessert" in meal:
# print("Of course, Ryan had a dessert!! He ate %s" % (... | true |
7828342c4fee61624aeae648a3374b40d7055478 | front440/PYTHON | /Primer_Trimestre/Prpgramas_Repetitivos/Ejercicio02_MayorOMenorque0.py | 1,420 | 4.15625 | 4 | # Programa: Ejercicio01_MayorOMenorque0.py
#
# Proposito: Realizar un algoritmo que pida números (se pedirá por
# teclado la cantidad de números a introducir). El programa debe
# informar de cuantos números introducidos son mayores que 0, menores
# que 0 e iguales a 0.
#
# Autor: Francisco Javier Campos Gutiérrez
#
# F... | false |
6bda29d8f766a2fdb3ac307fab5c770ff5c977a7 | front440/PYTHON | /Primer_Trimestre/Programas_Alternativas/Ejercicio08_Triangulos.py | 1,874 | 4.3125 | 4 | # Programa: Ejercicio08_Triangulos.py
# Proposito: Programa que lea 3 datos de entrada A, B y C. Estos
# corresponden a las dimensiones de los lados de un triángulo.
# El programa debe determinar que tipo de triangulo es, teniendo en
# cuenta los siguiente:
#
# Si se cumple Pitágoras entonces es triángulo rectángulo
# ... | false |
21f5e6be1e8e21fce1d7554e18c9d609411e4323 | front440/PYTHON | /Primer_Trimestre/Programas_Alternativas/Ejercicio02_NumeroPar.py | 691 | 4.1875 | 4 | # Programa: Ejercicio2_NumeroPar.py
# Proposito: Escribe un programa que lea un número e indique
# si es par o impar..
#
# Autor: Francisco Javier Campos Gutiérrez
#
# Fecha : 16/10/2019
#
#
# Variables a usar
# * n <--- Número introducido
#
# Algoritmo:
# n % 2
# Leer datos
print("En este ejercicio os mostraremos... | false |
c2e7538357c9e8ef0db7fa23d077c7f1570ebfd7 | front440/PYTHON | /Primer_Trimestre/Programas_Secuenciales/Ejercicio12_PideNumeroXeY.py | 1,295 | 4.15625 | 4 | # Programa: Ejercicio12_PideNumeroXeY.py
#
# Proposito: Pide al usuario dos pares de números x1,y2 y x2,y2, que
# representen dos puntos en el plano. Calcula y muestra la distancia
# entre ellos.
#
# Autor: Francisco Javier Campos Gutiérrez
#
# Fecha : 10/10/2019
#
#
# Variables a usar
# * x1 <-- Coordenada as... | false |
1a904488a7fb8e90dca5c40443afe59c5fc2603c | mluis98/AprendiendoPython | /practica/condiciones3.py | 938 | 4.125 | 4 | # El numero 0 se evalua como False
variable = 0
if variable:
print "La condicion 1 es verdadera"
else:
print "La condicion 1 es falsa"
# Cualquier numero que no sea cero se evalua como True
variable = -10
if variable:
print "La condicion 2 es verdadera"
else:
print "La condicion 2 es falsa"
# Un str... | false |
e10ec57bd111df03b31fb9482c64fc39d5f1d0dd | thaimynguyen/Automate_Boring_Stuff_With_Python | /regrex_search.py | 1,578 | 4.25 | 4 | #! python 3.8
"""
Requirement:
_ Write a program that opens all .txt files in a folder and searches for any line that matches a user-supplied regular expression.
_ The results should be printed to the screen.
Link: https://automatetheboringstuff.com/2e/chapter9/#calibre_link-322
"""
import os, re
d... | true |
3e5075d3b68fd8d52eda91cc7c122d56951af2cb | codecherry12/Python_for_EveryBody | /AccessingFileData/filelist.py | 657 | 4.40625 | 4 | """8.4 Open the file romeo.txt and read it line by line. For each line,
split the line into a list of words using the split() method.
The program should build a list of words. For each word on each line check to see
if the word is already in the list and if not append it to the list.
When the program completes, so... | true |
d5bc47ab56ef47eb9e3997b84c58cd62437f85f6 | GitKurmax/coursera-python | /week02/task11.py | 500 | 4.1875 | 4 | # Даны координаты двух точек на плоскости, требуется определить,
# лежат ли они в одной координатной четверти или нет
# (все координаты отличны от нуля).
x1, y1, x2, y2 = int(input()), int(input()), int(input()), int(input())
if (x1 > 0 and x2 < 0) or (y1 > 0 and y2 < 0):
print("NO")
elif (x1 < 0 and x2 > 0) or (... | false |
8901f47cf34579292368352c41e9a5c0436883ce | rehan252/Axiom-Pre-Internship | /Learn-Python3-from-Scratch/05-Data-Structure/04-sets.py | 752 | 4.34375 | 4 | """
This doc provide detailed overview of sets in Python.
These are basically unordered collection of data items. Can't contain repeated values
Mutable data structures like lists or dictionaries can’t be added to a set.
However, adding a tuple is perfectly fine.
"""
# Syntax:
data_set = set()
data_set.add(5)
print(da... | true |
bb36bc53737c632b2113a43934c59f5fc461363c | rehan252/Axiom-Pre-Internship | /Learn-Python3-from-Scratch/07-Classes/01-python-classes.py | 521 | 4.40625 | 4 | """
In this Doc we'll cover all details about classes in Python.
Class Inheritance e.t.c.
"""
# start by creating a simple example of Person
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
p1 = Person("David", 25)
print(p1.name)
# let's create a new class name Te... | true |
7c8c15582d92d04bf10ec58f1886a2fe54903edf | rehan252/Axiom-Pre-Internship | /Learn-Python3-from-Scratch/01-Introduction/writing-first-code.py | 449 | 4.25 | 4 | """
This file is created for practicing Python
Print statement
"""
# printing string
print("First Lesson")
# printing integers/float
print(300)
print(102.5784)
#using format
print('Data: {}'.format(10))
# Printing Multiple Pieces of Data
print('Integer: {}\nFloat: {}\nString: {}\nList: {}'.format(120, 14.25, 'Hello... | true |
8a6f54f6ea0c18c4bfda517406ee9b30c2566f0d | c4llmeco4ch/eachDayInYear | /main.py | 1,339 | 4.6875 | 5 | #see attached jpg
'''
* @param day The day of the month we want to print
* @param month The string of the month we want to print
* i.e. "Jan"
* Given a "day" and "month", this function prints out
* The associated calendar day. So, passing 1 and "Feb"
* Prints "Feb 1st"
'''
def printDay(day, month):
ending = "... | true |
fd384b8b89d722b99c77963f49a4d35ef3402341 | ananyasaigal001/Wave-1 | /Units_Of_Time_2.py | 437 | 4.21875 | 4 | #obtaining seconds
time_seconds=input("Enter the time in seconds: ")
time_seconds=int(time_seconds)
#computing the days,hours,minutes,and seconds
days="{0:0=2d}".format(time_seconds//86400)
hours="{0:0=2d}".format((time_seconds% 86400)//3600)
time_remaining=((time_seconds% 86400)%3600)
minutes="{0:0=2d}".format(time... | true |
6d8296c395ce9da9502dfe7c3a9ca32593c98884 | aragon08/Python3-101 | /PythonOOP/metodo.py | 694 | 4.125 | 4 | #metodos
# class Matematica:
# def suma(self):
# self.n1 = 2
# self.n2 = 3
# s = Matematica()
# s.suma()
# print(s.n1 + s.n2)
#**************************************
# __init__ constructor
# class Ropa:
# def __init__(self):
# self.marca = 'willow'
# self.talla = 'M'
# ... | false |
8f257a0493eb3fd85030f0bdab42e973271ab95d | kgermeroth/Code-Challenges | /lazy-lemmings/lemmings.py | 2,027 | 4.3125 | 4 | """Lazy lemmings.
Find the farthest any single lemming needs to travel for food.
>>> furthest(3, [0, 1, 2])
0
>>> furthest(3, [2])
2
>>> furthest(3, [0])
2
>>> furthest(6, [2, 4])
2
>>> furthest(7, [0, 6])
3
>>> furthest_optimized(7, [0, 6])
3
>>> furthest_opt... | true |
4a499c580419ba601df9f6540540aa3342fcbb5b | saswat0/catalyst | /catalyst/contrib/utils/misc.py | 1,471 | 4.125 | 4 | from typing import Any, Iterable, List, Optional
from itertools import tee
def pairwise(iterable: Iterable[Any]) -> Iterable[Any]:
"""Iterate sequences by pairs.
Examples:
>>> for i in pairwise([1, 2, 5, -3]):
>>> print(i)
(1, 2)
(2, 5)
(5, -3)
Args:
i... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.