blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
12bfdf8a61a8cacf952be845fb1a449e480d7f9c
tobitech/code-labs
/machine learning/complete_python_programming_for_beginners/data structures/finding_items.py
347
4.15625
4
letters = ["a", "b", "c"] print(letters.index("a")) # get the index of an object in a list # print(letters.index("d")) # you get a ValueError for object not in list if "d" in letters: # `in` operator to check if object is in list print(letters("d")) # returns the number of occurences of a given item in a list...
true
6165a1189d01bd464652660b70ee618906a6a53a
tobitech/code-labs
/machine learning/complete_python_programming_for_beginners/control flow/infinite_loops.py
381
4.25
4
# this program is the same as the one we did in the while_loop lesson # while True: # command = input("> ") # print("ECHO", command) # if command.lower() == "quit": # break # Exercise: dispaly even numbers between 1 to 10 count = 0 for x in range(1, 10): if x % 2 == 0: print(x) ...
true
76c76d7de9ea0086277091f516bf37460301c664
tobitech/code-labs
/machine learning/complete_python_programming_for_beginners/classes/constructors.py
670
4.25
4
class Point: # `self` is a reference to the current object def __init__(self, x, y): # `x` and `y` are new attributes we are adding to the object # using the passed values to set them self.x = x self.y = y # we have a reference to the current object here with `self` # wi...
true
a9c7e3106ad820fa80cf9895a3a6d77d7ddf92bd
richardcsuwandi/data-structures-and-algorithms
/Recursive Algorithms/fibonacci.py
547
4.1875
4
# Create an empty dict to store cached values fibonacci_cache = {} def fibonacci(n): # If the value is cached, return the value if n in fibonacci_cache: return fibonacci_cache[n] # Compute the nth term if n == 1: value = 1 elif n == 2: value = 1 else: value = fib...
true
2eb9ef055524934cb078711a5faf5a4028f2b926
keshavgbpecdelhi/Algorithmic-Toolbox
/Algorithmic Toolbox/5.1 money change.py
1,201
4.21875
4
# -------------------------Money Change Again---------------------------- # As we already know, a natural greedy strategy for the change problem does not work correctly for any # set of denominations. For example, if the available denominations are 1, 3, and 4, the greedy # algorithm will change 6 cents using three c...
true
a65fb8222c63c2d94701bea3363d705b209757ca
alexander-fraser/learn-python
/Python_010_Reverse_Words.py
791
4.40625
4
# Reverse Words # Alexander Fraser # 28 Febuary 2020 """ Write a program (using functions!) that asks the user for a long string containing multiple words. Print back to the user the same string, except with the words in backwards order. """ def collect_input(): # Get the input from the user. input_string =...
true
d398fdbb843796180ac067a16217743a43bbc0a1
alexander-fraser/learn-python
/Python_002_Primes.py
1,304
4.5
4
# Primes # Alexander Fraser # 8 Febuary 2020 # This program outputs all the prime numbers up to the # integer specified by the user. def collect_stop_value(): # This function prompts the user for an integer. # It loops until an integer is entered by the user. while True: try: user_inp...
true
1d856ff4c9c072949c50cf8631b87e6ad90ab87c
vinaykath/PD008bootcamp
/Dev's Work/palindrome.py
260
4.3125
4
def palindrome_check(str): str = str.replace(" ", "") print(str) return str == str[::-1] str = input("Enter a string:" ) result = palindrome_check(str) if result: print("String is a palindrome!") else: print("String is not a palindrome")
true
5f4614126867e84ce2d94239b0c07adb32daaddb
Gokul-Venugopal/Python_Basics
/python4.py
1,357
4.15625
4
#using slicing my_list=['a','b','c','d','e','f'] for i in my_list[::2]: ###2 steps printing print(i) ### appending a string msg="hello" my_list=[] for i in msg: my_list.append(i) print(my_list) my_list1=[char for char in msg] print(my_list1) for i in range(0,5): ###squares from 0 to 5 ...
false
0da05c32e114f858801b3323c36a16633872ba25
ecxr/matrix
/hw0/hw0.py
2,632
4.1875
4
# Please fill out this stencil and submit using the provided submission script. ## Problem 1 def myFilter(L, num): """ input: list of numbers and a number. output: list of numbers not containing a multiple of num. >>> myFilter([1,2,4,5,7], 2) [1, 5, 7] """ return [ x for x in L if x % num...
true
c90cbb758d1b0caf0bacbea3c8ea36a9cac55138
mandaltu123/learnpythonthehardway
/basics/few_more_commandlines.py
286
4.21875
4
# some more tests on commanline args from sys import argv if len(argv) == 3: num1 = int(argv[1]) num2 = int(argv[2]) else: num1 = int(input("Enter number 1 : ")) num2 = int(input("Enter number 2 : ")) print("the sum of number1 and number2 is {}".format(num1 + num2))
true
00a5e7ffa38f1cb9e296ab0e82765bcf6a76a7f9
mandaltu123/learnpythonthehardway
/basics/dictionaries.py
1,052
4.25
4
# Dictionaries are the most commonly used datastructure in python # They are key value pairs dic = {1: 'one', 2: 'two', 3: 'three'} print("print my first dictionary {}".format(dic)) # I did not write dick # it has keys and values keys = dic.keys() values = dic.values() print("keys are {}".format(keys)) print("valu...
true
2cff4e9e9ff1b7a3df2937541795ea7f8356f07a
nyxgear/TIS-diversity-algorithms
/diversity/default_diversity_functions.py
1,248
4.6875
5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ The functions below are used as a default by algorithms to compute a set of diverse elements. """ def diversity_element_element(e1, e2): """ Default diversity function to compare an ELEMENT against another ELEMENT :param e1: element :param e2: elemen...
true
4c5f7e6130818e5090568713c75f357e39fe09eb
ronaldvilchez98/Santotomas_estructuras_programacion
/python_3/guia4/Ejercicio_12.py
795
4.1875
4
''' :::::::::::::::::::::::::::::::::::::::::::::: :: @github: adrian273 :: :: @email: adrianverdugo273@gmail.com :: :::::::::::::::::::::::::::::::::::::::::::::: 12@ Leer dos números, si el número uno es mayor que el número dos calcule Número1*Número2, si el número ...
false
aed564b67fbbfa7d1cb804f859c9ba29499bd0ab
ronaldvilchez98/Santotomas_estructuras_programacion
/python_3/guia4/Ejercicio_2.py
820
4.3125
4
''' :::::::::::::::::::::::::::::::::::::::::::::: :: @github: adrian273 :: :: @email: adrianverdugo273@gmail.com :: :::::::::::::::::::::::::::::::::::::::::::::: 2@ Lea tres números y calcule: a. Numero1 + numero2 b. (numero1 + numero3) /...
false
3eec349bfcca6bb0a154d7cf22d46568a6ad3ba6
SolutionsDigital/Yr10_Activities
/Activity06/Act06_proj5.py
1,956
4.1875
4
# File : Act06_proj5.py # Name :Michael Mathews # Date :1/4/19 """ Program Purpose : Deleting items using Del index or Remove for item Name """ myCountriesList=["Greenland", "Russia", "Brazil", "England", "Australia", "Japan", "France"] userSelection ="y" def showOptions(): print("----------------------------...
true
2cb7fcb58a5f39cf15526035a37475eb1928e1d1
SolutionsDigital/Yr10_Activities
/Activity02/Act02_proj1.py
1,289
4.15625
4
""" File : Act02_Py_p1.py Name : Michael Mathews Date : 25/01/2020 This program will accept the score from the user and find the Average The average is used in a selection Construct to check on PASS or Fail - Pass reuires >= 65 """ # Welcomes the user print("Welcome to the Pass Fail Calculator") # Puts a line br...
true
bea55b3e79ea96b209624c982c38e18e618e573e
SolutionsDigital/Yr10_Activities
/Activity04/Act04_proj5.py
1,857
4.15625
4
# File : Act04_proj5.py # Name : Michael Mathews Date : 1/4/19 # Program Purpose : Convert Temperature # Farenheit to Celsius,Celsius to Farenheit # Show Boiling and Freezing Points for both def fahr_to_Celsius(): far = float(input("Please enter the temperature in Farenheit: ")) cels = ((far-32)*(5/9)) p...
true
e508ebb8eea7327116e450eebb7684a3c31cd43c
SolutionsDigital/Yr10_Activities
/Activity01/Act01_proj3.py
695
4.28125
4
""" File : Act01_proj3.py Name : Michael Mathews Date :25/01/2020 Program Purpose: The user enters the Name, Address and Age This info will be displayed on the screen including age next year. """ # request for user to enter their first name FName= input("Enter your first name : ") # request for user to enter their S...
true
634a09a2b56eb7b564c56de6546297150b2af7f5
sholatransforma/hello-transforma
/cylinder.py
332
4.25
4
#program to find the area of a cylinder pi = 20/6 height = float(input(' what is height of cylinder')) radius = float(input('what is radius of cylinder')) volume = pi * radius * radius * height surfacearea = (height * (2 * pi * radius)) + (2 * (pi * radius**2)) print('volume is', volume) print('surface area', su...
true
6e858df9b2a8fa0f0e1ccbc42e9a17aa14eec066
lkfken/python_assignments
/assn-4-6.py
1,272
4.53125
5
__author__ = 'kleung' # 4.6 Write a program to prompt the user for hours and rate per hour using raw_input to compute gross pay. # Award time-and-a-half for the hourly rate for all hours worked above 40 hours. # Put the logic to do the computation of time-and-a-half in a function called computepay() and # use the func...
true
eb7bac332ef99d88940b266c62db3015592268ed
sudhanshu-jha/python
/python3/Python-algorithm/Bits/drawLine/drawLine.py
1,420
4.125
4
# A monochrome screen is stored as a single array of bytes, allowing # eight consecutive pixels to be stored in one byte. The screen has # width w, where w is divisible by 8(that is no byte will be split # across rows). Height of screen can be derived from the length of the # array and the width. Implement a function t...
true
3d1ccaceeee56c703069c90028669e6dc37ef5c0
sudhanshu-jha/python
/python3/Python-algorithm/ArraysAndStrings/isRotation/isRotation.py
294
4.1875
4
# Accepts two strings and returns if one is rotation of another # EXAMPLE "waterbottle" is rotation of "erbottlewat" def isRotation(str1, str2): if len(str1) == len(str2) and len(str1) > 0: str1str1 = "".join([str1, str1]) return str1str1.find(str2) >= 0 return False
true
a484920a839689704cd09da05cb6a327b65fc5a2
jdangerx/internet
/bits.py
2,119
4.125
4
import itertools def bytes_to_ints(bs): """ Convert a list of bytes to a list of integers. >>> bytes_to_ints([1, 0, 2, 1]) [256, 513] >>> bytes_to_ints([1, 0, 1]) Traceback (most recent call last): ... ValueError: Odd number of bytes. >>> bytes_to_ints([]) [] """ i...
true
eb7d1d9f48e4f2079232d0f05f76d8bd82b513b5
ma7modsidky/data_structures_python
/Queue/queue.py
1,121
4.28125
4
from collections import deque class Queue: def __init__(self): self.buffer = deque() def enqueue(self, val): self.buffer.appendleft(val) def dequeue(self): return self.buffer.pop() def is_empty(self): return len(self.buffer) == 0 def size(self): return le...
true
0ab91bf2df821543954022ea9788a884841e66e8
vivibruce/dailycodingproblem
/serialize_deserialize/serialize_deserialize.py
1,487
4.21875
4
''' Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree. For example, given the following Node class class Node: def __init__(self, val, left=None, right=None): self.val = val self...
false
b171bb9dc81ec1e100edc31c61bbc05a13e9a8cf
bhavikjadav/Python_Crash_Course_Eric_Matthes_Chapter_5
/5.11_Ordinal Numbers.py
808
4.59375
5
#!/usr/bin/env python # coding: utf-8 # # 5-11. Ordinal Numbers: Ordinal numbers indicate their position in a list, such as 1st or 2nd. Most ordinal numbers end in th, except 1, 2, and 3. # # • Store the numbers 1 through 9 in a list. # # • Loop through the list. # # • Use an if-elif-else chain inside the loop to prin...
true
5662b37a922038c74948d92ccad0319f39aee4f6
artificialbridge/hello-world
/BillCalculator.py
1,018
4.125
4
def tip(bill, percentage): total = bill*percentage*0.01 return total def total_bill(bill,percentage): total = bill+tip(bill, percentage) return total def split_bill(bill,people): total = float(bill)/people return total def main(): choice = raw_input("Enter 1 to calculate tip or 2 to split...
true
bccf02c621aafa681f2303f24442eabf6e3a5a57
roshsundar/Code_Archive
/Python_programs/LookForCharac.py
300
4.15625
4
occurences=0 print "Please enter a group of words" userPut=raw_input() print "Now enter a character that you want me to find in it" charac=raw_input() for letter in userPut: if letter == charac: occurences += 1 print "I found",occurences,"ocurrences of your character in the words"
true
5f7a811381b65512f224a43ec09bd94ebbddeb14
activehuahua/python
/pythonProject/exercise/8/8.2.py
265
4.28125
4
list1=[] for i in range(2,30,4): list1.append(i) print(list1) list1=[] for i in range(0,10): list1.append(i) print(list1) list1=[] for i in range(3,19,3): list1.append(i) print(list1) list1=[] for i in range(-20,861,220): list1.append(i) print(list1)
false
e3d017f081d9b76417b13ba725de6910a91f1742
aribajahan/Projects
/learnPTHW/ex31.py
1,360
4.28125
4
print "You enter a dark room with two doors. Do you go through door #1 or door #2?" door = raw_input(">>> ") if door == "1": print "There's a huge bear here eating a cheesecake. What do you do now?" print "1. Take the damn cheesecake." print "2. Scream at the bear" print "3. Call Batman" bear =raw_input("---> "...
true
d7af5f75c15b02c9a1bc839f1f6ee9c32942e53d
mochimasterman/hello-world
/mathtime.py
1,231
4.1875
4
print("hello!") print("lets do math!") score = 0 streak = 0 answer1 = input("What is 1 + 1?") if answer1 == "2": print("Correct!") score = score+1 streak += 1 else: print("Incorrect!") streak = 0 print("Your score is", answer1) #start level 2 print("To level 2!") answer2 = input("what is 7 plus 2?"...
true
dfbdf41e70262819171d78dfebe7fe44d8b8b52e
Alex7lav81/Group_22
/Python_HW/HW_2_script_9.py
2,226
4.53125
5
""" Задание 9 Написать скрипт используя функцию input(). 1. Функция должна на вход принимать целое число. 2. Внутри функции должно сгенерироваться рандомное целое число (import random)...(random.randint(1, 100)) 3. Выводить должна "Вы вели число = (введённое число), которое (меньше/больше/равно и меньше...
false
6f2c1d479982891bd6900b0c4b00ed30144f62c8
Requinard/merge-sort
/sqrt.py
1,189
4.125
4
""" Try to find the square root of a number through approximation Estimated operational time: O((number * 10)*precision) """ def brute_sqrt(number, power=2, precision=13): var = 1.0 mod = 1.0 # 13 is the max amount of numbers we can actually count with floats, going above 13 is useless if precision >...
true
82a2e068371c6790528cb4319a3b5f36788263a9
sprajjwal/spd1.4-interview-practice
/problem2.py
1,199
4.125
4
# https://leetcode.com/problems/merge-two-sorted-lists/ # Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. # Example: # Input: 1->2->4, 1->3->4 # Output: 1->1->2->3->4->4 # Definition for singly-linked list. class ListNode:...
true
1c23fbe547cc8215f459b8f890f28c7aed978e04
Dsblima/python_e_mysql
/strings.py
402
4.21875
4
nome = "danilo lima\n" print(nome[0:3]) """ string = 'string' string[a:b] retorna uma substring que inicia em a e tem tamanho b """ print(nome.lower()) print(nome.upper()) print(nome.strip()) #retira espaços e caractéres especiais do final da string print(nome) print(nome.split("l")) print(nome.find("l")) # reto...
false
00eaa267b38e765580f2dfa24a11e2f7b2538559
ansh8tu/Programming-with-python-Course
/Tetrahedron.py
236
4.3125
4
# This is a Python Program to find the volume of a tetrahedron. import math def vol_tetra(side): volume = (side ** 3 / (6 * math.sqrt(2))) return round(volume, 2) # Driver Code side = 3 vol = vol_tetra(side) print(vol)
true
d76f3007f958af60010f9cfd25a500507930d954
depth221/python
/Score2.py
1,022
4.15625
4
while True: try: num = input("num: ") if num == "½": num = 1/2 elif num == "⅓": num = 1/3 elif num == "⅔": num = 2/3 elif num == "¼": num = 1/4 elif num == "¾": num = 3/4 elif num == "⅛...
false
8370e8d257bab5bfeedafbfe6307682dffd916f9
hraf-eng/coding-challenge
/question03.py
1,473
4.3125
4
# 3. Check words with typos: # There are three types of typos that can be performed on strings: insert a character, # remove a character, or replace a character. Given two strings, write a function to # check if they are one typo (or zero typos) away. # Examples: # pale, ple ­> true # pales, pale ­> true # pale, bale ­...
true
3d99c11bd5d21fa09e7f9bacedcb2da703477599
meta3-s/K-Nearest-Neighbors-Python
/KNN.py
1,753
4.21875
4
## Tutorial on the implementation of K-NN on the MNIST dataset for the recognition of handwritten numbers. from sklearn.datasets import * import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn import datasets from sklearn.model_selection import train_tes...
true
f0a55ad1564a3bf36db8bb0206d9cab022effa6a
PacktPublishing/Python-for-the-.NET-Developer
/Ch05/05_01/Begin/Python_VSC/Ch2/Program.py
1,776
4.34375
4
import math # This is a single-line comment ''' This is an example of a multi-line comment ''' def demo_print_greeting(): print("Rise & Shine!!") def demo_local_variable(): a_variable = 7 a_variable ="The name is 007" print(a_variable) name = "Unknown" def demo_global_variable(): gl...
false
34aeb29e9f40139d27530f54a7d595984a88974a
SurajKakde/Blockchain
/assignments/Assignment_Suraj.py
657
4.25
4
# collecting input from the user for name and age name=input('Please enter your name: ') age=input('Please enter your age: ') def my_intro(name, age): """ Concatenate the name and age and print""" print('Hello! My name is '+name+' and my age is ' +age) def add_strings(string1, string2): """concatenates ...
true
5470a958b10403c6a2c90bc068ec1193503632de
eevan7a9/playground-python3
/dict.py
540
4.40625
4
# a dictionay of hero hero = { "name": "saitama", "age": 25, "email": "saitama@yahoo.com", "purchase": [ "bannana", "apple", "pai" ] } # we print the hero name print(hero["name"]) # we print the entire hero dictionary print(hero) # we change the hero name to 'master saitama' ...
false
96938389c82a3f91cf88dd8e670faf540fcbff7c
Dython-sky/AID1908
/study/1905/month01/code/Stage1/day17/review.py
1,030
4.28125
4
""" 迭代 可迭代对象 迭代器 生成器 class 可迭代对象: def __iter__(): 创建迭代器对象 class 迭代器: def __next__(): 返回一个元素 如果没有元素,则抛出一个StopIteration异常 for 变量 in 可迭代对象: 变量得到的就是__next__方法返回值 原理: iterator = 可迭代对象.__iter__() while True: try: 变量 = iterator.__next__()...
false
ff185c8381ab3c89e9b6c7a5cf982a432a2b1940
Dython-sky/AID1908
/study/1905/month01/code/Stage1/day08/day07_exercise/exercise01.py
518
4.34375
4
""" 定义在控制台打印二维列表的函数 [ [1,2,3,44], [4,5,5,5,65,6,87], [7,5] ] 1 2 3 44 4 5 5 5 65 6 87 7 5 """ def print_double_list(double_list): """ 打印二维列表 :param double_list: 需要打印的二维列表 :return: """ for line in double_list: for item in line: ...
false
24b9f2bf9125b6469bb3b58d045b655e8b1e2e43
Dython-sky/AID1908
/study/1905/month01/code/Stage2/day04/sort.py
1,875
4.125
4
""" sort.py 排序算法训练 """ # 冒泡排序 def bubble(list_): # 外层表示比较多少轮 for i in range(len(list_)-1): # 内从循环表示每轮两两比较的次数 for j in range(len(list_)-1-i): # 从大到小排序 if list_[j] < list_[j+1]: list_[j],list_[j+1] = list_[j+1],list_[j] # 完成一轮排序 def sub_sort(list_,low,high):...
false
32c2314acb5f39e11e68401da3e1ec41624da7a6
Dython-sky/AID1908
/study/1905/month01/code/Stage1/day14/demo2.py
727
4.125
4
""" 运算符重载 """ class Vector1: def __init__(self,x): self.x = x def __str__(self): return str(self.x) def __add__(self, other): return Vector1(self.x+other) def __radd__(self, other): return Vector1(self.x + other) def __iadd__(self, other): self.x += other ...
false
4982fc5b669850922cfa4eb256eb81d10d6d0a91
AnilNITK/Pycharm
/Greatest_number.py
281
4.125
4
x1=int(input("enter first number")) x2=int(input("enter second number")) x3=int(input("enter third number")) if x1>x2 and x1>x3: print(str(x1)+" is grteatest number") elif x2>x3 and x2>x1: print(str(x2)+" is greatest number") else: print(str(x3)+" is greatest number")
false
e6763855509e00ddf98426472a37c79d1f464df8
vibhor-vibhav-au6/APJKalam
/week8/day03.py
570
4.15625
4
''' Tell space complexity of following piece of code: (5 marks) for i in range(n): for j in range(n): print(“Space complexity”) ''' # O(N) = o(n) * o(n) = o(n^2) ''' Reverse an array of integers and do not use inbuilt functions like “reverse”, don’t use shorts hands like “arr[::-1]”. Only use following approac...
true
844d4449de7f4571ba39ee86dd2d65a3edcf449a
vibhor-vibhav-au6/APJKalam
/week8/day01.py
1,655
4.125
4
''' Recursive implementation of atoi() function:(5 marks)''' def myAtoiRecursive(st): if st == '': return if len(st) == 1: return ord(st)-48 return ((ord(st[0])-48)*10**(len(st)-1)) + myAtoiRecursive(st[1:]) # '1234' = 1234 = 1*len(st)-1 **10 # 1*10**3 = 1000 # 2*10**2 = 200 # (ord('1')-48)*10**(len...
false
5e48f5bb5cffdf1bd49a9ca6f026ae06bbf7f1e4
isemona/codingchallenges
/18-SwapCase.py
1,476
4.1875
4
#https://www.coderbyte.com/editor/Swap%20Case:Python #Difficulty easy #Implemented built in function .swapcase() def SwapCase(str): # code goes here # swap letters small for cap, i/o str-str mutation; symbols stay as is, refactor new_str = [] for i in str: if i == i.lower(): ...
true
2b9cfd9a36063e0a54b666afd4351e72d0cb3636
PhuongBui27/python_ex
/LoopIfThenElse.py
597
4.125
4
'''number=int(input('Input an odd number: ')) if number %2==0: print('Sorry, the number you enter is even number') number=int(input('Input an odd number: ')) if number%2==1: for i in range(number,0,-2): for j in range(1,(number+1)//2): print('',end='') for k in range(number-i, n...
false
988dd42a48919561214433608e085431fc0fac80
obebode/EulerChallenges
/EulerChallenge/Euler4.py
685
4.25
4
def checkpalindrome(nums): # return the palindrome numbers i.e original num equals to the same number in reverse form return nums == nums[::-1] def largestpalindrome(): # Initial largest to zero largest = 0 # Nested for loop to generate three digit numbers for 100-999 # Check if product is h...
true
1a474a4d6ccfdbe6c954766fa96ebaef9fb1c7c3
arajitsamanta/google-dev-tech-guide
/python-basics/fundamentals/repition-statements.py
2,738
4.15625
4
def whileLoop(): theSum = 0 i = 1 while i <= 100: theSum = theSum + i i = i + 1 print("The sum = ", theSum) # The while loop is a compound statement and thus requires a statement block even if there is only a single statement to be executed. Consider the user of # the while loo...
true
3a2b69e1e977c7de04dd12b6b0d7d3f78b5e6efe
justien/lpthw
/ex_11xtnsn.py
1,186
4.4375
4
# -*- coding: utf8 -*- # Exercise 11: Asking Questions print "==================================================" print "Exercise 11: Asking Questions" print print # With this formulation, I can combine the string name with the question # and the raw_input all at once. name = raw_input("What is your name? ") #^-...
true
de4a884792759d26a039007727f5387d802bafba
justien/lpthw
/ex8.py
1,364
4.4375
4
# -*- coding: utf-8 -*- # Exercise 8: Printing, Printing print "==================================================" print "Printing, Printing" print print # Formatter is a string, which text can be used as four values. # It is a string that's made up of four raw inputs. formatter = "%r %r %r %r" # We now demonstrat...
true
a61b900e548eb869c5470b35139674bca31bcd3b
justien/lpthw
/ex10_formatting_cats.py
1,005
4.1875
4
# -*- coding: utf8 -*- # Exercise 10: What was that? print "==================================================" print "Exercise 10: What was that?" print print # here are the defined strings, including: # * the use of \t to show a tab indentation # * the use of \n to show a new line # * the use of \ to esc...
true
7136768c1f9c5aa645fc47517444c423d59e3989
justien/lpthw
/ex11.py
810
4.3125
4
# -*- coding: utf8 -*- # Exercise 11: Asking Questions print "==================================================" print "Exercise 11: Asking Questions" print print # With this formulation, I can combine the string name with the question # and the raw_input all at once. name = raw_input("What is your name? ") prin...
true
3e84b12be6d6b54fabb5bfc379f4d84561fb54b6
justien/lpthw
/ex34_Lists.py
1,218
4.3125
4
# -*- coding: utf8 -*- # Exercise 34: Accessing Elements of Lists # 234567890123456789012345678901234567890123456789012345678901234567890123456789 print "========================================================================" print "Exercise 34: Accessing Elements of Lists" print print print "Here we're gonna un...
false
0309187a186d97e4656d0182e37a1c2be64fae16
savva-kotov/python-intro-practise
/3-2-6.py
943
4.125
4
''' Вспомните трюк с чтением последовательности с прошлого занятия. Вам подается на вход последовательность целых чисел, в которой каждое число идет на новой строке. Заканчивается последовательность точкой. Прочитайте такую последовательность и выведите список, содержащий её элементы. Теперь Вы знаете про break и cont...
false
448bc46010c439ef8bbb4682dd71f4182799c994
himynameismoose/Printing-Variables
/main.py
2,048
4.4375
4
# Lab 1.3: Printing & Variables # Part 1: Printing Practice # There are five lines of code provided to you in the Google Document. # Enter the five lines of Python code below, and run it to see what happens. # Make sure to respond to the prompts in the Google Document. # /ghttps://docs.google.com/document/d/1Wt4zeX6yI...
true
9923a57fb40e19f65c5890625f31c3837413db4f
Agskvortsov/New_python_hw
/home_work_35.py
2,065
4.28125
4
# 35. Создать два класса: Окружность и Точка. Создать в классе окружности метод, # который принимает в качестве параметра точку и проверяет находится ли данная точка внутри окружности. class Point: def __init__(self, name, coord_x, coord_y): self.name = name self.coord_x = coord_x self.coo...
false
bffc4b4dd0c997c57a348360d052283d95409dad
4rude/WGUPS_Delivery_Program_C950
/dsa_2/Truck.py
754
4.21875
4
class Truck: """ The Truck class is used to hold packages to delivery, hold location data about where the truck is at and where it should go next, time data about the current time of the truck/driver, and the total mileage of the truck objet. """ # Set the init method for the Truck class so a T...
true
7a89f3ce8e82e16430e307a7647e84053b1c84b5
Anjalibhardwaj1/Hackerrank-Solutions-Python
/Basics/Write_a_func.py
1,243
4.1875
4
#An extra day is added to the calendar almost every four years as February 29, # and the day is called a leap day. It corrects the calendar for the fact that # our planet takes approximately 365.25 days to orbit the sun. A leap year # contains a leap day. #In the Gregorian calendar, 3 conditions are used to identif...
true
45741e375f049b22566ca98b54f966a531d18178
sonalinegi/Training-With-Acadview
/thread.py
1,039
4.21875
4
#Create a threading process such that it sleeps for 5 seconds and then prints out a message. import threading import time import math def mythread() : print('thread is starting') time.sleep(5) print('thread is ending') t=threading.Thread(target=mythread) t.start() #Make a thread that prints numbers from ...
true
805d046c0b89d814faafebef53c44e37eb23b69a
onc-healthit/SPD
/SPD Data Generator/nppes_data_generators/npis/utils.py
860
4.25
4
import operator from fn.func import curried def backward_digit_generator(number): ''' Given a number, produces its digits one at a time starting from the right :param number: :return: ''' if number == 0: return yield number % 10 yield from backward_digit_generator(number // 10...
true
0e641db8d691a96cc7ea8a2336bc336c59330a4f
solomonli/PycharmProjects
/CodingBat/Logic-1/love6.py
530
4.125
4
def love6(a, b): """ The number 6 is a truly great number. Given two int values, a and b, return True if either one is 6. Or if their sum or difference is 6. Note: the function abs(num) computes the absolute value of a number. love6(6, 4) → True love6(4, 5) → False love6(1, 5) → True :...
true
0cfc99ea3265b2f6e04e1378e2730dff56e9bc02
solomonli/PycharmProjects
/Stanford/Python Numpy Tutorial.py
1,237
4.1875
4
def quicksort(arr): if len(arr) <= 1: return arr pivot = arr[len(arr) // 2] small = [x for x in arr if x < pivot] mid = [x for x in arr if x == pivot] big = [x for x in arr if x > pivot] print(small, " AND ", mid, " AND ", big) return quicksort(small) + mid + quicksort(big) print(q...
true
69f79ee16e480e49518c42354e0a5cae79d33c90
solomonli/PycharmProjects
/The Absolute Basics/Chapter 3/Section 1.py
1,112
4.28125
4
__author__ = 'phil' # Basic prompt input("Prompt") # Feeding the entered data from the prompt into a String variable inputString = input("Enter something: ") # Now output the String print("You entered:", inputString) # Assigning to a variable, and performing a calculation mathsInt = (input("Enter an integer: ") / 2)...
true
3d83a21171ae14b33c7ce1bf1fab9a2f8a2575d9
Zak-Kent/Hack_O_class
/wk1/names_challenge.py
835
4.21875
4
""" The goal of this challenge is to create a function that will take a list of names and a bin size and then shuffle those names and return them in a list of lists where the length of the inner lists match the bin size. For example calling the function with a list of names and size 2 should return a list of list...
true
da632a41ed0b9cd24276ccde14c70b2080fe2bdd
akyerr/Codewars-Examples
/facebook_likes.py
823
4.1875
4
""" You probably know the "like" system from Facebook and other pages. People can "like" blog posts, pictures or other items. We want to create the text that should be displayed next to such an item. Implement a function likes :: [String] -> String, which must take in input array, containing the names of people who li...
true
64a1ce15b855819cf6b3456f95bb87c4ee592052
akyerr/Codewars-Examples
/add_and_convert_to_Binary.py
284
4.40625
4
""" 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. """ def add_binary(a,b): result = bin(a+b) return result[2:] print(add_binary(1,1))
true
c687037d35ef6aacc65d171c1d87ae2f7367a972
karar-vir/python
/difference_between_sort_and_sorted.py
375
4.34375
4
langs = ["haskell", "clojure", "apl"] print(sorted(langs)) #sorted(langs) will return the new list bt it will not effect the original list print('original list : ',langs) langs.sort() #langs.sort() will return the new sorted list placed at the previous list print(langs) #Reverse() funtion print('origin...
true
56925000eaeb4f5f51574302ac5aada4e9657783
Adrncalel/holbertonschool-higher_level_programming
/0x06-python-classes/4-square.py
893
4.5
4
#!/usr/bin/python3 class Square: """An empty class that defines a square""" def __init__(self, size=0): """inizialization and conditioning input only to be integer""" ''' if isinstance(size, int) == False: raise TypeError("size must be an integer") if size < 0: ...
true
dd0cc39c574724db9e894830f1b60b788a8f95f6
Adrncalel/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/0-add_integer.py
475
4.28125
4
#!/usr/bin/python3 """ This is the add_integer module The function adds two integers or floats """ def add_integer(a, b=98): """This function adds to variables 'a' and 'b' which can be either float or int and returns the value casted to int""" if isinstance(a, (float, int)) is False: raise Ty...
true
f41270ab8de5dcb8b5405ae7c5c6b163021a1906
ngupta10/Python_Learnings
/Basic Python Scripts/List&Functions.py
2,416
4.625
5
""" 0.Setup: a.create a list of integers and assign it to a variable b.create a list of strings and assign it to a variable c.create a list of floats and assign it to a variable 1.Passing A List to A Function: a.create a function that takes and returns an input b.print a call of the function you creat...
true
025c7bf7c4ab66a8aa5e826964f7a68ca0245b88
ngupta10/Python_Learnings
/Basic Python Scripts/commentsAndMathOperators.py
1,538
4.1875
4
""" comments practice: 1.create a single line comment 2.create a multiple line comment """ # enter your code for "comments practice" between this line and the line below it--------------------------------------- # --------------------------------------------------------------------------------------------...
true
399818ed5f45d6d9a0c5756ad3a9121742709f1a
Junghyo/pycharm
/data_science/basic/01_data_type/practice02_operator.py
1,670
4.15625
4
""" # 연산자 1. 산술연산자 +, -, *, / 제곱 : ** 나머지를 산출 : % 몫 : // """ print("plus", 5 + 2) # 7 print("minus", 5 - 2) # 3 print("multiple", 5 * 2) # 10 print("divide", 5 / 2) # 2.5 print("square", 5 ** 2) # 25 print("reminder", 5 % 2) # 1 print("quotient", 5//2) # 2 """ 2. 비교 연산자 ==, !=, <, >, <=, >= """...
false
2567d02810607eb8e12826e5aceb419dfedf2a9d
fs412/codingsamples
/HW01fransabetpour-1.py
2,090
4.25
4
""" My name is Fran Sabetpour and here is my script for the classic "Rock, Paper, Scissors" game! """ def startover(): # User gets to input their choice between rock, paper, scissors. game = input("Let's play some Rock, Paper, Scissors! R = rock, S = scissors, P = paper. Press Q if you would like to quit. Now le...
true
abe82b0d19fc671d7fc82e3d449324369accc2c6
JayChenFE/python
/fundamental/automate_the_boring_stuff_with_python/exercise/ch7/7.18.1_强口令检测.py
965
4.125
4
''' 写一个函数,它使用正则表达式,确保传入的口令字符串是强口令。 强口令的定义是: 长度不少于8 个字符,同时包含大写和小写字符,至少有一位数字。 你可能需要用多个正则表达式来测试该字符串,以保证它的强度。 ''' import re def passStrengthTest(passWord): lowerRegex = re.compile(r'[a-z]') upperRegex = re.compile(r'[A-Z]') numRegex = re.compile(r'[0-9]') moLower = lowerRegex.search(passWord) moUpp...
false
7ffb535c242ea256f5c6c989805d1eb17f8adb1a
JayChenFE/python
/fundamental/python_crash_course/exercise/ch04/4-11.py
827
4.21875
4
# 4-11 # 你的比萨和我的比萨 :在你为完成练习4-1而编写的程序中,创建比萨列表的副本,并将其存储到变量friend_pizzas 中,再完成如下任务。 # 在原来的比萨列表中添加一种比萨。 # 在列表friend_pizzas 中添加另一种比萨。 # 核实你有两个不同的列表。为此,打印消息“My favorite pizzas are:”, # 再使用一个for 循环来打印第一个列表;打印消息“My friend's favorite pizzas are:”, # 再使用一个for 循环来打印第二个列表。核实新增的比萨被添加到了正确的列表中。 my_pizzas = ['a','b','c','d'] friend_pi...
false
b35390238fc7717476eb6ef747b737c6ef8b8f21
JayChenFE/python
/fundamental/python_crash_course/exercise/ch04/4-10.py
753
4.3125
4
# 4-10 # 切片 : # 选择你在本章编写的一个程序,在末尾添加几行代码,以完成如下任务。 # 打印消息“The first three items in the list are:”,再使用切片来打印列表的前三个元素。 # 打印消息“Three items from the middle of the list are:”,再使用切片来打印列表中间的三个元素。 # 打印消息“The last three items in the list are:”,再使用切片来打印列表末尾的三个元素。 num = [1,2,3,4,5,6,7] print('The first three items in the list...
false
465371a901d073b4430231511a41d860c180dc4f
learnpi/codepy
/Day3/if_4.py
597
4.1875
4
lst_edible_fruits = ['apple','gauva','raspberry', 'cherry', 'jackfruit'] lst_non_edible_fruits = ['grapes','orange','banana','watermelon','mango'] dict_fruits = {'edible_fruits': lst_edible_fruits, 'non_edible_fruits':lst_non_edible_fruits} choice_fruit_str = input('Enter a fruit name to check : ') if...
false
3e340a8d4c5f63d1becbb2bef3755e59c71213b4
jefersonlima/Courses
/Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_13_LeituraEEscritaEmArquivos/seek_e_cursors.py
1,509
4.59375
5
""" Seek e Cursors seek() -> É utilizada para movimentar o cursor pelo arquivo. arquivo = open('t.txt') print(arquivo.read()) # seek() -> A função seek() é utilizada para movimentação do cursor pelo arquivo. Ela recebe um # parâmetro que indica onde queremos colocar o cursor. # Movimentando o cursor pelo arquiv...
false
7b7337c7736073bc8d95807d99c4164012a65b8d
jefersonlima/Courses
/Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_12_TrabalhandoComModulosEPacotesEmPython/modulos_customizados.py
949
4.34375
4
""" Módulos Customizados Como módulos Python nada mais são do que arquivos Python, Então TODOS os arquivos que criamos neste curso são módulos Python prontos para serem utilizados. # ### CORRIGIDO ### # Resolver isso no futuro devido eu ter organizado por diretórios e o professor nao fez isso por isso não consigo #...
false
592211d0a479a900ec1abf5d0106224c421fc630
jefersonlima/Courses
/Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_12_TrabalhandoComModulosEPacotesEmPython/modulos_builtin.py
1,199
4.21875
4
""" Trabalhando com Módulos Builtin (módulos integrados, que já vem instalados no Python) httos://docs.python.org/3/py-modindex.html ________________________ |Python|Módulos Builtin| ------------------------ # utilizando alias (apelidos) para módulos/funções # Apelido no Módulo import random as rdm # print(rdm.ran...
false
a2cee6b8c3239bb858b4fd50dd64027b58b8c027
jefersonlima/Courses
/Cursos/UdemyProgramacaoEmPythonDoBasicoAoAvancado/guppe/secao_9_ComprehensionsEmPython/list_comprehension_p1.py
1,481
4.6875
5
""" List Comprehension (*Compreenção de listas) - Utilizando list Comprehension nós podemos gerar novas listas com dados processados a partir de outro interável # Sintaxe da List Comprehension [ dado for dado in interável ] # Exemplos numeros = [1, 2, 3, 4, 5] res = [numero * 10 for numero in numeros] print(res)...
false
c8fc402ee1dcba95dc7b9e3d5bc1f408fb66e418
JohnJGreen/1310Python
/hw01/hw01_task4.py
786
4.125
4
# John Green # UT ID 1001011958 # 9/01/13 # Write a program that asks the user to enter two real numbers (not integers) and # computes and displays the following opertations between the two: # multiplication, division, integer division, modulo , exponentiation # hw01_task4 # First number first_flt = float(input("En...
true
c2eb184d8c3088aeb4adf1f491ae54be853fbb1f
ABROLAB/Basecamp-Technical-Tasks
/Task_7.py
883
4.1875
4
''' Write a function that takes an array of positive integers and calculates the standard deviation of the numbers. The function should return the standard deviation. ''' def Calc_Standard_Dev(int_array): standard_deviation = 0 sqr_mean = 0 sqr_array = [] # step 1: calculate the mean mean = s...
true
5cbd32acc84eec60397e0adf2ee48a05cfbfc371
ProjitB/StoreHouse
/bomberman/Assignment1_20161014/brick.py
582
4.21875
4
import random from random import randint class Brick(object): def __init__(self, board): '''Initializes the board ''' self.board = board.board #Random initial location for Brick x = randint(3, board.size) y = randint(3, board.size - 1) #If original position n...
true
403a7797feb8891f815fcb5ef602a87349ef42eb
Aalukis1/Basic-Python-programming
/second.py
293
4.25
4
#FOR AND WHILE LOOP # for a in range(1,10): # print(a) # if a == 5: # break # for odd in range(1,36,2): # print ("odd numbers are: ", odd) # for even in range(2,35,2): # print ("even numbers are: ", even) x = 2 while x >= 1 and x <= 35): print (x) x = x + 2
false
d39052ddac2e15a63ff8e3c956c7628ad7e6bea8
eduardoprograma/linguagem_Python
/Introdução à Programação com Python/Do autor/Códigi fonte e listagem/listagem/capitulo 03/03.27 - Erro de conversão vírgula no lugar de ponto.py
1,151
4.15625
4
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2017 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
false
a28d84c47f416b1da64d07ebd1b9ed89d387c451
eduardoprograma/linguagem_Python
/Introdução à Programação com Python/Do autor/Exercícios resolvidos/exercicios/capitulo 05/exercicio-05-12.py
1,227
4.4375
4
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2017 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
false
23575e3b315bfbb17f59e7581610b1f87f75c5e6
eduardoprograma/linguagem_Python
/Introdução à Programação com Python/Do autor/Exercícios resolvidos/exercicios/capitulo 04/exercicio-04-10.py
1,326
4.3125
4
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2017 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
false
0e09b97438dc5ee7674acb8828162530dd5cfb18
eduardoprograma/linguagem_Python
/Introdução à Programação com Python/Do autor/Exercícios resolvidos/exercicios/capitulo 03/exercicio-03-15.py
1,151
4.375
4
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2017 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
false
cf50da36792edbb6f338c6cff1c1fe4001b556f0
eduardoprograma/linguagem_Python
/Introdução à Programação com Python/Do autor/Exercícios resolvidos/exercicios/capitulo 06/exercicio-06-07.py
1,228
4.3125
4
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2017 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
false
fe6a6f701407eff698c2c42b4033715d1cf4537b
eduardoprograma/linguagem_Python
/Introdução à Programação com Python/Do autor/Exercícios resolvidos/exercicios/capitulo 06/exercicio-06-13.py
1,226
4.375
4
############################################################################## # Parte do livro Introdução à Programação com Python # Autor: Nilo Ney Coutinho Menezes # Editora Novatec (c) 2010-2017 # Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8 # Primeira reimpressão - Outubro/2011 # Segunda reimpressão - ...
false
76bf387637e4e51f639f00d9e7297acc297114ca
sjay05/CCC-Solutions
/2007/J4.py
305
4.21875
4
""" author: sjay05 """ word1 = raw_input() word2 = raw_input() if len(word1) != len(word2): print "It is not a anagram." else: w1l = sorted([c for c in word1]) w2l = sorted([c for c in word2]) if w1l == w2l: print "It is a anagram." else: print "It is not a anagram."
false
3f5345a8ed48cbdcb9f72d4a7d3df7ffdb2277c4
thessaly/python_boringstuff
/2.py
1,069
4.25
4
name = '' # Example of infinite loop #while name != 'your name': # print('Please type your name.') # name = input() #print('Thanks!') # When used in conditions, 0, 0.0 and ' ' are considered False # name = '' # while not name: # print('Enter your name:') # name = input() # print('How many guests will yo...
true
932a5f8d571d30fb08e416aa450b224373b3c750
AssiaHristova/SoftUni-Software-Engineering
/Programming Basics/nested_loops/train_the_trainers.py
477
4.125
4
n = int(input()) presentation = input() sum_all_grades = 0 all_grades = 0 while presentation != 'Finish': sum_grades = 0 avg_grade = 0 for i in range(1, n + 1): grade = float(input()) sum_grades += grade avg_grade = sum_grades / i sum_all_grades += grade all_grades +...
true