blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
7a864aba254e7531917b197c8dcc53e3cd0e20ce
jrg-sln/basic_python
/comparaciones7.py
935
4.21875
4
# -*- coding: utf-8 -*- ###########################Ejercicio sobre comparaciones#################### '''Ahora que ya sabe utilizar comparaciones hacer un programa que contenga la edad de varias personas y decir si es cierta o falsa la afirmación mediante una función, además use la impementación de la función main''' ...
false
5f4783efff3f567033bff8c2752602a13a3b7b2e
jackfish823/Hangman_Python
/Guess.py
597
4.125
4
import re #lib to search in a string def is_valid_input(letter_guessed): # checks if the function the input letter_guessed is good spread_guess = re.findall('[A-Za-z]', letter_guessed) #list of the guess_input of only english if len(letter_guessed) == len(spread_guess): if len(letter_guessed) =...
true
ecfc083467a06ff836565a89858b8218e64bd56b
npradha/multTables
/multTables.py
386
4.28125
4
while True: print("\n") print("What number do you want the multiplication table of?") num = input() print("\n") for mul in range(13): answer = num * mul print(str(num) + " x " + str(mul) + " = " + str(answer)) print("\n") print("Do you want to input another number? (y/n)") ans = raw_input() if ans == 'y':...
true
20b3bba2480a4ec504aee0a1db35c01348c1b21d
Unrealplace/PythonProject
/基础知识学习/list_demo.py
1,440
4.25
4
arr = ['hello','world','nice to ','meet','you'] print(arr) # for 循环遍历 for x in arr: print(x) pass #通过下标来取列表中的元素 print(arr[0]) print(arr[-1]) #列表的增删改查操作 motor_cycles = ["honda","ymaha","suzuki"] # 列表末尾增加一个数据 motor_cycles.append("nice to meet you") # 修改 motor_cycles[1] = "oliverlee" #插入元素 motor_cycles.insert(0,"liy...
false
585fcfed03865a69f179d04818c5e1e1cf6cd470
MaxCosmeMalasquez/Ejercicios-Python-
/example2.12.py
943
4.125
4
# print("Write first number") # x = int(input()) # print("Write second number") # y = int(input()) # print("Write third number") # z= int(input()) # cadena = [x,y,z] # cadena.sort() # print(cadena) print("Write first number") x = int(input()) print("Write second number") y = int(input()) print("Write third number") z...
false
f1fe2d0ee08fd6ff898efdfb5c2335c8552504f7
katoluo/Python_Crash_Course
/chapter_04/4-11.py
381
4.25
4
my_pizzas = [ 'one', 'two', 'three' ] print("my_pizzas: " + str(my_pizzas)) friend_pizzas = my_pizzas[:] print("friend_pizzas: " + str(friend_pizzas)) my_pizzas.append('my_four') friend_pizzas.append('friend_four') print("My favorite pizzas are:") for value in my_pizzas: print(value) print("My friend's favorite...
false
365d066474e18dafccfeecf141a6f339052edc73
LinsonJoseph/python
/use_of_is.py
1,090
4.1875
4
#Use of 'is' list_123 = [1, 2, 3] list_321 = [3, 2, 1] tuple_123 = (1, 2, 3) tuple_321 = (3, 2, 1) # == compares the value of both operands if id(list_123[0]) == id(list_321[2]): print(f'ID of 1st element of list_123 is {id(list_123[0])} and is same as id of 3rd element of list_321 {id(list_321[2])}') els...
false
53b5e0a564b279e63ceb6458310fcbaeec68d933
DustinRPeterson/lc101
/crypto/vigenere.py
2,230
4.125
4
#Encrypts text using the vignere algorithm (https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher) from helpers import alphabet_position, rotate_character #import alphabet_position and rotate_character from helpers.py lower_case_dict = dict() #create dictionary for lowercase letters upper_case_dict = dict() #creat...
true
0ebc30ff3f710310db361194090f163abcf9e8c7
MarsWilliams/PythonExercises
/How-to-Think-Like-a-Computer-Scientist/DataFiles.py
2,582
4.34375
4
#Exercise 1 #The following sample file called studentdata.txt contains one line for each student in an imaginary class. The student’s name is the first thing on each line, followed by some exam scores. The number of scores might be different for each student. #joe 10 15 20 30 40 #bill 23 16 19 22 #sue 8 22 17 14 32 17 ...
true
cca0db286b81980ff0def1e502f924a21b46d3c1
weiyuyan/LeetCode
/剑指offer/21. 斐波那契数列.py
574
4.125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:ShidongDu time:2020/2/11 ''' 输入一个整数 n ,求斐波那契数列的第 n 项。 假定从0开始,第0项为0。(n<=39) 样例 输入整数 n=5 返回 5 ''' class Solution(object): def Fibonacci(self, n): """ :type n: int :rtype: int """ res = [0, 1, 1] if n <= 2: ...
false
0dca0b990610cc3d92d4e89e3cc33fd367b63abc
weiyuyan/LeetCode
/24. 两两交换链表中的节点.py
2,180
4.125
4
#!usr/bin/env python # -*- coding:utf-8 -*- # author: ShidongDu time:2020/1/13 ''' 给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 示例: 给定 1->2->3->4, 你应该返回 2->1->4->3. ''' #Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None # ...
false
7ee4ed2d1167372fad229e6daf1958767613e19b
weiyuyan/LeetCode
/AcWing算法基础课/堆/838. 堆排序.py
1,653
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:ShidongDu time:2020/3/17 ''' 输入一个长度为n的整数数列,从小到大输出前m小的数。 输入格式 第一行包含整数n和m。 第二行包含n个整数,表示整数数列。 输出格式 共一行,包含m个整数,表示整数数列中前m小的数。 数据范围 1≤m≤n≤105, 1≤数列中元素≤109 输入样例: 5 3 4 5 1 3 2 输出样例: 1 2 3 ''' # 如何手写一个堆? # 1、插入一个数 # 2、求集合中的最小值 # 3、删除最小值 # 4、删除任意一个元素 # 5、修改任意一个元素 # 堆是一...
false
da656c7b187d415acfe8ebe2f8180d42582bed8a
weiyuyan/LeetCode
/每日一题/March/面试题 10.01. 合并排序的数组.py
2,114
4.3125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:ShidongDu time:2020/3/3 ''' 给定两个排序后的数组 A 和 B,其中 A 的末端有足够的缓冲空间容纳 B。 编写一个方法,将 B 合并入 A 并排序。 初始化 A 和 B 的元素数量分别为 m 和 n。 示例: 输入: A = [1,2,3,0,0,0], m = 3 B = [2,5,6], n = 3 输出: [1,2,2,3,5,6] ''' from typing import List # 第一种方法:直接拼接到A的尾部然后使用sort()方法排序 # class So...
false
12185824be7220a825a20e5ff5dd522e4f5f7523
Kostiancheck/dict
/home_task_matrix/task6.py
810
4.15625
4
"""Дан двумерный массив и два числа: i и j. Поменяйте в массиве столбцы с номерами i и j и выведите результат. Программа получает на вход размеры массива n и m, затем элементы массива, затем числа i и j. """ n=int(input('n=')) m=int(input('m=')) list=[[int(input('Введіть число ')) for j in range(m)]for i in ra...
false
61cbccec85567b98ffced9ee24e41e1d83b36654
PickUpLiu/day1
/day3/my_toninght.py
1,375
4.25
4
# 等边三角形 # 九九乘法表 def multiplicationTable(num=9): i = 1 while i <= num: j = 1 while j <= i: print(j, "X", i, "=", str(j * i).rjust(2), end="") j += 1 i += 1 print() # 菱形 def rhombus(num=10): num = num // 2 i = 1 while i <= num: j = num ...
false
e59b96d2f3400e5f8b52cb8a26ee3e7479913d29
dhoshya/grokking-algorithms
/quickSort.py
440
4.15625
4
# D&C def quickSort(arr): # base case if len(arr) < 2: return arr else: pivot = arr[0] # using list comprehension less = [i for i in arr[1:] if i <= pivot] # using normal syntax greater = list() for i in arr[1:]: if i >= pivot: ...
true
c58f7ad55fb459f14ee2d6535fd887063a9850f9
renato130182/app_python
/aula5.py
1,243
4.21875
4
lista = [1,3,5,7] listaAnimal = ['cachorro','gato','elefante'] print(type(lista)) print(lista) # pode conter tipos de dados diferentes print(listaAnimal[0]) for x in listaAnimal: # x assume o valor na possição da lista print(x) print(sum(lista)) print(max(lista)) print(min(lista)) print(min(listaAnimal)) # segue ...
false
e44f1c6cef22aedc4f5114c69f0260f2a37646a9
AniketKul/learning-python3
/ordereddictionaries.py
849
4.3125
4
''' Ordered dictionaries: they remember the insertion order. So when we iterate over them, they return values in the order they were inserted. For normal dictionary, when we test to see whether two dictionaries are equal, this equality os only based on their K and V. For ordered dictionary, when we test to see whethe...
true
b3cfd1cdfbb6800a2b610571b1f720fd5219b8e2
katherineggs/estructura-datos
/Search Sort/Sort.py
1,804
4.25
4
#INSERTION SORT def InsertionSort(array): for i in range(1, len(array)): key = array[i] num = i - 1 while (num >= 0) and (key < array[num]): array[num+1] = array[num] num -= 1 array[num+1] = key return array def MergeSort(array): if len(array) > 1: ...
false
f4451ce74fd1b6d16856f09f21f2eee9ae8c8f9a
jorricarter/PythonLab1
/Lab1Part2.py
523
4.125
4
#todo get input currentPhrase = input("If you provide me with words, I will convert them into a camelCase variable name.\n") #todo separate by word #found .title @stackoverflow while looking for way to make all lowercase wordList = currentPhrase.title().split() #todo all lowercase start with uppercase #found .title() t...
true
d51e758b43989603f02fc40214a03a970be2d4d1
KishorP6/PySample
/LC - Decission.py
1,362
4.34375
4
##Input Format : ##Input consists of 8 integers, where the first 2 integers corresponds to the fare and duration in hours through train, the next 2 integers corresponds to the fare and duration in hours though bus and the next 2 integers similarly for flight, respectively. The last 2 integers corresponds to the fare an...
true
ddeadc23b291498c7873533b16bf78c945670b2c
CStage/MIT-Git
/MIT/Lectures/Lecture 8.py
1,429
4.125
4
#Search allows me to search for a key within a sorted list #s is the list and e is what we search for #i is the index, and the code basically says that while i is shorter than the the #length of the list and no answer has been given yet (whether true or false) #then it should keep looking through s to see if it can fin...
true
9e11800cd87f7fa6c523cf6e0f6869e2ce59fb66
jacobeskin/Moon-Travel
/kuumatka_xv.py
1,828
4.25
4
import itertools import numpy as np import matplotlib.pyplot as plot # Numerical calculation and visualisation of the change in position # and velocity of a spacecraft when it travels to the moon. Newtons # law of gravitation and second law of motion are used. Derivative is # evaluated with simple Euler method. This ...
true
e050bf9dbde856f206bac59513c3a19e47e23a92
nwelsh/PythonProjects
/lesson3.py
408
4.28125
4
#Lesson 3 I am learning string formatting. String formatting in python is very similar to C. #https://www.learnpython.org/en/String_Formatting name = "Nicole" print("Hello, %s" % name) #s is string, d is digit, f is float (like c) age = 21 print("%s is %d years old" % (name, age)) data = ("Nicole", "Welsh", 21.1) f...
true
05865082b9f165c102b359cd9deb8a53f1e78d87
nwelsh/PythonProjects
/lesson9.py
663
4.15625
4
# lesson 9: https://www.learnpython.org/en/Dictionaries phonebook = {} phonebook["John"] = 938477566 phonebook["Jack"] = 938377264 phonebook["Jill"] = 947662781 print(phonebook) # prints: {'John': 938477566, 'Jack': 938377264, 'Jill': 947662781} phonebook2 = { "John" : 938477566, "Jack" : 938377264, "Jill...
false
cad277b1a2ca68f6a4d73edc25c2680120b88137
tanvirtin/gdrive-sync
/scripts/File.py
1,380
4.125
4
''' Class Name: File Purpose: The purpose of this class is represent data of a particular file in a file system. ''' class File: def __init__(self, name = None, directory = None, date = None, fId = None, folderId = None, extension = ""): self.__name = name self.__directory = directory self.__date = date ...
true
caa33fdad5d9812eb473d03a497c46d6a0ad71f2
YasirQR/Interactive-Programming-with-python
/guess_number.py
1,963
4.21875
4
# template for "Guess the number" mini-project # input will come from buttons and an input field # all output for the game will be printed in the console import math import random import simplegui num_range = 100 count = 0 stop = 7 # helper function to start and restart the game def new_game(): #...
true
1c10a0791d3585aa56a5b6c88d133b7ea98a8b24
haydenbanting/LawnBot
/Mapping/mapping_functions/matrix_builder.py
2,029
4.25
4
''' Function for creating matricies for map routing algorithms Author: Kristian Melo Version: 15 Jan 2018 ''' ######################################################################################################################## ##Imports ##############################################################################...
true
22cee07f314c33d643c68081ee0575b51d59f518
deycyrubi/ProyectoUnidad3
/DistanciaEuclidea.py
1,445
4.15625
4
""" >>> numero = DistanciaEuclidea(2,2,4,4,) >>> numero.CalDistancia() >>> numero.getDistancia() 2.8284271247461903 """ #Se declara la palabra reservada math para la resolución del problema import math #Se declara la clase la cual lleva por nombre el problema a resolver class DistanciaEuclidea: """Se declaran los...
false
66d85d4d119be319d62c133c1456c91a630291db
10zink/MyPythonCode
/HotDog/hotdog.py
1,624
4.1875
4
import time import random import Epic # Programmed by Tenzin Khunkhyen # 3/5/17 for my Python Class # HotDogContest #function that checks the user's guess with the actual winner and then returns a prompt. def correct(guess, winner): if guess.lower() == winner.lower(): statement = "\nYou gusses right, ...
true
0b18e86b3b5c414604e6cf3e35618770998043a9
10zink/MyPythonCode
/Exam5/Store.py
1,448
4.46875
4
import json import Epic # Programmed by Tenzin Khunkhyen # 4/16/17 for my Python Class # This program is for Exam 5 # This program just reads a json file and then prints information from a dictionary based on either # a category search or a keyword search. #This function reads the json file and converts it into a ...
true
c601c685111500976d62442a4e2be11bb928ee77
justdave001/Algorithms-and-data-structures
/SelectionSort.py
524
4.1875
4
""" Sort array using brute force (comparing value in array with sucessive values and then picking the lowest value """ #Time complexity = O(n^2) #Space complexity = O(1) def selection_sort(array): for i in range(len(array)): for j in range(i+1, len(array)): if array[i] > array[j]: ...
true
3c8df58e0135bd806acd5735d66bf42e718cd49d
signoreankit/PythonLearn
/numbers.py
551
4.1875
4
""" Integer - Whole numbers, eg: 0, 43,77 etc. Floating point numbers - Numbers with a decimal """ # Addition print('Addition', 2+2) # Subtraction print('Subtraction', 3-2) # Division print('Division', 3/4) # Multiplication print('Multiplication', 5*7) # Modulo or Mod operator - returns the remained after ...
true
223070725f14bb3d977bb67a41830942263aacd7
Hazel-K/Python3
/code05/main.py
773
4.21875
4
# num_tuple = (1, 2, 3) # num_tuple[0] = 0 #TypeError: 'tuple' object does not support item assignment # del num_tuple[0] #TypeError: 'tuple' object does not support item assignment # print(num_tuple) # 튜플 형태의 값은 수정 삭제가 불가능 # num_set = {1, 1, 2, 2, 3, 3} # {1,2,3} 중복 제거됨 # num_set.add(4) # print(num_set) # 순서를 갖지 않으므로...
false
3b6559c4f2511789a65a458111ba32103cf340a6
tjrobinson/LeoPython
/codes.py
2,373
4.21875
4
for x in range(0,2): userchoice = input("Do you want to encrypt or decrypt?") userchoice = userchoice.lower() if userchoice == "encrypt": Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" StringToEncrypt = input("Please enter a message to encrypt: ") StringToEncrypt =...
true
44d05ed22e742656562ce9179d63dee9cc2d8980
redjax/practice-python-exercises
/06-string-lists.py
567
4.375
4
""" Ask the user for a string and print out whether this string is a palindrome or not. (A palindrome is a string that reads the same forwards and backwards.) """ test = [0, 1, 2, 3, 4, 5] # print(test[::-1]) word_input = input("Enter a word, we'll tell you if it's a palindrome: ") def reverse_word(word): reve...
true
d1a6dcf4f6b6600117789e857ad84636cb1788e6
Deniska10K/stepik
/2.2-print_and_input_commands/4.star_triangle.py
216
4.125
4
""" Напишите программу, которая выводит указанный треугольник, состоящий из звездочек (*). """ print('\n'.join(['*' * i for i in range(1, 8)]))
false
abde6bffef26afe110d05c19e45f8a4b34b8eb8f
Deniska10K/stepik
/4.3-nested_and_cascading_conditions/5.weighing_ceremony.py
1,007
4.34375
4
""" Известен вес боксера-любителя (целое число). Известно, что вес таков, что боксер может быть отнесён к одной из трех весовых категорий: Легкий вес – до 60 кг; Первый полусредний вес – до 64 кг; Полусредний вес – до 69 кг. Напишите программу, определяющую, в какой категории будет выступать данный боксер...
false
ec5e93dd759250bef6aa51d6e7cb1d855ac7cd3c
Deniska10K/stepik
/4.2-logical_operations/3.accessory_3.py
621
4.21875
4
""" Напишите программу, которая принимает целое число x и определяет, принадлежит ли данное число указанным промежуткам. Формат входных данных На вход программе подаётся целое число x. Формат выходных данных Программа должна вывести текст в соответствии с условием задачи. """ n = int(input()) print("Принадлежит" if ...
false
39baba3140cfc6610e60228f6383c2ad3f3e2b6d
Deniska10K/stepik
/6.2-math_module/4.trigonometric_expression.py
1,172
4.21875
4
""" Напишите программу, вычисляющую значение тригонометрического выражения sin(x) + cos(x) + tan(x)^2 по заданному числу градусов x. Формат входных данных На вход программе подается одно вещественное число x измеряемое в градусах. Формат выходных данных Программа должна вывести одно число – значение тригонометрическо...
false
52b709291cc74e7102018d71c409c4c2c0c104df
Deniska10K/stepik
/6.2-math_module/5.floor_and_ceiling.py
653
4.34375
4
""" Напишите программу, вычисляющую значение ⌈x⌉ и ⌊x⌋ по заданному вещественному числу x. Формат входных данных На вход программе подается одно вещественное число xxx. Формат выходных данных Программа должна вывести одно число – значение указанного выражения. Примечание. ⌈x⌉ – потолок числа, ⌊x⌋ – пол числа. """ f...
false
44d1a4c1b852cf467408fc42ed5c155bfb5439e9
Deniska10K/stepik
/6.1-numeric_data_types_int_float/3.reverse_number.py
877
4.375
4
""" Напишите программу, которая считывает с клавиатуры одно число и выводит обратное ему. Если при этом введённое с клавиатуры число – ноль, то вывести «Обратного числа не существует» (без кавычек). Формат входных данных На вход программе подается одно действительное число. Формат выходных данных Программа должна выв...
false
510de01b1b80cc1684faaf2441dd5154bdd52b7c
zaydalameddine/Breast-Cancer-Classifier
/breastCancerClassifier.py
1,959
4.125
4
# importing a binary database from sklearn from sklearn.datasets import load_breast_cancer # importing the splitting function from sklearn.model_selection import train_test_split # importing the KNeighborsClassifier from sklearn.neighbors import KNeighborsClassifier import matplotlib.pyplot as plt # loading the databs...
true
b0a6d7b51978c4ed6691bc4542e63d63f90fc36a
mirandaday16/intent_chatbot
/formatting.py
301
4.25
4
# Capitalizes the first letter of every word in a string, e.g. for city names # Parameters: a place name (string) entered by the user def cap_first_letters(phrase): phrase_list = [word[0].upper() + word[1:] for word in phrase.split()] cap_phrase = " ".join(phrase_list) return cap_phrase
true
adc452c82b5e6a0346987e640bcd8364578e0ac6
MLBott/python-fundamentals-student
/A1/243 assignment 1 Michael Bottom.py
1,909
4.125
4
""" Author: Michael Bottom Date: 1/14/2019 """ import math def lowestNumListSum(firstList, secondList): """ This function accepts two lists of numbers and returns the sum of the lowest numbers from each list. """ firstList.sort() secondList.sort() sumTwoLowest = firstList[0] + secondList...
true
993fc1680d80170a6ddbc8464baae21aa1215c8d
sritar99/Ds-n-algos
/queue.py
820
4.21875
4
#Implementing queue's in python from exc import Empty class ArrayQueue: def __init__(self): self._data=[] self._front=0 self._rear=0 def length(self): return len(self._data) def is_empty(self): return self._front and self._rear == 0 def enque(self,n): self._data.append(n) self._rear+=1 def deque(...
false
93542a99082c9944497ae78bf2f4589d6985e56c
adithyagonti/pythoncode
/factorial.py
260
4.25
4
num=int(input('enter the value')) if num<0: print('no factorial for _ve numbers') elif num==0: print('the factorial of 0 is 1') else: fact=1 for i in range(1,num+1): fact= fact*i print("the factorial of", num,"is",fact)
true
b6456f6c87553fab9af92919b1505a90bf675ad8
geediegram/parsel_tongue
/ozioma/sleep_schedule.py
651
4.15625
4
# Ann inputs the excepted hours of sleep, the excess no of hours and no of sleep hours # First number is always lesser than the second number # If sleep hour is less than first number, display "Deficiency" # If sleep hour is greater than second number, display "Excess" # If sleep hour is greater than sleep hour and les...
true
2edfabb63a04e58a1987cb9935140691549c1911
geediegram/parsel_tongue
/goodnew/main.py
1,443
4.46875
4
from functions import exercise if __name__ == "__main__": print(""" Kindly choose any of the options to select the operation to perform 1. max_of_three_numbers 2. sum_of_numbers_in_a_list 3. product_of_numbers_in_a_list 4. reverse-string 5. factorial_of_number ...
true
9874493316bff21ba4af60b6e245ff793ff65eaf
geediegram/parsel_tongue
/precious/if_elif_else/triangle.py
425
4.34375
4
print("the triangle is valid" if int(input()) + int(input()) + int(input()) == 180 else "invalid triangle") triangle_angle_one = int(input("Enter first angle \n")) triangle_angle_two = int(input("Enter second angle \n")) triangle_angle_three = int(input("Enter third angle \n")) if triangle_angle_one + triangle_angle_t...
false
3d87c8c63add0168a40d51dcc7258dfb2f733b23
geediegram/parsel_tongue
/solomon/weird_numbers.py
216
4.21875
4
number = int(input("Enter number: ")) if number % 2 == 0 and number > 20 or 2 <= number <= 6: print("Not weird") else: print("Weird") # if (number % 2 == 0 and number >= 6 and number <= 20): # print("Weird")
false
5f24adb4960ef8fbe41b5659321ef59c1143d2b1
geediegram/parsel_tongue
/Emmanuel/main.py
877
4.28125
4
from functions import exercise if __name__== "__main__": print(""" 1. Check for maximum number 2. Sum of numbers in a list 3. Multiple of numbers in a list 4. Reverse strings 5. Factorial of number 6. Number in given range 7. String counter 8. List un...
true
6e456e8a3206d57ab9041c2cbc00013701ed3345
geediegram/parsel_tongue
/ozioma/positive_and_negative_integer.py
363
4.5625
5
# take a number as input # if the number is less than 0, print "Negative!" # if the number is greater than 0, print "Positive!" # if the number is equal to 0, print "Zero!" print('Enter a value: ') integer_value = int(input()) if integer_value < 0: print('Negative!') elif integer_value > 0: print('Positive!') ...
true
4dfbf66266a20143fc1f3ef6095dbe11b995f3e3
victorkwak/Projects
/Personal/FizzBuzz.py
884
4.1875
4
# So I heard about this problem while browsing the Internet and how it's notorious for stumping like 99% # of programmers during interviews. I thought I would try my hand at it. After looking up the specifics, # I found that FizzBuzz is actually a children's game. # # From Wikipedia: Fizz buzz is a group word game for ...
true
b05ab548d4bb352e48135c2a0afd2a4a6251e9ea
whencespence/python
/unit-2/homework/hw-3.py
282
4.25
4
# Write a program that will calculate the number of spaces in the following string: 'Python Programming at General Assembly is Awesome!!' string = 'Python Programming at General Assembly is Awesome!!' spaces = 0 for letter in string: if letter == ' ': spaces += 1 print(spaces)
true
67e2747d9d16e1b2ba8137c0d96fc1419a75868e
aryanicosa/praxis-academy
/praxis-academy/novice/05-01/latihan/latihan-serialization.py
1,396
4.21875
4
# serialization, merubah data ke format yang dapat disimpan/dibagikan. # memungkinkan untuk dikembalikan kembali (deserialization) # serialization process in python called "pickling" # dengan pickling kita dapat mengkonversi tingkatan object ke binary format dan dapat disimpan # contoh import pickle class Animal(): ...
false
cfeb8cd2427bfac3c448c16eb217e3d01152d005
bm7at/wd1_2018
/python_00200_inputs_loops_lists_dicts/example_00920_list_methods_exercise.py
336
4.34375
4
# create an empty list called planets # append the planet "earth" to this list # print your list planet_list = [] # append planet_list.append("earth") print planet_list # [1, 2, 3, 4, 5] # now extend your planets list # with the planets: "venus", "mars" # print your list planet_list.extend(["venus", "mars"]) pri...
true
c76237f309750c23a148929b45f08b7a34cac668
jloiola6/cursos
/Alura/Python/Python para Data Science/Python para Data Science Funções, Pacotes e Pandas básico/1.py
734
4.125
4
import pandas as pd # Pandas só esta funcionando na versão 3.6 do python # pd.set_option('display.max_rows', 100) # Declaramso o numero maximo de linha que sera mostrado # pd.set_option('display.max_columns', 10) # Declaramso o numero maximo de colunas que serão mostrado dataset = pd.read_csv('Python_Data_Science\Pand...
false
863a49bc96fdd2a69ed681d50b83032818e32c05
hyeonjiseon/introduction-to-software
/coffeereview.py
1,645
4.25
4
#커피샵의 고객 마족도 점 수를 관리하는 프로그램을 사전 리스트를 사용하여 만든다. #커피샵의 평점을 입력받아 사전에 저장하고 탐색, 삭제하는 프로그램 def print_menu(): print('1. Show all coffeeshop review') print('2. Add coffee shop review') print('3. Delete coffeeshop review') print('4. Search coffeeshop') print('5. Exit') def show_review(reviews): print()...
false
dfc679815218037a7d1926ad153c23875d61dd64
Mwai-jnr/Py_Trials
/class_01/l28.py
735
4.34375
4
#if statements ## start name = "victor" if name == "victor": print("you are welcome") else: print('you are not welcome') # example 2 age = '15' if age <= '17': print("you are under age") else: print("you can visit the site") # example 3 # two if statements age = '17' if age <='17': ...
true
66948e9a7ce8e8114d8a492300d48506a2e4c30b
Mwai-jnr/Py_Trials
/class_01/L37.py
854
4.46875
4
# Loops. # For Loop. #Example 1 #for x in range (0,10): # print('hello') #Example 2 #print(list(range(10,20))) # the last no is not included when looping through a list #Example 3 #for x in range(0,5): # print('Hello %s' % x) # %s acts as a placeholder in strings #it is used when you want to ins...
true
6bbe9e80f879c703b375b52b8e8b3ca5ea16b9f5
deepakkmr896/nearest_prime_number
/Nearby_Prime.py
998
4.1875
4
input_val = int(input("Input a value\n")) # Get the input from the entered number nearestPrimeNum = []; # Define a function to check the prime number def isPrime(num): isPrime = True for i in range(2, (num // 2) + 1): if(num % i == 0): isPrime = False return isPrime # Assuming 10 as th...
true
a9067a7adee78d3a72e2cd379d743dd360ed2795
joelamajors/TreehouseCourses
/Python/Learn Python/2 Collections/4 Tuples/intro_to_tuples.py
578
4.5625
5
my_tuple = (1, 2, 3) # tuple created my_second_tuple = 1, 2, 3 # this is a tuple too # the commas are necesary! my_third_tuple = (5) # not a tuple my_third_tuple = (5,) # parenthesis are not necessary, but helpful. dir(my_tuple) # will give you all the stuff you can do. Not much! # you can edit _stuff_ within a ...
true
8824bf993e2383393d16357e6a318fd27e8e0525
joelamajors/TreehouseCourses
/Python/Learn Python/2 Collections/5 Sets/set_math_challenge.py
2,248
4.4375
4
# Challenge Task 1 of 2 # Let's write some functions to explore set math a bit more. # We're going to be using this # COURSES # dict in all of the examples. # _Don't change it, though!_ # So, first, write a function named # covers # that accepts a single parameter, a set of topics. # Have the function return a list of...
true
135b08e8fbbf31e611e7c8e0e3f0abb4c83f1c71
Nick-Nch/gb_1lesson_task
/task-1.py
245
4.125
4
a = 'Hello!' first_name = input('Введите ваше имя:') last_name = input('Введи вашу фамилию: ') age = input('Введите ваш возраст: ') print(a + ' ' + first_name + ' ' + last_name + ' ' + str(age))
false
e0dc49212a72b8f58ba69c192bf48e41718d93c5
brian-sherman/Python
/C859 Intro to Python/Challenges/11 Modules/11_9 Extra Practice/Task1.py
434
4.21875
4
""" Complete the function that takes an integer as input and returns the factorial of that integer from math import factorial def calculate(x): # Student code goes here print(calculate(3)) #expected outcome: 6 print(calculate(9)) #expected outcome: 362880 """ from math import factorial def calculate(x): f = ...
true
4b775221b8af334d4b2f8b9af0c64ecd2d3c9724
brian-sherman/Python
/C859 Intro to Python/Challenges/09 Lists and Dictionaries/9_5_1_Multiplication_Table.py
548
4.25
4
""" Print the two-dimensional list mult_table by row and column. Hint: Use nested loops. Sample output for the given program: 1 | 2 | 3 2 | 4 | 6 3 | 6 | 9 """ mult_table = [ [1, 2, 3], [2, 4, 6], [3, 6, 9] ] for row in mult_table: for element in row: list_len = len(row) current_id...
true
fd3d0f0a14900b339535fc94ef21b59619ba66e1
brian-sherman/Python
/C859 Intro to Python/Challenges/06 Loops/6_8_2_Histogram.py
797
4.96875
5
""" Here is a nested loop example that graphically depicts an integer's magnitude by using asterisks, creating what is commonly called a histogram: Run the program below and observe the output. Modify the program to print one asterisk per 5 units. So if the user enters 40, print 8 asterisks. num = 0 while num >= 0...
true
6da6609432fd57bc89e4097da96dcd60e80cb94c
brian-sherman/Python
/C859 Intro to Python/Challenges/09 Lists and Dictionaries/9_15_1_Nested_Dictionaries.py
2,843
4.96875
5
""" The following example demonstrates a program that uses 3 levels of nested dictionaries to create a simple music library. The following program uses nested dictionaries to store a small music library. Extend the program such that a user can add artists, albums, and songs to the library. First, add a command that ...
true
ffd50de6b5a8965a8b34db611bd115d2939df135
brian-sherman/Python
/C859 Intro to Python/Challenges/09 Lists and Dictionaries/9_3_1_Iteration.py
1,068
4.4375
4
""" Here is another example computing the sum of a list of integers. Note that the code is somewhat different than the code computing the max even value. For computing the sum, the program initializes a variable sum to 0, then simply adds the current iteration's list element value to that sum. Run the program below...
true
f1b2c6a2815b2621cab190582196521ec04da9e2
brian-sherman/Python
/C859 Intro to Python/Challenges/07 Functions/7_17_1_Gas_Volume.py
678
4.375
4
""" Define a function compute_gas_volume that returns the volume of a gas given parameters pressure, temperature, and moles. Use the gas equation PV = nRT, where P is pressure in Pascals, V is volume in cubic meters, n is number of moles, R is the gas constant 8.3144621 ( J / (mol*K)), and T is temperature in Ke...
true
0c123a95902de5efa3ecb815f22a3d242e376623
brian-sherman/Python
/C859 Intro to Python/Challenges/06 Loops/6_4_2_Print_Output_Using_Counter.py
330
4.46875
4
""" Retype and run, note incorrect behavior. Then fix errors in the code, which should print num_stars asterisks. while num_printed != num_stars: print('*') Sample output for the correct program when num_stars is 3: * * * """ num_stars = 3 num_printed = 0 while num_printed != num_stars: print('*') num_pri...
true
de8809d34f4bd91b00fb0b56d2835b3464c6ce3a
brian-sherman/Python
/C859 Intro to Python/Challenges/08 Strings/8_4_5_Area_Code.py
256
4.21875
4
""" Assign number_segments with phone_number split by the hyphens. Sample output from given program: Area code: 977 """ phone_number = '977-555-3221' number_segments = phone_number.split('-') area_code = number_segments[0] print('Area code:', area_code)
true
2f13722b0bd4d477768080b375bdd904af9da065
brian-sherman/Python
/C859 Intro to Python/Challenges/08 Strings/8_6 Additional Practice/Task_2_Reverse.py
294
4.21875
4
# Complete the function to return the last X number of characters # in the given string def getLast(mystring, x): str_x = mystring[-x:] return str_x # expected output: IT print(getLast('WGU College of IT', 2)) # expected output: College of IT print(getLast('WGU College of IT', 13))
true
0416f7bd9af4ef2845a77eb966ab0a21afd7fd64
brian-sherman/Python
/C859 Intro to Python/Boot Camp/Week 1/2_Calculator.py
1,871
4.4375
4
""" 2. Basic Arithmetic Example: Write a simple calculator program that prints the following menu: 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Quit The user selects the number of the desired operation from the menu. Prompt the user to enter two numbers and return the calculation result. Exa...
true
444195237db2c8f053a44b172038335f9d02567e
brian-sherman/Python
/C859 Intro to Python/Challenges/06 Loops/6_8_1_Print_Rectangle.py
256
4.5
4
""" Write nested loops to print a rectangle. Sample output for given program: * * * * * * """ num_rows = 2 num_cols = 3 for row in range(num_rows): print('*', end=' ') for column in range(num_cols - 1): print('*', end=' ') print('')
true
3cf756ebdd38a6a5ff233af1ba998c12f7ed1fa3
brian-sherman/Python
/C859 Intro to Python/Boot Camp/Week 1/8_Tuple_Example.py
534
4.625
5
""" 8. Tuple Example: Read a tuple from user as input and print another tuple with the first and last item, and your name in the middle. For example, if the input tuple is ("this", "is", "input", "tuple"), the return value should be ("this", "Rabor", "tuple") Example One: Enter your name to append into the tuple: ...
true
68150df94d2940bb980649e15c56a07194cb59fb
imharrisonlin/Runestone-Data-Structures-and-Algorithms
/Algorithms/Sorting/Quick_Sort.py
2,138
4.21875
4
# Quick sort # Uses devide and conquer similar to merge sort # while not using additional storage compared to merge sort (creating left and right half of the list) # It is possible that the list may not be divided in half # Recursive call on quicksortHelper # Base case: first < last (if len(list) <= 1 list is sorted) #...
true
47a4339979a4787b4e44cb5e6ff519033bbfe2e3
avkramarov/gb_python
/lesson 5/Задание 1.py
600
4.25
4
# Создать программно файл в текстовом формате, записать в него построчно данные, # вводимые пользователем. Об окончании ввода данных свидетельствует пустая строка. lines = [] new_item = input("Введите значение >>>") while new_item != "": lines.append(new_item) new_item = input("Введите значение >>>") ...
false
b18daeacb7de198085e4064b05755f63a49bb040
avkramarov/gb_python
/lesson 4/Задание 7.py
866
4.25
4
# Реализовать генератор с помощью функции с ключевым словом yield, # создающим очередное значение. # При вызове функции должен создаваться объект-генератор. # Функция должна вызываться следующим образом: for el in fact(n). # Функция отвечает за получение факториала числа, # а в цикле необходимо выводить только пер...
false
ce1e57eb3168263137047a967c2223b65017ec89
kzmorales92/Level-2
/M3P2a.py
250
4.3125
4
#Karen Morales # 04/22/19 #Mod 3.2b #Write a recursive function to reverse a list. fruitList = ["apples", "bananas", "oranges", "pears"] def reverse (lst) : return [ lst[-1]]+ reverse (lst[:-1]) if lst else [] print (reverse(fruitList))
true
85d986e6a42307635cd237b666f0724a27537b16
claudiogar/learningPython
/problems/ctci/e3_5_sortStack.py
1,024
4.15625
4
# CTCI 3.5: Write a program to sort a stack such that the smallest items are on the top. You can use an additional temporary stack, but you may not copy the elements into any other data structure. The stack supports the following operations: push, pop, peek, and isEmpty. class SortedStack: def __init__(self): ...
true
86fccf5df89eb49af7ab1b269cc9696fe2254291
nanareyes/CicloUno-Python
/Condicionales/ejercicio6-otraversion_condicional.py
1,045
4.1875
4
''' Elabora un algoritmo que permita ingresar el monto de la venta alcanzada por un vendedor durante un mes, se debe calcular la bonificación (%) que tiene derecho de acuerdo a la siguiente tabla: 0 - 1000.000 Bonificación 0 1.000.100 - 2.500.000 Bonificacion 0.04 2.500.100 o más Bonificación 0.08...
false
3c110c3201336c827c7f7d5809ab36e98696d2b9
nanareyes/CicloUno-Python
/FuncionesParaColeccionesDatos/ejercicioClase.py
674
4.15625
4
""" 1. Crear una función que determine el equipo de futbol, cuyo nombre inicie con la letra “T”, utilizar la función map para iterar en la lista equipos. equipos = ["América", "Millonarios", "Tolima", "Cali", "Junior"] Generar una lista de resultado que indique con true los nombres que inicien con la letra “T” y ...
false
09db9780bc26c56191551748452edf5b31cc3cda
nanareyes/CicloUno-Python
/Nivelacion_1/condicionales_nivelacion.py
1,375
4.3125
4
# Para los condicionales utilizo comparadores de decisión ''' En los diagramas de flujo el condicional se expresa en rombo utiliza comparadores de decisión (> < == !=) y operadores lógicos ( y(and) o(or) no(not)) ''' ''' Se necesita saber si el estudiante tuvo alto, medio o bajo rendimiento [0;3) Rendimiento bajo [3;...
false
ffebce985975962495b6698d90e759783f4daa5f
nanareyes/CicloUno-Python
/FuncionesParaColeccionesDatos/funciones_anonimas_FilterLambda.py
1,167
4.65625
5
# FUNCIONES ANONIMAS """ Habrá ocasiones en las cuales necesitemos crear funciones de manera rápida, en tiempo de ejecución. Funciones, las cuales realizan una tarea en concreto, regularmente pequeña. En estos casos haremos uso de funciones lambda. ------------------------------------------------- lambda argumento : ...
false
4bb4253b47123e8791aa1b674881f30da6a4f03c
kongruksiamza/PythonBeginner
/Phase2/EP39.Assignment3.py
491
4.125
4
# Assignment หากลุ่มเลขคู่ / เลขคี่ number=[] odd=[] #เลขคี่ even=[] #เลขคู่ while True: x=int(input("ป้อนตัวเลขของคุณ :")) if x<0: break if x%2 == 0: even.append(x) else : odd.append(x) number.append(x) print("ตัวเลขทั้งหมด =>" ,number) print("เลขคู่ => ",eve...
false
4e9dcaa32b8662fb64d27faa933a01d47cc0caf8
Harjacober/HackerrankSolvedProblems
/Python/Regex Substitution.py
311
4.15625
4
# Enter your code here. Read input from STDIN. Print output to STDOUT import re def substitution(string): string = re.sub(r'((?<=\s)&&(?=\s))','and', string) string = re.sub(r'(?<=\s)\|\|(?=\s)','or', string) return string N = int(input()) for i in range(N): print(substitution(input()))
true
45063d790455032ec43c9407c1e71b4453845f5d
adityarsingh/python-blockchain
/backend/util/cryptohash.py
799
4.15625
4
import hashlib #it is library that includes the sha256 function import json def crypto_hash(*args): """ This function will return SHA-256 hash of the given arguments. """ stringed_args = sorted(map(lambda data: json.dumps(data),args)) #Lambda functions can have any number of arguments but only one ex...
true
968e67c487bc93767de11e74957b8af63e716fe9
vjishnu/python_101
/quadratic.py
591
4.15625
4
from math import sqrt #import sqrt function from math a = int(input("Enter the 1st coifficient")) # read from user b = int(input("Enter the 2st coifficient")) # read from user c = int(input("Enter the 3st coifficient")) # read from user disc = b**2 - 4*a*c # to find the discriminent disc1 = sqrt(disc)# thn find the...
true
fd7b805579cf158999eebd8cb269c0de1f288b80
lucasgcb/daily
/challenges/Mai-19-19/Python/solution.py
815
4.15625
4
def number_finder(number_list): """ This finds the missing integer using 2O(n) if you count the set operation. """ numbers = list(set(number_list)) ## Order the list # Performance of set is O(n) # https://www.oreilly.com/library/view/high-performance-python/9781449361747/ch04.html expected_i...
true
9fbf85740e7f3aa9f1e438ff0a51c5939294dac4
Meenawati/competitive-programming
/dict_in_list.py
522
4.40625
4
# Write a Python program to check if all dictionaries in a list are empty or not def dict_in_list(lst): for d in lst: if type(d) is not dict: print("All Elements of list are not dictionary") return False elif d: return False return True print(dict_in_list(...
true
40d9f9e8e046e5b41d83213bbea3540365d123e0
alfem/gamespit
/games/crazy-keys/__init__.py
1,577
4.15625
4
#!/usr/bin/python # -*- coding: utf8 -*- # Crazy Keys # My son loves hitting my keyboard. # So I made this silly program to show random colors on screen. # And maybe he will learn the letters! :-) # Author: Alfonso E.M. <alfonso@el-magnifico.org> # License: Free (GPL2) # Version: 1.0 - 8/Mar/2013 import ran...
true
e13468afe2fbfc7c8947e4caf735af756d18d6e6
ymjrchx/myProject
/pythonStudy/python-demo/Day07/tuple.py
613
4.375
4
""" 元组的定义和使用 Version: 0.1 Author: 骆昊 Date: 2018-03-06 """ def main(): t = ('骆昊', 38, True, '四川成都') print(t) print(t[0]) print(t[1]) print(t[2]) print(t[3]) for member in t: print(member) # t[0]='王大富' t = ('王大锤', 20, True, '云南昆明') print(t) person = list(t) print(pe...
false
28374d28e84a38789ce5810c2ffa642be798d855
ymjrchx/myProject
/pythonStudy/python-demo/Day09/car2.py
990
4.3125
4
""" 属性的使用 - 使用已有方法定义访问器/修改器/删除器 Version: 0.1 Author: 骆昊 Date: 2018-03-12 """ class Car(object): def __init__(self, brand, max_speed): self.set_brand(brand) self.set_max_speed(max_speed) def get_brand(self): return self._brand def set_brand(self, brand): self._brand = bran...
false
da4199473308b99e312b5b542252423592417d85
nabrink/DailyProgrammer
/challenge_218/challenge_218.py
342
4.15625
4
def to_palindromic(number, step): if len(number) <= 1 or step > 1000 or is_palindromic(number): return number else: return to_palindromic(str(int(number) + int(number[::-1])), step + 1) def is_palindromic(number): return number == number[::-1] number = input("Enter a number: ") print(to_pa...
true
fc9ae2f27b799e6c605421e2c01cff6989be0fd5
txazo/txazodevelop
/python/lession/Python-列表.py
1,018
4.3125
4
# ********************< 列表 >******************** list = [1, 2, 3, 4] print type(list), list # <type 'list'> [1, 2, 3, 4] # ********************< list函数 >******************** list = list("1234") print type(list), list # <type 'list'> [1, 2, 3, 4] # ********************< 列表元素赋值 >******************** list[0] = 1 # *...
false
c1f4f21c908dd6c8862868a096e012b77301831e
Teclanat/Curso_Python
/21_Vetores.py
346
4.125
4
__author__ = 'Natanael' #Trabalhando com Vetores #Inicializando o vetor vetor = [] n = int(input('Digite a quantidade de elementos a ser adicionada: ')) i = 0 while i < n: temp = input('Digite o elemento a ser adicionado: ') #Uso de append = adiciona um elemento no vetor vetor.append(temp) i = i + 1 ...
false
5c5625cca2c934141df40410f1496302c699da06
brasqo/pyp-w1-gw-language-detector
/language_detector/main.py
846
4.125
4
#!/usr/bin/python # -*- coding: utf-8 -*- from collections import defaultdict import operator """This is the entry point of the program.""" def detect_language(text, languages): """Returns the detected language of given text.""" # implement your solution here # create dictionary with same keys as l...
true
3f115dc4d77c49f3827e26674bac162ae8613b57
CodesterBoi/My-complete-works
/File Handling.py
2,273
4.125
4
''' #Reading from a file: car_name = input("Which car's stats do you want to display?") t = open("Car_stats.txt","r") end_of_file = False print(car_name) car_name = True while True: car_name = t.readline().strip() speed = t.readline().strip() acceleration = t.readline().strip() handling =...
true