blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
52cd1781be1b9e3559cd251760212a51ffc26d98
corvolino/estudo-de-python
/Atividades-Estrutura-De-Decisao/atividade07.py
882
4.3125
4
''' Faça um Programa que leia três números e mostre o maior e o menor deles. ''' numero1 = float(input("Informe primeiro número: ")) numero2 = float(input("Informe segundo número: ")) numero3 = float(input("Informe terceiro número: ")) if numero1 > numero2 and numero1 > numero3: print("\nPrimeiro número é o maior...
false
fa1a26561714f20ce09c29bc00ab14fb1e2837a9
SelimOzel/ProjectEuler
/Problem003.py
629
4.21875
4
def FindLargestPrime(Number): primeList = [] currentPrime = 2 primeList.append(currentPrime) currentPrime = 3 primeList.append(currentPrime) while(currentPrime < Number/2): isPrime = True # Only check odd numbers currentPrime += 2 for prime in primeList: # Current prime is not prime if(currentPrim...
true
9dbecf5b08709386a86862878123c2c174d50328
SamuelFolledo/CS1.3-Core-Data-Structures-And-Algorithms
/classwork/class_activity/day8.py
377
4.3125
4
#Day 8: Hash Map # Stack coding challenge # Write a function that will reverse a string using a stack def reverse_string(text): my_stack = [] for letter in text: my_stack.append(letter) reversed_string = "" while len(my_stack) != 0: reversed_string += my_stack.pop(-1) #pop last ...
true
ab64538489331b6063316db079a915397d7085f5
tomonakar/pythonApp
/01_syntax/05_assigning_character_string.py
980
4.46875
4
# ----------------------- # # 文字列の代入 # ----------------------- # # formatメソッドでブラケットに文字列を代入出来る hoge = 'a is {}'.format('a') print(hoge) # ブラケットは複数書ける. ちなみに、引数で渡した数字は、文字列に型変換されて出力される fuga = 'a is {} {} {}'.format(1, 2, 3) print(fuga) # ブラケットには引数のインデックスを紐づけることができる foo = 'a is {0} {1} {2}'.format(1, 2, 3) print(foo) # ...
false
807577bc161b60b2a712520fa1a53290c5709240
codemobiles/cm_python_programming
/workshops/demo15.py
337
4.15625
4
# condition if-else data = 1 if data > 3 and data < 5: print("data {}".format(data)) print("data {}".format(data)) print("data {}".format(data)) elif data > 4: print("data > 4 : {}".format(data)) else: print("else data is not > 3") if True: print("a is greater than b") print("Yes") if False ...
false
2a9fc322901e7bb2a32d5a8a75b53cd813f3c00b
FluffyFu/UCSD_Algorithms_Course_1
/week4_divide_and_conquer/3_improving_quicksort/sorting.py
2,005
4.21875
4
# Uses python3 import sys import random def partition3(a, l, r): """ Partition the given array into three parts with respect to the first element. i.e. x < pivot, x == pivot and x > pivot Args: a (list) l (int): the left index of the array. r (int): the right index of the a...
true
c219e62a3d037e0a82ee047c929ca271dd575082
FluffyFu/UCSD_Algorithms_Course_1
/week3_greedy_algorithms/2_maximum_value_of_the_loot/fractional_knapsack.py
1,061
4.1875
4
# Uses python3 import sys def get_optimal_value(capacity, weights, values): """ Find the optimal value that can be stored in the knapsack. Args: capacity (int): the capacity of the knapsack. weights (list): a list of item weights. values (list): a list of item values. The order ...
true
7334abb4a4292b369af8ecbcb18980f127cbc558
FluffyFu/UCSD_Algorithms_Course_1
/week3_greedy_algorithms/5_collecting_signatures/covering_segments.py
1,115
4.3125
4
# Uses python3 import sys from collections import namedtuple Segment = namedtuple('Segment', 'start end') def optimal_points(segments): """ Given a list of intervals (defined by integers). Find the minimum number of points, such that each segment at least contains one point. Args: segments (...
true
b85f45db7324fe4acbb6beb920cd38071e01da91
FluffyFu/UCSD_Algorithms_Course_1
/week2_algorithmic_warmup/8_last_digit_of_the_sum_of_squares_of_fibonacci_numbers/fibonacci_sum_squares.py
972
4.28125
4
# Uses python3 from sys import stdin def fibonacci_sum_squares_naive(n): if n <= 1: return n previous = 0 current = 1 sum = 1 for _ in range(n - 1): previous, current = current, previous + current sum += current * current return sum % 10 def fibonacci_sum_squares(n...
true
763c4122695531a8de231f3982bdfb070097cf87
AkshayLavhagale/SW_567_HW_01
/HW_01.py
1,585
4.3125
4
""" Name - Akshay Lavhagale HW 01: Testing triangle classification The function returns a string that specifies whether the triangle is scalene, isosceles, or equilateral, and whether it is a right triangle as well. """ def classify_triangle(a, b, c): # This function will tell us whether the triangle ...
true
7aea57ebf09688bf92ff294baee88da50d8b3365
nithinsunny/Learn-Python-The-Hard-Way
/ex42.py
909
4.125
4
## Animal is a object (yes, sort of confusing) look at the extra credit class Animal (object) : pass class Dog (Animal) : def __init__ (self, name) : ## ?? self.name = name class Cat (Animal) : def __init__ (self, name) : ## ?? self.name = name class Person (object) : def __init__ (self, name) : ## ?...
false
68fba9e6b816f2a518ff3bb0947438e88ba3ac0d
cirsyou/python
/senior_maths/sorted.py
811
4.34375
4
# sorted 排序算法 # Python内置的sorted()函数就可以对list进行排序 [-21, -12, 5, 9, 36] print(sorted([36, 5, -12, 9, -21])) # sorted()函数也是一个高阶函数,它还可以接收一个key函数来实现自定义的排序,例如按绝对值大小排序 # [5, 9, -12, -21, 36] print(sorted([36, 5, -12, 9, -21], key=abs)) # 字符串排序 ['Credit', 'Zoo', 'about', 'bob'] print(sorted(['bob', 'about', 'Zoo', 'Credit'])) ...
false
7c7d3f029730d3c2a2653c367c9dbc45fb9bcd41
Mollocks/Day_at_the_py_shop
/Day1.py
435
4.28125
4
#!/usr/bin/env python3 #This is my first script :) print("Hello World!") x = "Passion fruit" y = x.upper() print(y) #Anything I want age = 49 txt = "My name is Hubert, and I am {}" print(txt.format(age)) """ This is Hubert and he is 49. You can mix strings only using the .format function """ #https://www.w3school...
true
425023cbcc7494f0825c4f9d3122603608033047
sudo-lupus666/ExerciciosPythonDesdeBasico
/Decisões - 7.py
739
4.15625
4
#Faça um Programa que leia três números e mostre o maior e o menor deles. from decimal import * def analisaNumero(): print ("**Programa - lê 3 números e devolve o maior e o menor**") def entrada(): numeros = [] sequencia = 1 while len(numeros) != 3: numero = float(input(f...
false
e963f4ada71184d06e65a39061e2923b115ef910
sudo-lupus666/ExerciciosPythonDesdeBasico
/Decisões - 6.py
781
4.15625
4
#Faça um Programa que leia três números e mostre o maior deles. from decimal import * def analisaNumero(): print ("**Programa - lê 3 números e devolve o maior**") def entrada(): numeros = [] sequencia = 1 while len(numeros) != 3: numero = float(input(f...
false
e3191a53ef5bf9d9cfb678e35d7cd4bdb75a6786
sudo-lupus666/ExerciciosPythonDesdeBasico
/Exercicio 9_aprimorar.py
653
4.21875
4
#Faça um Programa que peça a temperatura em graus Fahrenheit, transforme e mostre a temperatura em graus Celsius. #C = 5 * ((F-32) / 9). def converte_temp(): print ("**Bem-vindo ao seu software de conversão de temperaturas**") temp_fahrenheit = float(input("Insira a temperatura em Fahrenheit: ")) def con...
false
7dbde6bd929b351afb2a4ac320d44f671f7d49c2
sudo-lupus666/ExerciciosPythonDesdeBasico
/Exercicio 11.py
592
4.28125
4
#Faça um Programa que peça 2 números inteiros e um número real. Calcule e mostre: #o produto do dobro do primeiro com metade do segundo . #a soma do triplo do primeiro com o terceiro. #o terceiro elevado ao cubo. def calculo(): print('**Bem vindo ao programa de realizar cálculos matemáticos**') print('Esse pr...
false
1f90961ed1977c45cfc1fe27b548fffc01dc7fbf
rRayzer/Zoo-Keeper-App
/Zoo.py
2,616
4.15625
4
# This is a zoo class Animal: population = 0 animals = [] def __init__(self, name): self.name = name self.animals.append(name) Animal.population += 1 def get_animal_name(self): return self.name def print_animal_name(self): print "\nAnimal Name: " + self.get_animal_name() @classmethod def how_ma...
false
9470642703b3ac4a62e94276dcd3eb529b38fe31
Austin-Faulkner/Basic_General_Python_Practice
/OxfordComma.py
1,442
4.34375
4
# When writing out a list in English, one normally spearates # the items with commas. In addition, the word "and" is normally # included before the last item, unless the list only contains # one item. Consider the following four lists: # apples # apples and oranges # apples, oranges, and bananas # apples, oran...
true
fddd9b1c376193beb4097bdd0ebe7ebc9ffedf91
denisemmucha/aulas
/aula5b.py
311
4.28125
4
#uso de aspas triplas print("""Nessa aula, vamos aprender operações com String no Python. As principais operações que vamos aprender são o Fatiamento de String, Análise com len(), count(), find(), transformações com replace(), upper(), lower(), capitalize(), title(), strip(), junção com join().""")
false
7cea87bed8615753466b2cd60712e2c22ce34fb2
nurur/ReplaceFirstCharacter-R.vs.Python
/repFirstCharacter.py
613
4.53125
5
# Python script to change the case (lower or upper) of the first letter of a string # String a='circulating' print 'The string is:', a print '' #Method 1: splitting string into letters print 'Changing the first letter by splitting the string into letters' b=list(a) b[0] = b[0].upper() b=''.join(b) print b print ...
true
bd5ac9ee6116ebe863436db0dcf969b525beec5e
noahjett/Algorithmic-Number-Theory
/Algorithmic Number Theory/Binary_Exponentiation.py
2,450
4.15625
4
# Author: Noah Jett # Date: 10/1/2018 # CS 370: Algorithmic Number Theory - Prof. Shallue # This program is an implementation of the binary exponentiation algorithm to solve a problem of form a**e % n in fewer steps # I referenced our classroom discussion and the python wiki for the Math.log2 method import math...
true
8f4cb8ad08d7059e81b3633f12590bcda243ba22
mari00008/Python_Study
/Python_study/10.オブジェクト指向プログラミング/2.クラス変数とインスタンス変数.py
1,868
4.1875
4
#!/usr/bin/env python # coding: utf-8 # In[1]: #In[1] class My_class: x=100 # In[2]: #In[2] #My_classのクラス変数xを参照 print(My_class.x) # In[3]: #In[3] #クラス変数を上書きする My_class.x = 200 #Mt_classのクラス変数xを参照 print(My_class.x) # In[4]: #In[4] #My_classのインスタンスを作成 My_object = My_class() #クラス変数を参照 print(My_obje...
false
5ab6233b815d03f52bbeb5be1edce7923944eefd
mari00008/Python_Study
/Python_study/5.ループ処理と条件分岐/3.range関数による連続数字を生成.py
658
4.1875
4
#!/usr/bin/env python # coding: utf-8 # In[5]: x = (range(10)) print(x) # In[6]: x =list((range(10))) print(x) # In[7]: x = list (range(1,10,2)) print(x) # In[8]: #降順に x = list(range(10,0,-1)) print(x) # In[9]: #range(5)の要素を全て足す #すなわち1+2+3+4+5 s = sum(range(5)) print(s) # In[16]: #rangeオブジェクトから順に...
false
933ee7b8fa808a76514d2a12be8bf169a7901cf0
EvgeniyZubtsov/Python
/Homework3/Task3_1.py
249
4.25
4
string1 = 'Съешь ещё этих мягких французских булок ДА выпей же чаю' string2 = string1.split() print(string2[3].upper()) print(string2[6].lower()) print(string2[7][2]) for i in string2: print(i)
false
52b915eb36411af0506f770031379f0477c883fe
RaianePedra/CodigosPython
/MUNDO 2/DESAFIO69.py
884
4.15625
4
'''Exercício Python 69: Crie um programa que leia a idade e o sexo de várias pessoas. A cada pessoa cadastrada, o programa deverá perguntar se o usuário quer ou não continuar. No final, mostre: A) quantas pessoas tem mais de 18 anos. B) quantos homens foram cadastrados. C) quantas mulheres tem menos de 20 anos.''' t...
false
2bb71dc00d494fa3407e045b91baf6e20038de58
RaianePedra/CodigosPython
/MUNDO 1/DESAFIO1.py
742
4.125
4
print("============ CALCULADORA ===========") print("1-SOMA") n1 = int(input("Primeiro numero: ")) n2 = int(input("Segundo numero : ")) soma = n1 + n2 print("A soma de {} e {} sera: {}". format(n1, n2, soma)) """ print("\nSUBTRACAO") n1 = int(input("Primeiro numero: ")) n2 = int(input("Segundo numero: ")) sub = n1...
false
f14c4696cc8e4f2db90416bd8e4216a7319c3860
Quiver92/edX_Introduction-to-Python-Creating-Scalable-Robust-Interactive-Code
/Boolean_Operators/Task1.py
761
4.375
4
#Boolean Operators #Boolean values (True, False) # [ ] Use relational and/or arithmetic operators with the variables x and y to write: # 3 expressions that evaluate to True (i.e. x >= y) # 3 expressions that evaluate to False (i.e. x <= y) x = 84 y = 17 print(x >= y) print(x >= y and x >= y) print(x >= y or x >= y)...
true
837bebc2d9fbed6fe2ab8443f09a30bce9554478
Quiver92/edX_Introduction-to-Python-Creating-Scalable-Robust-Interactive-Code
/File_System/Task_2.py
908
4.40625
4
import os.path # [ ] Write a program that prompts the user for a file or directory name # then prints a message verifying if it exists in the current working directory dir_name = input("Please provide a file or directory name: ") if(os.path.exists(dir_name)): print("Path exists") # Test to see if it's a file o...
true
789ad69b7e081b180ca96143eeb8c4d47cfeb2a8
makfazlic/CommonAlgosAndDataStructures
/data_structures/linked_list/linked_list.py
1,211
4.28125
4
# Regular linked list # Constant complexity - insert_after, insert_before, is_empty, insert_front, delete_front, pop_front # Linear complexity - find, get_element_at, print_all class list_element: def __init__(self, v, n): self.value = v self.next = n L = None def insert_after(x, v): x.next ...
false
655bf45e09a32b1544b54c5c938b8f5430daf4e7
grimesj7913/cti110
/P3T1_AreaOfRectangles_JamesGrimes.py
733
4.34375
4
#A calculator for calculating two seperate areas of rectangles #September 11th 2018 #CTI-110 P3T1 - Areas of Rectangles #James Grimes # length1 = float(input("What is the length of the first rectangle?:")) width1 = float(input("What is the width of the first rectangle?:" )) area1 = float(length1 * width1) len...
true
78c7fb57d30e08b0c7f0808c3272769d6f2a2726
elnieto/Python-Activities
/Coprime.py
1,342
4.125
4
#Elizabeth Nieto #09/20/19 #Honor Statement: I have not given or received any unauthorized assistance \ #on this assignment. #https://youtu.be/6rhgXRIZ6OA #HW 1 Part 2 def coprime(a,b): 'takes two numbers and returns whether or not they are are coprime' #check if the numbers are divisible by 2 or if b...
true
07079cd63c24d88847a4b4c6a6749c8c2dca2abb
AbhijeetSah/BasicPython
/DemoHiererchialInheritance.py
446
4.15625
4
#hiererchial Inheritance class Shape: def setValue(self, s): self.s=s class Square(Shape): def area(self): return self.s*self.s class Circle(Shape): def area(self): return 3.14*self.s*self.s sq= Square() s= int(input("Enter the side of square ")) sq.setValue(s) print("Area of squa...
true
7bf3778c0dd682739cec943e2f9550e01a517538
itssamuelrowe/arpya
/session5/names_loop.py
577
4.84375
5
# 0 1 2 3 names = [ "Arpya Roy", "Samuel Rowe", "Sreem Chowdhary", "Ayushmann Khurrana" ] for name in names: print(name) """ When you give a collection to a for loop, what Python does is create an iterator for the collection. So what is an iterator? In the context of a for loop, a...
true
3b32018a5f493a622d5aee4bd979813c15c7c86c
vanderzj/IT3038C
/Python/nameage.py
819
4.15625
4
import time start_time = time.time() #gets user's name and age print('What is your name?') myName = input() print('Hello ' + myName + '. That is a good name. How old are you?') myAge = input() #Gives different responses based on the user's age. if myAge < 13: print("Learning young, that's good.") elif myAge == 1...
true
b598c4d34d7f60ad2a821efaed87e47d7ed16781
vanderzj/IT3038C
/Python/TKinter_Practice/buttons.py
1,002
4.53125
5
# Imports tkinter, which is a built-in Python module used to make GUIs. from tkinter import * # Creates the window that the content of our script will sit in. win = Tk() # This function is being set up to give the button below functionality with the (command=) arguement. # The Command function should be written as (c...
true
1f030e2f733874480af9f92425566e9f593dfe34
ledbagholberton/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/0-add_integer.py
605
4.375
4
#!/usr/bin/python3 def add_integer(a, b=98): """ Function that summ two numbers integer or float. Args: a: First parameter (integer or float) b: Second paramenter (integer of float) Returns: Summ of a & b """ if a is None or (type(a) is not int and type(a)...
true
4cc00acd4bd2bee59ea68225a1dc97950e11a48c
JhonataAugust0/Python
/Estruturas/Estruturas_compostas/Tuplas_e_listas/Validador lógico de expressões matemáticas.py
1,783
4.28125
4
print("Bem vindo ao validador lógico de expressões matemáticas.") chave = [] expressão= str(input("Digite a expressão desejada:\n")).strip().upper()# while expressão[0] not in '{': expressão= str(input("Digite a expressão inicializando com uma chave:\n")).strip().upper()# for simb1 in expressão: if simb1[0] == ...
false
2eab5dbb4d15a4f53eda4de61087cd7b908cdf5e
JhonataAugust0/Python
/Estruturas/Estruturas_compostas/Tuplas_e_listas/Tuplas.py
1,132
4.4375
4
#tuplas são variáveis compostas onde podemos adicionar vários valores de uma só vez e realizar várias coisas com eles palavras = ('aprender', 'programar') # Acima, acabamos de declarar uma tupla for p in palavras: print(f"\nNa palavra {p.upper()} temos ", end='') for letra in p: if letra.lower() in 'ae...
false
5b82dd7f7e00b9ed2a8ee39e194384eb32ccc3f0
green-fox-academy/MartonG11
/week-02/day-1/mile_to_km_converter.py
273
4.4375
4
# Write a program that asks for an integer that is a distance in kilometers, # then it converts that value to miles and prints it km = float(input('Put a kilometer to convert to miles: ')) factor = 0.621371192 miles = km * factor print("The distance in miles is: ", miles)
true
cc328013864be876f42b1b7c25117bc3ffcccb4a
green-fox-academy/MartonG11
/week-02/day-2/swap_elements.py
250
4.34375
4
# - Create a variable named `abc` # with the following content: `["first", "second", "third"]` # - Swap the first and the third element of `abc` abc = ["first", "second", "third"] def swap(x): x[0] , x[2] = x[2] , x[0] print(x) swap(abc)
true
210519003481bc2545f6a2dfeab8c81ec67df223
green-fox-academy/MartonG11
/week-03/day-3/rainbow_box_function.py
767
4.1875
4
from tkinter import * root = Tk() canvas = Canvas(root, width='300', height='300') canvas.pack() # create a square drawing function that takes 2 parameters: # the square size, and the fill color, # and draws a square of that size and color to the center of the canvas. # create a loop that fills the canvas with rainb...
true
7369d96e116c26b27ba9ce9877f358699f022c77
green-fox-academy/MartonG11
/week-06 - python/word_reverser.py
256
4.21875
4
def reverse(text): reverseWord = " " make_list = text.split() for word in make_list: word = word[::-1] reverseWord = reverseWord + word + " " return reverseWord.strip() print(reverse("lleW ,enod taht saw ton taht drah"))
false
8b6d39bb03692cc8ff81dbfdd62d59ed51b3629f
green-fox-academy/MartonG11
/week-03/day-3/center_box_function.py
535
4.34375
4
from tkinter import * root = Tk() canvas = Canvas(root, width='300', height='300') canvas.pack() # create a square drawing function that takes 1 parameter: # the square size # and draws a square of that size to the center of the canvas. # draw 3 squares with that function. size1 = 130 size2 = 100 size3 = 50 def dr...
true
b500ce44e4652624e0b5f94e19da756ad190e217
hkscy/algorithms
/Miscellaneous Algorithms/Palindrome Checker/palindrome.py
2,216
4.25
4
# Chris Hicks 2020 # # Based on Microsoft Technical Interview question: # "Given a string, write an algorithm that will determine if it is a palindrome" # Input: string of characters, Output: True (palindrome) False (palindrome) # # What is a palindrome? # - A sequence of characters which reads the same backward as ...
true
f4891c92ba34699fe80a9d71f66a6ae13c39a75f
JosueOb/Taller1
/Ejercicios/Ejercicio4-6.py
1,577
4.15625
4
from tkinter import * root = Tk() v = IntVar() Label(root, text="""Choose a programming language:""", justify = LEFT, padx = 20).pack() Radiobutton(root, text="Python", padx = 20, variable=v, value=1).pack(anchor=W) Radiobutton(root, text="Perl", ...
true
9c1fdcb0cabca9e2ac660cba53bc54f1205dd022
Znigneering/BioinformaticTurtorial
/Pyfiles/03-14/locating_restriction_sites.py
752
4.125
4
#!usr/pyhton/env pyhton3 def find_reverse_palindrome(seq): result = '' for x in range(0,len(seq)-1): pair = 0 while is_reseverse(seq[x-pair],seq[x+1+pair]) and pair < 6: pair += 1 if pair != 1: result += str(x+2-pair)+' '+str(pair*2)+' \n' if ...
false
bffba3eb19fd92bfed2563216c3d7478a8b92fed
LitianZhou/Intro_Python
/ass_4.py
2,635
4.15625
4
# Part 1 while True: RATE = 1.03 while True: print("--------------------------------------") start_tuition = float(input("Please type in the starting tuition: ")) if start_tuition <= 25000 and start_tuition >= 5000: break else: print("The starting tuition ...
true
1de705bec799a785ad37393373fa289e0c3a18bc
manohiro/diveintocode-term0
/03-02-python-set.py
1,354
4.21875
4
course_dict = { 'AIコース': {'Aさん', 'Cさん', 'Dさん'}, 'Railsコース': {'Bさん', 'Cさん', 'Eさん'}, 'Railsチュートリアルコース': {'Gさん', 'Fさん', 'Eさん'}, 'JS': {'Aさん', 'Gさん', 'Hさん'}, } def find_person(want_to_find_person): """ 受講生がどのコースに在籍しているかを出力する。 まずはフローチャートを書いて、どのようにアルゴリズムを解いていくか考えてみましょう。 """ # ここにコードを書いてみ...
false
cd9812c4bce5cf9755e99f06cc75db716499f0e1
edek437/LPHW
/uy2.py
876
4.125
4
# understanding yield part 2 from random import sample def get_data(): """Return 3 random ints beetween 0 and 9""" return sample(range(10),3) def consume(): """Displays a running average across lists of integers sent to it""" running_sum=0 data_items_seen=0 while True: data=yield ...
true
3cdbde7f1435ef0fc65ab69b325fed08e1136216
cakmakok/pygorithms
/string_rotation.py
209
4.15625
4
def is_substring(word1, word2): return (word2 in word1) or (word1 in word2) def string_rotation(word1, word2): return is_substring(word2*2,word1) print(string_rotation("waterbottle","erbottlewat"))
true
df61bd0ca36e962e134772f6d7d50200c7a3a7aa
phuongnguyen-ucb/LearnPythonTheHardWay
/battleship.py
2,320
4.34375
4
from random import randint board = [] # Create a 5x5 board by making a list of 5 "0" and repeat it 5 times: for element in range(5): board.append(["O"] * 5) # To print each outer list of a big list. 1 outer list = 1 row: def print_board(board): for row in board: print " ".join(row) # to concatenate a...
true
ac4ecdf8ffd9532f0254c6d848ba74a886122ed8
mvoecks/CSCI5448
/OO Project 2/Source Code/Feline.py
2,173
4.125
4
import abc from Animal import Animal from roamBehaviorAbstract import climbTree from roamBehaviorAbstract import randomAction ''' The roaming behavior for Felines can either be to climb a tree or to do a random action. Therefore we create two roamBehaviorAbstract variables, climbTree and randomAction that we ...
true
83424e65bc9b7240d3ff929a22884e2ebef578d3
asvkarthick/LearnPython
/GUI/tkinter/tkinter-label-02.py
620
4.25
4
#!/usr/bin/python3 # Author: Karthick Kumaran <asvkarthick@gmail.com> # Simple GUI Program with just a window and a label import tkinter as tk from tkinter import ttk # Create instance win = tk.Tk() # Set the title for the window win.title("Python GUI with a label") # Add a label label = ttk.Label(win, text = "Labe...
true
ee3acb288c29099d6336e9d5fd0b7a54f71573fe
asvkarthick/LearnPython
/02-function/function-05.py
218
4.125
4
#!/usr/bin/python # Author: Karthick Kumaran <asvkarthick@gmail.com> # Function with variable number of arguments def print_args(*args): if len(args): for i in args: print(i); else: print('No arguments passed') print_args(1, 2, 3)
true
8fa01eb2322cd9c2d82e043aedd950a408c46901
optionalg/challenges-leetcode-interesting
/degree-of-an-array/test.py
2,851
4.15625
4
#!/usr/bin/env python ##------------------------------------------------------------------- ## @copyright 2017 brain.dennyzhang.com ## Licensed under MIT ## https://www.dennyzhang.com/wp-content/mit_license.txt ## ## File: test.py ## Author : Denny <http://brain.dennyzhang.com/contact> ## Tags: ## Description: ## ...
true
e24f2c5e5688efbfc9a8e1c041765efc22fa0cc0
optionalg/challenges-leetcode-interesting
/reverse-words-in-a-string/test.py
1,323
4.28125
4
#!/usr/bin/env python ##------------------------------------------------------------------- ## @copyright 2017 brain.dennyzhang.com ## Licensed under MIT ## https://www.dennyzhang.com/wp-content/mit_license.txt ## ## File: test.py ## Author : Denny <http://brain.dennyzhang.com/contact> ## Tags: ## Description: ## ...
true
37cc4a21931e88c5558809dfb756e01e01a92d10
brianpeterson28/Princeton_Python_SWD
/bep_exercises/chapter1.2/contcompinterest/contcompinterest.py
2,227
4.3125
4
''' Author: Brian Peterson | https://github.com/brianpeterson28 Creative Exercise 1.2.21 - Intro to Programming In Python ''' import math import decimal print("Calculates Future Value @ Continuously Compounded Rate.") def askForInterestRate(): while True: try: interestrate = float(input("Enter interest rate: ")...
true
1ad1c2566f099d2de4736fcc5b7f7fbbf30a7bb2
Savinagowda1307/MuchineLearning-Assignments
/multiple.py
640
4.125
4
#MULTIPLE INHERITANCE-----It involves more than one parent class ####MULTIPLE INHERITANCE class Parent: def func1(self,name,salary): self.name=name self.salary=salary print("My name is :"+self.name+" my salary is :"+str(self.salary)+" and my age is :"+str(d.age)) class P...
false
ad8dd825f3f56a5773b4d0bb79f27a3738c13533
crishabhkumar/Python-Learning
/Assignments/Trailing Zeroes.py
299
4.15625
4
#find and return number of trailing 0s in n factorial #without calculation n factorial n = int(input("Please enter a number:")) def trailingZeros2(n): result = 0 power = 5 while(n >= power): result += n // power power *= 5 return result print(trailingZeros2(n))
true
60f2c7a1930e69268bd41975cc3778e545ee9100
sudhansom/python_sda
/python_fundamentals/10-functions/functions-exercise-01.py
306
4.3125
4
# write a function that returns the biggest of all the three given numbers def max_of_three(a, b, c): if a > b: if a > c: return a else: return c else: if b > c: return b else: return c print(max_of_three(3, 7, 3))
true
10f075ee5aff42884240b0a5070d649d3c71d972
sudhansom/python_sda
/python_fundamentals/06-basic-string-operations/strings-exercise.py
420
4.21875
4
# assigning a string value to a string of length more than 10 letters string = "hello" reminder = len(string) % 2 print(reminder) number_of_letters = 2 middle_index = int(len(string)/2) start_index = middle_index - number_of_letters end_index = middle_index + number_of_letters + reminder result = string[start_index:end...
true
8a21cc7dc1f16ae2715479dbc875d4c5e0696f6a
sudhansom/python_sda
/python_fundamentals/00-python-HomePractice/w3resource/conditions-statements-loops/problem43.py
386
4.28125
4
""" Write a Python program to create the multiplication table (from 1 to 10) of a number. Go to the editor Expected Output: Input a number: 6 6 x 1 = 6 6 x 2 = 12 6 x 3 = 18 6 x 4 = 24 6 x 5 = 30 6 x 6 = 36 6 x 7 = 42 6 x 8 = 48 6 x 9 = 54 6 x 10 = 60 """ user_input = int(input("Enter the number: ").strip()) for i in...
true
8c8ba8bbd6230a3c045971542159acb1ef584596
dlu270/A-First-Look-at-Iteration
/Problem 3-DL.py
683
4.65625
5
#Daniel Lu #08/08/2020 #This program asks the user for the number of sides of a shape, the length of sides and the color. It then draws the shape and colors it. import turtle wn = turtle.Screen() bob = turtle.Turtle() sides = input ("What are the number of sides of the polygon?: ") length = input ("What i...
true
7ab66c17162421433ec712ebb1bbad0c0afbdd0b
Dianajarenga/PythonClass
/PythonClass/student.py
1,075
4.59375
5
class Student: school="Akirachix" #to create a class use a class keyword #start the class name with a capital letter.if it has more than one letter capitalize each word #do not include spaces #many modules in a directory form a package #when you save your code oin a .py file its called a module #to import a class f...
true
5c0bea2dcc1dfd238969953082c83fa1f7db10a7
errorswan/lianxi
/10_cut_list.py
1,171
4.40625
4
''' 4.4切片练习 ''' ''' 4-10 切片 ''' # 列表前三元素 pizzas = ['new york', 'chicago', 'california', 'pan', 'thick'] list = pizzas[:3] print("The first three items in the list are:") print(list) # 列表中间三元素 pizzas = ['new york', 'chicago', 'california', 'pan', 'thick'] list = pizzas[1:4] print("Three items from the middle of the li...
false
6096598f70d386090efba0a31f1be8a6a483a39e
johnashu/Various-Sorting-and-SEarching-Algorithms
/search/interpolation.py
1,970
4.1875
4
""" Interpolation search is an improved variant of binary search. This search algorithm works on the probing position of the required value. For this algorithm to work properly, the data collection should be in a sorted form and equally distributed. Binary search has a huge advantage of time complexity over linear sea...
true
11a2948ed09d97d32565e20dcb6ef0f7158a879f
zosopick/mawpy
/Chapters 1 to 5/Chapter 1/1-5 Turtle spiral.py
498
4.28125
4
''' Excersise 1-5: Turtle spiral Make a funciton to draw 60 squares, turning 5 degrees after each square and making each successive square bigger. Start at a length of 5 and increment 5 units every square. ''' from turtle import * shape('turtle') speed(10) length=5 def turtle_spiral(): length=5...
true
2e432eac8fbcb96bdd568ac0ebb83f08761bc912
zosopick/mawpy
/Chapters 1 to 5/Chapter 5/Exercise__5_1_A_spin_cycle/Exercise__5_1_A_spin_cycle.pyde
771
4.1875
4
''' Exercise 5-1: A spin cycle Create a circle of equilateral triangles in a processing sketch and rotate them using the rotate() function ''' t=0 def setup(): size(1000,1000) rectMode(CORNERS) #This keeps the squares rotating around the center #also, one can use CORNER or...
true
bf73c880b2704f1ef37080e4bb18ef0777d6ff5a
vighneshdeepweb/Turtle-corona
/Turtle-Covid/covid.py
676
4.125
4
import turtle #create a screen screen = turtle.Screen() #create a drawer for drawing drawer = turtle.Turtle() #Set the background color of the screen screen.bgcolor("black") #For set a Background,color,speed,pensize and color of the drawer drawer.pencolor("darkgreen") drawer.pensize(3) drawer1 = 0 dr...
true
4ba65c35155b48a53f93cf15fd65dde01ca12f05
ahmetihsankaya/week3
/1st set/3.4.4.6.py
482
4.125
4
exam_mark=float(input("What is the exam mark?\n")) print("The exam mark of %s corresponds to following grade:" %exam_mark) if exam_mark<40: print("F3") elif exam_mark>=40 and exam_mark<45: print("F2") elif exam_mark>=45 and exam_mark<50: print("F1 Supp") elif exam_mark>=50 and exam_mark<60: print("Third...
false
d10975f40f51444b69afcee04b30a0347faf0da5
veldc/basics
/labs/02_basic_datatypes/02_04_temp.py
402
4.34375
4
''' Fahrenheit to Celsius: Write the necessary code to read a degree in Fahrenheit from the console then convert it to Celsius and print it to the console. C = (F - 32) * (5 / 9) Output should read like - "81.32 degrees fahrenheit = 27.4 degrees celsius" ''' Farh = float(input("Enter degree Farh: ")) Celsius ...
true
776fa8276987922284cac8b4a28c8e974242f0ee
veldc/basics
/labs/02_basic_datatypes/02_05_convert.py
799
4.40625
4
''' Demonstrate how to: 1) Convert an int to a float 2) Convert a float to an int 3) Perform floor division using a float and an int. 4) Use two user inputted values to perform multiplication. Take note of what information is lost when some conversions take place. ''' # int to float Num = 8 Div ...
true
764e49079883e2419c2ed66de6d3b883f3074b10
VanessaVanG/number_game
/racecar.py
1,536
4.3125
4
'''OK, let's combine everything we've done so far into one challenge! First, create a class named RaceCar. In the __init__ for the class, take arguments for color and fuel_remaining. Be sure to set these as attributes on the instance. Also, use setattr to take any other keyword arguments that come in.''' class RaceC...
true
8a09fdfe492076ea41aeed7aa25ff058e7a5a945
anuragk1991/python-basics
/comprehension.py
1,097
4.1875
4
nums = [1,2,3,4,5,6,7,8,9] print(nums) print('List comprehension') my_list = [n for n in nums] print(my_list) print('') print('Create list from another list (n*n) using list map and lambda function') my_list = map(lambda n: n*n, nums) print(my_list) print('') print('Create list from another list (n*n) using list co...
false
30288a48048f82daf25da88ed697364d86d0fc4d
OliverTarrant17/CMEECourseWork
/Week2/Code/basic_io.py
1,589
4.21875
4
#! usr/bin/python """Author - Oliver Tarrant This file gives the example code for opening a file for reading using python. Then the code writes a new file called testout.txt which is the output of 1-100 and saves this file in Sandbox folder (see below). Finally the code gives an example of storing objects for later u...
true
e80b0d4d97c6cce390144e17307a65a7fb0cced1
DroidFreak32/PythonLab
/p13.py
2,590
4.75
5
# p13.py """ Design a class named Account that contains: * A private int data field named id for the account. * A private float data field named balance for the account. * A private float data field named annualInterestRate that stores the current interest rate. * A constructor that creates an account with the specifie...
true
650c23952ab2978697916954ed04761ed800330c
DroidFreak32/PythonLab
/p09.py
592
4.1875
4
# p09.py ''' Consider two strings, String1 and String2 and display the merged_string as output. The merged_string should be the capital letters from both the strings in the order they appear. Sample Input: String1: I Like C String2: Mary Likes Python Merged_string should be ILCMLP ''' String1=input("Enter string 1:") ...
true
79988e9e8f075938284c7f277809625a445adf5d
anmalch/python
/lesson_3_4_2.py
1,350
4.21875
4
''' Программа принимает действительное положительное число x и целое отрицательное число y. Необходимо выполнить возведение числа x в степень y. Задание необходимо реализовать в виде функции my_func(x, y). При решении задания необходимо обойтись без встроенной функции возведения числа в степень. Подсказка: попробу...
false
64e179dae3eada5e76890da5c412dacddab81a1e
TenckHitomi/turtle-racing
/racing_project.py
2,391
4.3125
4
import turtle import time import random WIDTH, HEIGHT = 500, 500 COLORS = ['red', 'green', 'blue', 'orange', 'yellow', 'black', 'purple', 'pink', 'brown', 'cyan'] def get_number_of_racers(): """Input number of turtles you want to show up on the screen""" racers = 0 while True: racers = input("Ent...
true
f5c0aa56ad89771487550747ea9edaa2656c0e0a
carlshan/design-and-analysis-of-algorithms-part-1
/coursework/week2/quicksort.py
1,554
4.28125
4
def choose_pivot(array, length): return array[0], 0 def swap(array, i, j): temp = array[i] array[i] = array[j] array[j] = temp def partition(array, low, high): pivot = array[low] i, j = low + 1, high - 1 # initializes i to be first position after pivot and j to be last index while True...
true
7c885c274f4103db153970a6ce1476cf415c790e
Mkaif-Agb/Python_3
/zip.py
398
4.46875
4
first_name = ["Jack", "Tom", "Dwayne"] last_name = ["Ryan","Holland", "Johnson"] name = zip(first_name,last_name) for a,b in name: print(a,b) def pallindrome(): while True: string=input("Enter the string or number you want to check") if string == string[::-1]: print("It is a pallin...
true
a5a5af705de9e836d2af930740fd54fce3d2e042
romataukin/geekbrains
/les_01/1.py
229
4.15625
4
1. name = input('Введите имя: ') 2. surname = input('Введите фамилию: ') 3. age = input('Введите Ваш возраст: ') 4. print('Привет,', name, surname) 5. print('Возраст: ', age)
false
0af9c97699b04830aa12069d4258c5725f8f0c35
sheriline/python
/D11/Activities/friend.py
562
4.21875
4
""" Elijah Make a program that filters a list of strings and returns a dictionary with your friends and foes respectively. If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not... Output = { "Ryan":"friend", "Kieran":"foe", "Jason":"foe",...
true
030162330c0295f35315dd1d90a688b293a39759
sheriline/python
/D1 D2/ifstatement.py
731
4.3125
4
#!/usr/bin/env python3.7 #example # gender = input("Gender? ") # if gender == "male" or gender == "Male": # print("Your cat is male") # else: # print("Your cat is female") # age = int(input("Age of your cat? ")) # if age < 5: # print("Your cat is young.") # else: # print("Your cat is adult.") #exerci...
true
464ddc137e89538fd0a5cc63b58bfc837bdf06c5
scotttct/tamuk
/Python/Python_Abs_Begin/Mod3_Conditionals/3_5_Math_3.py
787
4.59375
5
# Task 3 # PROJECT: IMPROVED MULTIPLYING CALCULATOR FUNCTION # putting together conditionals, input casting and math # update the multiply() function to multiply or divide # single parameter is operator with arguments of * or / operator # default operator is "*" (multiply) # return the result of multiplication or divis...
true
a8f769fc11e575144fed429fd57165f9b318ee36
scotttct/tamuk
/Python/Python_Abs_Begin/Mod4_Nested/4_3-7_1-While_True.py
1,132
4.1875
4
# Task 1 # WHILE TRUE # [ ] Program: Get a name forever ...or until done # create variable, familar_name, and assign it an empty string ("") # use while True: # ask for user input for familar_name (common name friends/family use) # keep asking until given a non-blank/non-space alphabetical name is received (Hint: Boole...
true
a2d480068f763e0465022ea3ed208a4b4889ac4a
scotttct/tamuk
/Homework/Homework1.py
1,702
4.53125
5
# Write a program that prints the numbers from 1 to 100. # But for multiples of three print “Fizz” instead of the number # and for the multiples of five print “Buzz”. # For numbers which are multiples of both three and five print “FizzBuzz”." # for i in range(0, 101): # print(i) # print() # for t in range(0, ...
true
9f5ab86e2e150066f02dacc8d1c35defabc1115f
scotttct/tamuk
/Python/Python_Abs_Begin/Mod1/p1_2.py
280
4.125
4
# examples of printing strings with single and double quotes # print('strings go in single') # print("or double quotes") # printing an Integer with python: No quotes in integers/numbers print(299) # printing a string made of Integer (number) characters with python print("2017")
true
ec67d5050211e27b595231fa5f5f3ae31011b821
palaciosdiego/pythoniseasy
/src/fizzBuzzAssignment.py
630
4.15625
4
def isPrime(number): # prime number is always greater than 1 if number > 1: for i in range(2, number): if (number % i) == 0: return False # break else: return True # if the entered number is less than or equal to 1 # then it is not ...
true
fbfd74756c1efd103b8958b594b2f876f9ed4876
arefrazavi/spark_stack
/spark_sql/select_teenagers_sql.py
1,769
4.15625
4
from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession, Row def convert_to_sql_row(line): row = line.split(',') return Row(id=int(row[0]), name=str(row[1]), age=int(row[2]), friends_count=int(row[3])) if __name__ == '__main__': sc_conf = SparkConf().setMaster('local[*]').setA...
true
b3defea1bcb2f421c1d0ba8b54faf7f4a659ea43
EmersonPaul/MIT-OCW-Assignments
/Ps4/ps4a.py
1,929
4.34375
4
# Problem Set 4A # Name: <your name here> # Collaborators: # Time Spent: x:xx def get_permutations(sequence): ''' Enumerate all permutations of a given string sequence (string): an arbitrary string to permute. Assume that it is a non-empty string. You MUST use recursion for this par...
true
ee37314201ebeace70e328eabf38777faedfd212
dairof7/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/5-text_indentation.py
641
4.15625
4
#!/usr/bin/python3 """ Module text_indentation module to ident a text print a text """ def text_indentation(text): """this functions print a text insert newline where find a ".", "?", ":" """ if type(text) != str or text is None: raise TypeError("text must be a string") sw = 0 for i in...
true
e8ac9faefb389204d9bd193a0ba7e54b92498712
shikechen/LearnPython
/01_calculate_exchange_rate/calculate_exchange_rate.py
741
4.125
4
""" Author: shikechen Function: Convert RMB or USD according to a given exchange rate Version: 1.0 Date: 2018/12/24 """ rem_currency = 6.95 input_value = input("Please input money(Exit if input Q):") i = 0 while input_value != 'Q': i = i + 1 unit_value = input_value[-3:] digit_value = in...
false
bb3c1324e8def64fbfddcfcba51d48ce526b40ae
PriyanjaniCh/Python
/henderson_method.py
2,980
4.3125
4
#!/usr/bin/python3 # Purpose: To implement the Henderson method # Execution: One argument for start number can be passed # # William F. Henderson III was a brilliant computer scientist who was taken from us all too soon. He had trouble falling asleep # because there were too many thoughts running through his...
true
7d8c224017d69a62bd0c8183aa8b7dc13c79e211
AlanRdgz/Mision_03
/Boletos.py
1,160
4.125
4
# Autor: Alan Giovanni Rodriguez Camacho A01748185 # Descripcion: Total a pagar de cierto numero de boletos para zonas distintas. def numeroBoletosA(a):#Te da el costo total dependiendo del numero de boletos de etsa zona atotal=a*3250 return atotal def numeroBoletosB(b):#Te da el costo total dependiendo del n...
false
f390a60a44262785efe169930db6f56cba694885
hyperlearningai/introduction-to-python
/examples/my-first-project/myutils/collections/listutils.py
982
4.15625
4
#!/usr/bin/env python3 """Collection of useful tools for working with list objects. This module demonstrates the creation and usage of modules in Python. The documentation standard for modules is to provide a docstring at the top of the module script file. This docstring consists of a one-line summary followed by a mo...
true
67b83a8e4af2f594e3f7e1e50f12588fd68ffad2
SuchFNS/kettering
/cs191/dailyThings/ICA_0730_22.py
703
4.4375
4
print('List of months: January, February, March, April, May, June, July, August, September, October, November, December') month = input('Input a month: ') if (month.upper() == 'JANUARY' or month.upper() == 'MARCH' or month.upper() == 'MAY' or month.upper() == 'JULY' or month.upper() == 'AUGUST' or month.upper() == '...
false
b752e89398d424ec93433eb14083f898431ce8bd
mcp292/INF502
/src/midterm/2a.py
726
4.4375
4
''' Approach: I knew I had to run a for loop it range of the entered number to print the asterisks. The hard part was converting user input to a list of integers. I found out a good use for list comprehension, which made the code a one liner. ''' nums = input("Enter 5 comma separated numbers between 1 and 20: ").spl...
true
c7443de044ebc3149c37b398ee230d21ca784bee
johnnymango/IS211_Assignment1
/assignment1_part1.py
1,969
4.4375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """Assignment 1 - Part 1""" def listDivide(numbers=[], divide=2): """ The function returns the number of elements in the numbers list that are divisible by divide. Args: numbers(list): a list of numbers divide (int, default=2): the number by w...
true