blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
580c275bc2bd3394aae13f831d36e0b588bc2024
MariomcgeeArt/CS2.1-sorting_algorithms-
/iterative_sorting2.py
2,069
4.34375
4
#funtion returns weather items are sorted or not boolean #creating the function and passing in items def is_sorted(items): # setting variable copy to equal items copy = items[:] #calling sort method on copy copy.sort() # if copy is equal to items it returns true return copy == items def bubble...
true
b40a434cf49126560b59272992e223eed3b78d22
ppfenninger/ToolBox-WordFrequency
/frequency.py
1,918
4.21875
4
""" Analyzes the word frequencies in a book downloaded from Project Gutenberg """ import string from pickle import load, dump def getWordList(fileName): """ Takes raw data from project Gutenberg and cuts out the introduction and bottom part It also tranfers the entire text to lowercase and removes punctuation ...
true
c127da0e7bf2078aa65dfcbec441b1c6dd6e7328
Habibur-Rahman0927/1_months_Python_Crouse
/Python All Day Work/05-05-2021 Days Work/Task_2_error_exception.py
2,582
4.34375
4
# Python Error and Exception Handling """ try: your code except: message """ # try: # with open('test.txt', mode='r') as open_file: # openFlie = open_file.read() # print(data) # except: # print("File is not found") # print('Hello, its working') """ try: you...
true
ebc54a6955ebe113dad58dd0eed16b3caff2ce89
Habibur-Rahman0927/1_months_Python_Crouse
/HackerRank problem solving/problem_no_6.py
1,101
4.21875
4
def leapYears(years): leap = False if(years%400 == 0): leap = True elif years%4 == 0 and years%100 != 0: leap = True return leap years = int(input()) print(leapYears(years)) """ years = int(input()) if (years%4 == 0): if(years%100 == 0): if(years%400 == 0): ...
false
c5c77da3e67eacdc6c02fa2f052ae89c508cd743
FalseG0d/PythonGUIDev
/Sample.py
236
4.125
4
from tkinter import * root=Tk() #To create a Window label=Label(root,text="Hello World") #To create text on label and connect it to root label.pack() #to put it on root root.mainloop() #To avoid closing until close button is clicked
true
18c9cc619d5e44504665132e9fad5315a8b44799
pjkellysf/Python-Examples
/backwards.py
960
4.78125
5
#!/usr/local/bin/python3 # Patrick Kelly # September 29, 2015 # Write a program that prints out its own command line arguments, but in reverse order. # Note: The arguments passed in through the CLI (Command Line Interface) are stored in sys.argv. # Assumption: The first item argument in sys.argv is the filename and sh...
true
0c0115b670926748b7df837e063d0953a16199b1
Bryanx/exercises
/Python/Fibonacci copy.py
289
4.15625
4
def fibonacci(x): x -= 2 f = [0, 1] if x < 0: return[0] elif x < 1: return f else: for i in range(x): f.append(f[len(f) - 2] + f[len(f) - 1]) return f print(fibonacci(int(input("Enter the amount of Fibonacci numbers:\n"))))
false
d8f1f90bcf7d84a8a52a5055ab3f4850de1d4a77
lykketrolle/Noroff_NIS2016
/TAP 4/TAP04-sets[4].py
2,083
4.75
5
#!/usr/bin/python """ Name: Kjell Chr. Larsen Date: 24.05.2017 Make two different set with fruits, copy the one set in to the other and compare the two sets for equality and difference. """ print("This program will have two sets of fruits. One will then be copied,\n" "into the other, then a comparison...
true
9fb5404d86596e822da14852d181caedd240edf2
georgiedignan/she_codes_python
/Session3/Exercises/while_loops.py
947
4.21875
4
#Exerise 1 # number = input("Please guess any number: ") # while number != "": # number = input("Please guess any number: ") #Exercise 2 number = int(input("Please enter a number: ")) #using a for loop # for num in range(1,number+1): # if num%2!=0: # print(num) #try using a while loop i=1 while (i...
false
810a9ba68bf4e22c888a6b530265e7be8fbc457d
Amantini1997/FromUbuntu
/Sem 2/MLE/Week 2 - Decision Tree & Boosting/regression.py
1,658
4.375
4
# regression.py # parsons/2017-2-05 # # A simple example using regression. # # This illustrates both using the linear regression implmentation that is # built into scikit-learn and the function to create a regression problem. # # Code is based on: # # http://scikit-learn.org/stable/auto_examples/linear_model/plot_ols.h...
true
98a0b26efc09b461a8ac2e815e8785d866cf7707
greatwallgoogle/Learnings
/other/learn_python_the_hard_way/ex34.py
883
4.4375
4
# ex34 : 访问列表元素 # 常用函数 # 声明列表:[] # 索引法访问元素: list[index] # 删除某个元素:del(list[index]) # 列表元素反向:list.reverse() # 追加元素:list.append(ele) animals = ['dog','pig','tiger','bear',3,4,5,6] print("animals :",animals) # 索引法访问列表中的值 dog = animals[0] print("animals first ele:", dog) # 使用方括号的形式截取列表 list2 = animals[1:5] #从索引为1的地方开始,读...
false
4ed2d4ef6171647b08629409ec77b488d059bc6f
greatwallgoogle/Learnings
/other/learn_python_the_hard_way/ex9.py
975
4.21875
4
# 打印,打印,打印 days = "Mon Tue Wed Thu Fri Sat Sun" # 第一中方法:将一个字符串扩展成多行 months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJuly\nAug" print("Here are the days :",days) # 等价于 print("Here are the days : %s" % days) print("Here are the months : ", months) #等价于 print("Here are the months : %s" % months) # 第二种方法:使用三引号输出任意行的字符串 pri...
true
a73adc9082e54df28f0db2a9b93496e2f1bcd5ff
thekayode/area_of_shapes
/area_of_triangle _assignment.py
993
4.40625
4
''' This programme is too calculate the area of a triangle. ''' base = float(input('Enter the base of the triangle\n')) height = float(input('Enter the height of the the triangle\n')) area = 1/2 * (base * height) print('area', '=', area) ''' This programme is too calculate the area of a square. ''' length =...
true
b1869818de65a93e61f1fc9cf4320396c09ca8bc
oct0f1sh/cs-diagnostic-duncan-macdonald
/functions.py
760
4.21875
4
# Solution for problem 8 def fibonacci_iterative(num = 10): previous = 1 precedingPrevious = 0 for number in range(0,num): fibonacci = (previous + precedingPrevious) print(fibonacci) precedingPrevious = previous previous = fibonacci # Solution for problem 9 # I don't know...
true
18db5e61c29a777be3bd163202dce195042b6878
dianamorenosa/Python_Fall2019
/ATcontent.py
487
4.125
4
#!/usr/bin/python #1.- Asign the sequence to a variable #2.- Count how many A's are in the sequence #3.- Count how many T's are in the sequence #4.- Sum the number of A's and the number of T's #5.- Print the sum of A's and T's seq1= ("ACTGATCGATTACGTATAGTATTTGCTATCATACATATATATCGATGCGTTCAT") #Asign the sequence to the...
true
a3037b8de00a8552d355fb5e45a15c6dc0743b77
rsingla92/advent_of_code_2017
/day_3/part_1.py
2,422
4.15625
4
''' You come across an experimental new kind of memory stored on an infinite two-dimensional grid. Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few squares are allocated like this: 17 16 15 14 13 18 ...
true
23241e4ba4dadda493f44610e334ff1dfa533d82
Algorant/HackerRank
/Python/string_validators/string_validators.py
586
4.125
4
# You are given a string . Your task is to find out if the string contains: # alphanumeric characters, alphabetical characters, digits, lowercase # and uppercase characters. if __name__ == '__main__': s = input() # any() checks for anything true, will iterate through all tests # Check for alphanumerics print(an...
true
aa361a509b9cb245ecbf9448f4df5279cfc078c6
Algorant/HackerRank
/Python/reduce/reduce.py
557
4.25
4
''' Given list of n pairs of rational numbers, use reduce to return the product of each pair of numbers as numerator/denominator fraction by every fraction in list n. ''' # some of this code is supplied to user from fractions import Fraction from functools import reduce def product(fracs): t = reduce(lambda x, y...
true
f6b7564f728de2663ab87128b71fd4280236772a
Algorant/HackerRank
/Python/set_add/set_add.py
204
4.25
4
''' Given an integer and a list of items as input, use set.add function to count the number of unique items in the set. ''' n = int(input()) s = set() for i in range(n): s.add(input()) print(len(s))
true
91df05bb5905d70cc260c414ec0f4ba2bcaf3d88
Algorant/HackerRank
/30_days_of_code/d25_running_time_and_complexity/running_time.py
1,020
4.1875
4
''' Given list of integers of length T, separated by /n, check if that number is prime and return "Prime" or "Not Prime" for that integer. ''' # This was first attempt. Naive approach that works but fails 2 test cases # due to timeout! (Too slow) # def ptest(T): # # Make sure greater than 1 # if T > 1: # ...
true
996bb5aa753930626a1a6a45d930437dd015c850
Algorant/HackerRank
/Python/findall_finditer/find.py
482
4.21875
4
''' Given a string S, consisting of alphanumeric characters, spaces, and symbols, find all the substrings of S that contain 2 or more vowels. The substrings should lie between 2 consonants and should contain vowels only. ''' import re vowels = 'aeiou' consonants = 'bcdfghjklmnpqrstvwxyz' regex = '(?<=[' + consonants...
true
0e984975c0d8fb572a673166385a48c9ed14ae7d
JohnErnestBonanno/Turtles
/TurtleExplo.py
634
4.15625
4
#https://www.youtube.com/watch?v=JQPUS1nv5F8&t=970s #Import Statement import turtle my_turtle = turtle.Turtle() #set speed my_turtle.speed(2) """ distance = 100 #move turtle in a square #def square(distance): for x in range(0,4): my_turtle.fd(distance) my_turtle.rt(90) my_turtle.circle(100) my_turtle.stamp...
false
a4012048e689d6739943728336d07414c7540b0b
luccaplima/estudandoPython
/variaveis.py
2,488
4.71875
5
#estudando variaveis python """ python não necessita de um comando para declarar a variavel uma variavel é criada no momento que um valor é associado a ela uma variavel não precisa ser declarada como um tipo particular e seu tipo pode ser trocado posteriormente O nome de uma variável em python pode ser curto (co...
false
97128f21e73b655557a2dee31dc5610b40b6011a
coding-with-fun/Python-Lectures
/Lec 7/Types of UDF.py
2,476
4.875
5
# Function Arguments: # 1) Required arguments # 2) Keyword arguments # 3) Default arguments # 4) Variable-length arguments # 5) Dictionary arguments # 1) Required arguments: # Required arguments are the arguments passed to a function in correct positional order. # Here, t...
true
fd8100771d5b5e688a470de173dfe3331facc3a1
guntursandjaya/GunturSandjaya_ITP2017_Exercise
/5-6 Stages of life.py
317
4.15625
4
age = input("Insert age : ") age = int(age) if age<2: print("The person is a baby") elif age>=2 and age<4: print("The person is a kid") elif age>=13 and age<20: print("The person is a teenager") elif age>=20 and age<65: print("The person is a adult") elif age>65: print("The person is an elder")
false
0bdd0d5acbe261113fe3ff023be27216a3aad75b
rfpoulos/python-exercises
/1.31.18/blastoff.py
287
4.125
4
import time numbers = int(raw_input("How many numbers should we count down?: ")) text = raw_input("What should we say when we finish out countdown?: ") for i in range(0, numbers + 1): if numbers - i == 0: print text else: print numbers - i time.sleep(1)
true
a2acc5778a677f03e5474f25b9750224c509b316
rfpoulos/python-exercises
/1.30.18/name.py
509
4.5
4
first_name = raw_input('What is your first name? ') last_name = raw_input('%s! What is your last name? ' % first_name) full_name = '%s %s' % (first_name, last_name) print full_name #Below is a qualitative analysis if first_name == 'Rachel': print "That's a great name!" elif first_name == 'Rachael': print "Th...
true
f47fd9998823803e0b731023430aa0d226b12ca0
ssahussai/Python-control-flow
/exercises/exercise-5.py
824
4.34375
4
# exercise-05 Fibonacci sequence for first 50 terms # Write the code that: # 1. Calculates and prints the first 50 terms of the fibonacci sequence. # 2. Print each term and number as follows: # term: 0 / number: 0 # term: 1 / number: 1 # term: 2 / number: 1 # term: 3 / number: 2 # term: 4 / nu...
true
d4a4dd99e068910c239d94119bac23744e7e0e8b
AIHackerTest/xinweixu1_Py101-004
/Chap0/project/ex36_number_guess.py
1,899
4.34375
4
#ex 36 # The task of this exercise is to design a number guessing game. import random goal = random.randint(1, 20) n = 10 print ("Please enter an integer from 0 to 20." ) print ("And you have 10 chances to guess the correct number.") guess = int(input ('> ')) while n != 0: if guess == goal: print ("Yes,...
true
fa69a550806f7cfcbf2fd6d02cbdf443a9e48622
lepperson2000/CSP
/1.3/1.3.7/LEpperson137.py
1,231
4.3125
4
import matplotlib.pyplot as plt import random def days(): '''function explanation: the print will be of the 'MTWRFSS' in front of 'day' and the print will include the 5-7 days of September ''' for day in 'MTWRFSS': print(day + 'day') for day in range(5,8): print('It is the ' + str(...
true
8860a1eb440ef0f1249875bc5a97a5157bf0c258
ShamanicWisdom/Basic-Python-3
/Simple_If_Else_Calculator.py
2,753
4.4375
4
# IF-ELSE simple two-argument calculator. def addition(): try: first_value = float(input("Input the first value: ")) second_value = float(input("Input the second value: ")) result = first_value + second_value # %g will ignore trailing zeroes. print("\nResult of %.5g + %.5g is...
true
c6cbfb6a8c91fedba94151405a0e6e064a9cf7dd
pradeep-sukhwani/reverse_multiples
/multiples_in_reserve_order.py
581
4.25
4
# Design an efficient program that prints out, in reverse order, every multiple # of 7 that is between 1 and 300. Extend the program to other multiples and number # ranges. Write the program in any programming language of your choice. def number(): multiple_number = int(raw_input("Enter the Multiple Number: ...
true
b2825f7313f3834263cc59e8dd49cf3e11d2a86a
AdityaLad/python
/python-projects/src/root/frameworks/ClassCar.py
550
4.125
4
''' Created on Sep 11, 2014 @author: lada the only purpose of init method is to initialize instance variables ''' ''' def __init__(self, name="Honda", *args, **kwargs): self.name = name ''' class Car: #constructor def __init__(self, name="Honda"): self.name = name ...
true
b673a44965d31b1cb410c1e64fcdae7b466dad3b
alexxa/Python_for_beginners_on_skillfeed_com
/ch_03_conditionals.py
723
4.28125
4
#!/usr/bin/python #AUTHOR: alexxa #DATE: 18.12.2013 #SOURSE: https://www.skillfeed.com/courses/539-python-for-beginners #PURPOSE: Conditionals. a,b = 0,1 if a == b: print(True) if not a == b: print(False) if a != b: print('Not equal') if a > b: print('Greater') if a >= b: print('Gre...
false
ee43a116e8951757f34048101d50a6e43c4eea49
wentao75/pytutorial
/05.data/sets.py
653
4.15625
4
# 堆(Sets)是一个有不重复项组成的无序集合 # 这个数据结构的主要作用用于验证是否包含有指定的成员和消除重复条目 # 堆对象还支持如:并,交,差,对称差等操作 # 可以使用大括号或set()方法来产生堆对象,不要使用{}来产生空的堆对象 # {}会产生一个空的字典而不是堆对象 basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'} print(basket) 'orange' in basket 'crabgrass' in basket a = set('abracadabra') b = set('alacazam') a b a - b b ...
false
6cbfc9e2bd18f1181041287a56317200b1b789a8
DaehanHong/Principles-of-Computing-Part-2-
/Principles of Computing (Part 2)/Week7/Practice ActivityRecursionSolution5.py
925
4.46875
4
""" Example of a recursive function that inserts the character 'x' between all adjacent pairs of characters in a string """ def insert_x(my_string): """ Takes a string my_string and add the character 'x' between all pairs of adjacent characters in my_string Returns a string """ if le...
true
87f5557c82320e63816047943679b70effe5aecf
DaehanHong/Principles-of-Computing-Part-2-
/Principles of Computing (Part 2)/Week6/Inheritance2.py
437
4.25
4
""" Simple example of using inheritance. """ class Base: """ Simple base class. """ def __init__(self, num): self._number = num def __str__(self): """ Return human readable string. """ return str(self._number) class Sub(Base): ...
true
9f045af90875eea13a4954d2a22a8089fd07724a
Thuhaa/PythonClass
/28-July/if_else_b.py
713
4.21875
4
marks = int(input("Enter the marks: ")) # Enter the marks # Between 0 and 30 == F # Between 31 and 40 == D # Between 41 and 50 == C # Between 51 and 60 == B # Above 61 == A # True and True == True # True and False == False # False and False == False # True or True == True # True or False == True # False an...
true
4e6708d3b8109a6fb5082eb4efb5d0590309f71a
yestodorrow/dataAnalysis
/firstCourse/hello.py
1,252
4.125
4
print("Hello Python") # 交互界面窗口 输入输出交互式 # 编写和调试程序 # 语法词汇高亮显示 # 创建、编辑程序文件 print("hello world") a=3 # 定时器 import time time.sleep(3) a=4 print(a) print(a) # 标量对象 # init 整数 # float 实数 16.0 # bool 布尔 True False # NoneType 空类型 x="this is liu Gang" y="he is a handsome boy" print(x+","+y) #变量 #赋值语句 x,y="liugang","very ha...
false
137638cb6c3ee7cd32d6d183e2bc898e1a2c8bd1
marczakkordian/python_code_me_training
/04_functions_homework/10.py
1,605
4.125
4
# Stwórz grę wisielec “bez wisielca”. # Komputer losuje wyraz z dostępnej w programie listy wyrazów. # Wyświetla zamaskowany wyraz z widoczną liczbą znaków (np. ‘- - - - - - -‘) # Użytkownik podaje literę. # Sprawdź, czy litera istnieje w wyrazie. Jeśli tak, wyświetl mu komunikat: # “Trafione!” oraz napis ze znanymi li...
false
6795c4e6e07de121d7dce93da430830b71f0cb3e
akoschnitzki/Module-4
/branching-Lab 4.py
884
4.375
4
# A time traveler has suddenly appeared in your classroom! # Create a variable representing the traveler's # year of origin (e.g., year = 2000) # and greet our strange visitor with a different message # if he is from the distant past (before 1900), # the present era (1900-2020) or from the far future (beyond 2020). y...
true
53303f7123bbd2c1b2f8c07d9002bae85f3cb81a
TrevAnd1/Sudoku-Puzzle-Solver
/Sudoku/Sudoku Puzzle Solver.py
1,725
4.15625
4
import pygame import random from pygame.locals import ( K_1, K_2, K_3, K_4, K_5, K_6, K_7, K_8, K_9, K_RIGHT, K_LEFT, K_UP, K_DOWN, K_KP_ENTER, K_ESCAPE, KEYDOWN, QUIT, ) WHITE = (0,0,0) SCREEN_WIDTH = 1000 SCREEN_HEIGHT = ...
false
55ab453d18e2b12b64378fd70fc3843ec169eb29
Deepak10995/node_react_ds_and_algo
/assignments/week03/day1-2.py
901
4.4375
4
''' Assignments 1)Write a Python program to sort (ascending and descending) a dictionary by value. [use sorted()] 2)Write a Python program to combine two dictionary adding values for common keys. d1 = {'a': 100, 'b': 200, 'c':300} d2 = {'a': 300, 'b': 200, 'd':400} Sample output: Counter({'a': 400, 'b': 400, 'd': 400,...
true
24f3091c067759e7cde9222bfb761a777da668df
Deepak10995/node_react_ds_and_algo
/coding-challenges/week06/day-1.py
2,263
4.28125
4
''' CC: 1)Implement Queue Using a linked list ''' #solution class Node: def __init__(self, data): self.data = data self.next = None class Queue: def __init__(self): self.head = None self.last = None def enqueue(self, data): if self.last is None: self.he...
true
a729758b2b951b8c38983b7dd5336c8f36f933da
DajkaCsaba/PythonBasic
/4.py
293
4.53125
5
#4. Write a Python program which accepts the radius of a circle from the user and compute the area. Go to the editor #Sample Output : #r = 1.1 #Area = 3.8013271108436504 from math import pi r = float(input("Input the radius of the circle: ")) print("r = "+str(r)) print("Area = "+str(pi*r**2))
true
3de713f7ca2f61358268815be48dbe7a217db2ee
wojtbauer/Python_challenges
/Problem_2.py
865
4.125
4
#Question 2 # Write a program which can compute the factorial of a given numbers. # The results should be printed in a comma-separated sequence on a single line. # Suppose the following input is supplied to the program: # 8 # Then, the output should be: # 40320 # Factorial = int(input("Wpisz liczbę: ")) # wynik = 1 #...
true
8473a7a874e1bf2435049301d45064ecefe4f45d
jackiehluo/projects
/numbers/fibonacci-sequence.py
209
4.1875
4
from math import sqrt def fibonacci(n): return ((1 + sqrt(5)) ** n - (1 - sqrt(5)) ** n) / (2 ** n * sqrt(5)) n = int(raw_input("Enter a digit n for the nth Fibonacci number: ")) print int(fibonacci(n))
false
c5b87a3edc367f76c12b0fa2734ee8deafa4b965
jcbain/fun_side_projects
/unique_digits/unique_digits.py
1,948
4.1875
4
from collections import Counter def separate_digits(val): """ separate the digits of a number in a list of its digits Parameters ----- val : int number to separate out Returns ----- list a list of ints of the digits that make up val """ return [int(x) for x in str(...
true
802480d75cc45bb911de93e28e8e830b743b4db6
Mattx2k1/Notes-for-basics
/Basics.py
2,087
4.6875
5
# Hello World print("Hello World") print() # Drawing a shape # Programming is just giving the computer a set of instructions print(" /!") print(" / !") print(" / !") print("/___!") print() # console is where we have a little window into what our program is doing # Pyton is looking at these instructions line ...
true
cdd823dbe94b600742ba2158e50f516446aba57e
Mattx2k1/Notes-for-basics
/Try Except.py
1,072
4.53125
5
# Try Except # Catching errors # Anticipate errors and handle them when they occur. That way errors don't bring our program to a crashing halt number = int(input("Enter a number: ")) print(number) # if you enter a non number, it will cause the program to crash. So you need to be able to handle the exceptions # Try e...
true
0896dad37cd3b5d93a60fb30672ccd902fcdc337
Mattx2k1/Notes-for-basics
/Guessing Game.py
564
4.25
4
# guessing game # start with the variables secret_word = "giraffe" guess = "" guess_count = 0 guess_limit = 3 out_of_guesses = False # use a while loop to continually guess the word until they get it correct # added in the "and not" condition, and new variables to create a limit on guesses while guess != secret_wor...
true
5284bda9251b8da6fe08e0c44d2721e87738e3ad
samsonwang/ToyPython
/PlayGround/26TicTacToe/draw_pattern.py
1,813
4.34375
4
#! /usr/bin/python3.6 ''' Tic Tac Toe Draw https://www.practicepython.org/exercise/2015/11/26/27-tic-tac-toe-draw.html - For this exercise, assume that player 1 (the first player to move) will always be X and player 2 (the second player) will always be O. - Notice how in the example I gave coordinates for where I wan...
true
5521559091299b2af7b6c72fa20cea4dcffe9a03
arun-p12/project-euler
/p0001_p0050/p0025.py
1,056
4.125
4
''' In a Fibonacci series 1, 1, 2, 3, 5, 8, ... the first 2-digit number (13) is the 7th term. Likewise the first 3-digit number (144) is the 12th term. What is the index of the first term in the Fibonacci sequence to contain 1000 digits? ''' def n_digit_fibonacci(number): digits = 1 fibonacci = [1, 1] whil...
true
154cf1ad66e4d8fab9b523676935b615ef831d3d
arun-p12/project-euler
/p0001_p0050/p0038.py
2,093
4.125
4
''' 192 x 1 = 192 ; 192 x 2 = 384 ; 192 x 3 576 str(192) + str(384) + str(576) = '192384576' which is a 1-9 pandigital number. What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (2, ... , n) digits? Essentially n > 1 to rule out 918273645 (formed by...
true
4cbef49ee1fd1c6b4a15eae4d2dee12be49475a8
arun-p12/project-euler
/p0001_p0050/p0017.py
2,376
4.125
4
''' If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? Ignore spaces ''' def number_letter_count(number=1000): ...
true
c891fec31546ed93374bc833e0bb4870c7e3e188
rmrodge/python_practice
/format_floating_point_in_string.py
800
4.4375
4
# Floating point number is required in programming for generating fractional numbers, # and sometimes it requires formatting the floating-point number for programming purposes. # There are many ways to exist in python to format the floating-point number. # String formatting and string interpolation are used in the f...
true
b82b3928481d538244ec70a34fecb0b7ed761f3c
Jeff-ust/D002-2019
/L2/L2Q6v1.py
1,387
4.375
4
#L2 Q6: Banana Guessing game #Step 1: Import necessary modules import random #Step 2: Welcome Message print('''Welcome to the Banana Guessing Game Dave hid some bananas. Your task is to find out the number of bananas he hid.''') #Step 3: Choose a random number between 1-100 n = random.randint(1,100) print ("s...
true
70ca08346178f87b3e7afae3e746481369cba82a
shuhsienhsu/X-Village-DS-Exercise
/bonus3.py
746
4.1875
4
def insertion_sort(list): for i in range(1, len(list)): for j in range(i): j = i - j - 1 if(list[j] > list[j + 1]): temp = list[j] list[j] = list[j + 1] list[j + 1] = temp else: break def bubble_sort(list): ...
false
fbf0406858a0b3cdb529472d4642b2acea5fa3d2
shouryacool/StringSlicing.py
/02_ strings Slicing.py
820
4.34375
4
# greeting="Good Morning," # name="Harry" # print(type(name)) # # Concatining Two Strings # c=greeting+name # print(c) name="HarryIsGood" # Performing Slicing print(name[0:3]) print(name [:5]) #is Same as [0:4] print(name [:4]) #is Same as [0:4] print(name [0:]) #is Same as [0:4] print(name [-5:-1]) # is ...
true
d8f89c6f971a5378300db593da07310ed7dfa31d
AlexanderIvanofff/Python-OOP
/defending classes/programmer.py
2,311
4.375
4
# Create a class called Programmer. Upon initialization it should receive name (string), language (string), # skills (integer). The class should have two methods: # - watch_course(course_name, language, skills_earned) # o If the programmer's language is the equal to the one on the course increase his skills with the...
true
6847b974bfa860f4dcec26f502a5b7c6c307e7e8
learn-co-curriculum/cssi-4.8-subway-functions-lab
/subway_functions.py
1,870
4.625
5
# A subway story # You hop on the subway at Union Square. As you are waiting for the train you # take a look at the subway map. The map is about 21 inches wide and 35 inches # tall. Let's write a function to return the area of the map: def map_size(width, height): map_area = width * height return "The map is %...
true
1c832205ec93dc322ab47ed90c339a9d81441282
nyu-cds/asn264_assignment3
/product_spark.py
590
4.1875
4
''' Aditi Nair May 7 2017 Assignment 3, Problem 2 This program creates an RDD containing the numbers from 1 to 1000, and then uses the fold method and mul operator to multiply them all together. ''' from pyspark import SparkContext from operator import mul def main(): #Create instance of SparkContext sc = Spark...
true
66e9c916b7ea5908c091f4fd5a7a5e2821efd3de
shawsuraj/dailyCode
/100-days-of-code/python/Day006/combination.py
270
4.15625
4
print ("Combination finder.") n = int(input("Enter n: ")) r = int(iinput("Enter r: ")) def factorial ( n ): result = 1 for num in range ( 1 , n + 1 ): result *= num return result print (factorial( n ) // factorial( r ) // factorial( n - r ))
false
9723db9bc6f9d411d0ae62f525c33a410af9f529
george-ognyanov-kolev/Learn-Python-Hard-Way
/44.ex44.py
981
4.15625
4
#inheritance vs composition print('1. Actions on the child imply an action on the parent.\n') class Parent1(object): def implicit(self): print('PARENT implicit()') class Child1(Parent1): pass dad1 = Parent1() son1 = Child1() dad1.implicit() son1.implicit() print('2. Actions on the child overr...
true
e5663cb79ea48d897aacc4350443c713dee27d5e
jejakobsen/IN1910
/week1/e4.py
773
4.15625
4
""" Write a function factorize that takes in an integer $n$, and returns the prime-factorization of that number as a list. For example factorize(18) should return [2, 3, 3] and factorize(23) should return [23], because 23 is a prime. Test your function by factorizing a 6-digit number. """ def get_primes(n): numb...
true
8e1f774d2d8748ae9f0a7707208ebf6e77ca8f7a
Yousab/parallel-bubble-sort-mpi
/bubble_sort.py
981
4.1875
4
import numpy as np import time #Bubble sort algorithm def bubble_sort(nums): # We set swapped to True so the loop looks runs at least once swapped = True while swapped: swapped = False for i in range(len(nums) - 1): if nums[i] > nums[i + 1]: # Swap the elements ...
true
232896bfb010b367fdc7bbfc0c51b56d32208a1b
Amruthglr/PythonPrograms
/Day1/Program2.py
338
4.4375
4
age = int(input("Enter your AGE: ")) if age > 18 : print("You are eligible to vote") print("vote for your favourite candidate") else: print("You still need to wait for {} years".format(18-age)) # Another way to write if age < 18: print(f"You nedd still wait for {18-age} years") else: print("your e...
false
0791a754b6620486dd07026672d3e27dd533da7f
helpmoeny/pythoncode
/Python_labs/lab09/warmup1.py
2,104
4.34375
4
## ## Demonstrate some of the operations of the Deck and Card classes ## import cards # Seed the random number generator to a specific value so every execution # of the program uses the same sequence of random numbers (for testing). import random random.seed( 25 ) # Create a deck of cards my_deck = cards.Deck() ...
true
2a5d3eb589bb0c4591382bf90700987406ff372d
julia-ediamond/python
/recap.py
728
4.34375
4
fruits = ["banana", "apple", "cherry"] print(fruits[-1]) fruits.append("pineapple") print(fruits) fruits.pop(0) print(fruits) digits = [1, 2, 3] decimal = [1, 2, 3] nested = [[1, 2, 3], ["hello"]] for item in fruits: print(item) for item in nested: print(item) for i in item: print(i) people = [ ...
false
4983ce5f51d32706025dead611acdbfdea92594c
Ramtrap/lpthw
/ex16.py
1,284
4.125
4
from sys import argv print "ex16.py\n" script, filename = argv print "We're going to erase %r." % filename print "If you don't want that, hit CTRL-C (^C)." print "If you do want that, hit RETURN." raw_input("?") print "Opening the file..." target = open(filename, 'w') print "Truncating the file. G...
true
f441e2ebbcff6098d0a3e752550f770eb13ed708
brunolomba/exercicios_logica
/banco_itau_funcao.py
2,645
4.34375
4
# 341 - ITAU # Tamanha da Agência - 4 dígitos # Tamanha da conta - 5 dígitos # Exemplo: # Agência: 2545 # Conta: 023661 # Para Obter o DV, multiplica-se cada número da Agência e Conta em sua ordenação. Sequências PAR multiplica-se por 1 e ÍMPARES por 2. Se o número encontrado for maior que 9, soma-se as unidades da d...
false
8d38d519cc851e7e8203fcf9d057d6f2404fe07a
maxlauhi/cspy3
/1_7_2_mu_rec.py
246
4.40625
4
"""determine whether a number is odd or even by mutual recursion""" def is_even(n): if n == 0: return True else: return is_odd(n-1) def is_odd(n): if n == 0: return False else: return is_even(n-1)
false
ef3e1712df8cf28034c6ab2fc8d3fd46b4683783
shivsun/pythonappsources
/Exercises/Integers/accessing elements in the list with messages.py
1,294
4.4375
4
# -*- coding: utf-8 -*- """ Created on Sat Apr 25 21:09:17 2020 @author: bpoli """ #Accessing Elements in a List #Lists are ordered collections, so you can access any element in a list by #telling Python the position, or index, of the item desired. To access an element #in a list, write the name of the list followed...
true
71fcf1b193e8f96abba78167d65180f062ca59a8
9car/IN1000-1
/oblig5/regnefunksjon.py
1,523
4.15625
4
def addisjon(tall1, tall2): tall1 = int(tall1) tall2 = int(tall2) # Regner ut summen av to tall return tall1 + tall2 print(addisjon(2, 9)) def subtraksjon(tall1, tall2): tall1 = int(tall1) tall2 = int(tall2) # Regner ut differansen return tall1 - tall2 assert subtraksjon(15, 10) ==...
false
0b111a4e7f476a46248db5680d9c0ab9d1aebc1d
miffymon/Python-Learning
/ex06.py
1,210
4.40625
4
#Python function pulls the value although its not announced anywhere else #string in a string 1 x = "There are %d types of people." % 10 #naming variable binary = "binary" #naming variable do_not = "don't" #assigning sentence to variable and calling other assigned variables #string in a string 2 y = "Those who know %...
true
f533dddb9e2ba1ecb1d1a7b0a4a6ceb20976d022
ferisso/phytonexercises
/exercise7.py
893
4.21875
4
# Question: # Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in the i-th row and j-th column of the array should be i*j. # Note: i=0,1.., X-1; j=0,1,¡­Y-1. # Example # Suppose the following inputs are given to the program: # 3,5 # Then, the output of the progra...
true
88b7c2b539778c54e9ba2072c44b163fda95e785
fis-jogos/2016-2
/python-101/06 funções.py
739
4.3125
4
# Definimos uma função que calcula a soma de todos os números pares até um # certo valor def soma_pares(x): y = 0 S = 0 while y <= x: S += y y += 2 return y # Agora podemos chamar nossa função e recuperar o valor passado para o "return" valor = soma_pares(100) print('A soma de to...
false
e9f846f5464649428ec8b7a6cdadc76cde91bd2f
sajjad0057/Practice-Python
/DS and Algorithm/Algorithmic_Tools/Devide-n-Conquer/marge_sort.py
1,092
4.15625
4
def marge_sort(a,b): marged_list = [] len_a , len_b = len(a),len(b) index_a, index_b = 0,0 #print(f'index_a , index_b = {index_a} , {index_b}') while index_a<len_a and index_b<len(b): if a[index_a]<b[index_b]: marged_list.append(a[index_a]) index_a +=1 ...
false
5cf93df98db5fb6fe7444fffbbd1fa79559607cd
lavalio/ChamplainVRSpecialist-PythonAlgorithms
/Week4/Class1/Homework.py
1,080
4.25
4
#Create a list of numbers, randomly assigned. #Scan the list and display several values:The minimum, the maximum, count and average #Don`t use the “min”, “max”, “len ” and “sum” functions #1. Len : gives the number of elements in array. #2. Min, max: Gives the highest highestor lowest number in the array. #3. Sum: A...
true
f36cb9863dd96dbf1dfebcc837c8aec18de33967
LXXJONGEUN/Graduation_Project
/web/crypto/RSA2.py
1,398
4.125
4
def gcd(a, b): while b!=0: a, b = b, a%b return a def encrypt(pk, plaintext): key, n = pk cipher = [(ord(char) ** key) % n for char in plaintext] return cipher def decrypt(pk, ciphertext): key, n = pk plain = [chr((char ** key) % n) for char in ciphertext] return ''.join(plain)...
false
e8cf2f63f38c417981c670689bbb649ccb1f296d
annikaslund/python_practice
/python-fundamentals/04-number_compare/number_compare.py
301
4.15625
4
def number_compare(num1, num2): """ takes in two numbers and returns a string indicating how the numbers compare to each other. """ if num1 > num2: return "First is greater" elif num2 > num1: return "Second is greater" else: return "Numbers are equal"
true
91e08c304bdf2dcade4f00ad513711d7cadde116
annikaslund/python_practice
/python-fundamentals/18-sum_even_values/sum_even_values.py
235
4.15625
4
def sum_even_values(li): """ sums even values in list and returns sum """ total = 0 for num in li: if num % 2 == 0: total += num return total # return sum([num for num in li if num % 2 == 0])
true
4a5ffb428059845f0761201c602942bb964f0e55
19doughertyjoseph/josephdougherty-python
/TurtleProject/Turtle Project.py
939
4.125
4
import turtle turtle.setup(width=750, height=750) pen = turtle.Pen() pen.speed(200) black_color = (0.0, 0.0, 0.0) white_color = (1.0, 1.0, 1.0) red_color = (1.0, 0.0, 0.0) green_color = (0.0, 1.0, 0.0) blue_color = (0.0, 0.0, 1.0) def basicLine(): moveTo(-50, 0) pen.forward(100) #The origin on the screen ...
true
0ed3044556e7faa1464a480dbe0550b2a22e20c5
leobyeon/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-append_write.py
360
4.28125
4
#!/usr/bin/python3 def append_write(filename="", text=""): """ appends a string at the end of a text file and returns the number of chars added """ charCount = 0 with open(filename, "a+", encoding="utf-8") as myFile: for i in text: charCount += 1 myFile.write(i) ...
true
828a52fcf979bb4c8dc3793babbfcf41a71efa2b
Nipuncp/lyceaum
/lpthw/ex3.py
479
4.25
4
print ("I'll now count my chickens") print ("Hens:", 25 +30 / 6) print ("Roosters", 100-25 *3%4) print ("I'll now count the eggs:") print (3 +2 + 1 - 5 + 4 % 2-1 % 4 + 6) print ("Is it true that 3 + 2 < 5 - 7") print (3 + 2 < 5 -7) print ("What is 3 + 2", 3 + 2) print ("What is 5 - 7", 5 - 7) print ("THat is why, it is...
true
fefe99ae80decc1c40885d81430a651ddbcd3541
anupam-newgen/my-python-doodling
/calculator.py
281
4.15625
4
print('Add 2 with 2 = ', (2 + 2)) print('Subtract 2 from 2 = ', (2 - 2)) print('Multiply 2 with 2 = ', (2 * 2)) print('2 raise to the power 2 = ', (2 ** 2)) print('2 divide by 2 = ', (2 / 2)) # This is a comment. # You can use above concept to solve complex equations as well.
true
1fec6ac5c98bcac8bff0fc97d37cf7846021a0b8
MathBosco/exPython
/Ex014.py
293
4.375
4
#Enunciado: # Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit. celsius = float(input('Insira a temperatura em grau Celsius: ')) fahrenheit = (celsius * 9/5) + 32 print('A temperatura em Fahrenheit é: {} °F'.format(fahrenheit))
false
4df2e2270df04452ca0403b08547f2bebad70504
selva86/python
/exercises/concept/guidos-gorgeous-lasagna/.meta/exemplar.py
1,640
4.28125
4
# time the lasagna should be in the oven according to the cookbook. EXPECTED_BAKE_TIME = 40 PREPARATION_TIME = 2 def bake_time_remaining(elapsed_bake_time): """Calculate the bake time remaining. :param elapsed_bake_time: int baking time already elapsed :return: int remaining bake time (in minutes) derived ...
true
0a7def488ed51a9d0b3e3a1a5ccc8a29efa89a23
selva86/python
/exercises/concept/little-sisters-vocab/.meta/exemplar.py
1,648
4.3125
4
def add_prefix_un(word): """ :param word: str of a root word :return: str of root word with un prefix This function takes `word` as a parameter and returns a new word with an 'un' prefix. """ return 'un' + word def make_word_groups(vocab_words): """ :param vocab_words: list of...
true
c2f079ea8d6387e8b64395e0d45271c9c00ee2e6
douglasmsi/sourcePython
/par.py
319
4.125
4
#!/usr/bin/python3 #!/usr/bin/python3 #Ler numero e verificar se ele e par ou impar # e adicionar ele em uma lista com o Resultado #[2, 'par'] #[3,'impar'] # entrada = int(input('Numero: ')) lista = [] if (entrada%2) == 0: lista.insert(0,[entrada,'Par']) else: lista.insert(0,[entrada,'Impar']) print(lista)
false
3db5a554acc92051d4ec7a544a4c922fcad49309
PradipH31/Python-Crash-Course
/Chapter_9_Classes/C2_Inheritance.py
1,094
4.5625
5
#!./ENV/bin/python # ---------------------------------------------------------------- # Inheritance class Car(): """Class for a car""" def __init__(self, model, year): """Initialize the car""" self.model = model self.year = year def get_desc_name(self): """Get the descrip...
true
c684cf0f8d15e4e684b2668eaf0bfadd8b30306a
PradipH31/Python-Crash-Course
/Chapter_9_Classes/C1_Book.py
959
4.4375
4
#!./ENV/bin/python # ---------------------------------------------------------------- # # Classes class Book(): """Class for a book""" def __init__(self, name, year): """Initialize the book with name and year""" self.name = name self.year = year def get_name(self): """Ret...
true
3b2023ce61bfa403f7d4f4b340e54b2140614026
yulya2787/python_advanced
/less2/#2.py
1,011
4.21875
4
'''Создать класс магазина. Конструктор должен инициализировать значения: «Название магазина» и «Количество проданных товаров». Реализовать методы объекта, которые будут увеличивать кол-во проданных товаров, и реализовать вывод значения переменной класса, которая будет хранить общее количество товаров проданных всеми ма...
false
9a76041b4f7465fc6061ed4ee3efb65899a258db
alexugalek/tasks_solved_via_python
/HW1/upper_lower_symbols.py
374
4.46875
4
# Task - Count all Upper latin chars and Lower latin chars in the string test_string = input('Enter string: ') lower_chars = upper_chars = 0 for char in test_string: if 'a' <= char <= 'z': lower_chars += 1 elif 'A' <= char <= 'Z': upper_chars += 1 print(f'Numbers of lower chars is: {lower_chars}...
true
fea598032ae2a1c7676e6b0286d2fae1362bdfa3
alexugalek/tasks_solved_via_python
/HW1/task_5.py
418
4.40625
4
def add_binary(a, b): """Instructions Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition. The binary number returned should be a string. """ return bin(a + b)[2:] if __name__ == '__main__': a = ...
true
6889e39e73935e704d91c750b3a13edb36133afc
alexugalek/tasks_solved_via_python
/HW1/task_23.py
1,327
4.4375
4
def longest_slide_down(pyramid): """Instructions Imagine that you have a pyramid built of numbers, like this one here: 3 7 4 2 4 6 8 5 9 3 Here comes the task... Let's say that the 'slide down' is a sum of consecutive numbers from the top to the bottom of the pyramid. As ...
true
acdcddc6a6e17466c36f1ad4ca46efd015689153
alexugalek/tasks_solved_via_python
/HW1/task_53.py
750
4.125
4
def longest_palindromic(a): """The longest palindromic""" result = '' for i in range(len(a)): for j in range(i, len(a)): tmp_val = a[i:j + 1:1] if tmp_val == tmp_val[::-1] and len(a[i:j + 1:1]) > len(result): result = a[i:j + 1:1] return result if __name...
false
a5306511c39e1a2bd0e3077f86df25e6e47f2dc6
firozsujan/pythonBasics
/Lists.py
1,629
4.1875
4
# Task 9 # HakarRank # Lists # https://www.hackerrank.com/challenges/python-lists/problem def proceessStatement(insertStatement, list): if insertStatement[0] == 'insert': return insert(insertStatement, list) elif insertStatement[0] == 'print': return printList(insertStatement, list) elif insertStatement...
true
86b3488e679b6e34d43d0be6e219a6f01761b3e1
firozsujan/pythonBasics
/StringFormatting.py
655
4.125
4
# Task # HackerRank # String Formatting # https://www.hackerrank.com/challenges/python-string-formatting/problem def print_formatted(number): width = len(bin(number)[1:]) printString = '' for i in range(1, number+1): for base in 'doXb': if base == 'd': width = len(bin(nu...
true
ce7a7f3362652f37bbec4c976a02310a007e9c3d
vinikuttan/smallcodes
/dict_normalizer.py
1,275
4.125
4
#!/usr/bin/python __author__ = 'vineesh' def merge_nested_dict(mydict): """ flattening nested dict """ if isinstance(mydict, dict): result = mydict.copy() for each in mydict: if isinstance(mydict[each], dict): result[each] = mydict[each].keys() ...
false