blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
2f5785f87b438aa89bcc88f403048f69545259ac
oscar7692/python_files
/agendaPyton.py
2,929
4.15625
4
#!/usr/bin/python3.7 def menu(): print('******Directorio de Contactos******') print('1- Crear nombre de la lista') print('2- Agregar Contacto') print('3- Buscar en directorio') print('4- Editar contactos') print('5- Mostrar contactos') print('6- Cerrar directorio') print() def ...
false
87324442d3dabfdcae8ef4bbea84f21f1586d663
drdiek/Hippocampome
/Python/dir_swc_labels/lib/menu/select_processing.py
1,109
4.125
4
def select_processing_function(): reply = '' # main loop to display menu choices and accept input # terminates when user chooses to exit while (not reply): try: print("\033c"); # clear screen ## display menu ## print 'Please select ...
true
f77924a09f7f0fd2a7eafd266a54a653dd79d13b
dmikos/PythonExercises
/geekbrains.ru/lesson_7759-Интенсив по Python/gibbet.py
2,401
4.125
4
#!/usr/bin/python3 import random import turtle import sys # https://geekbrains.ru/lessons/7759 # 1:25:16 def gotoxy(x, y): #перемещаем курсор turtle.penup() turtle.goto(x, y) turtle.pendown() def draw_line(from_x, from_y, to_x, to_y): # gotoxy(from_x, from_y) turtle.goto(to_x, to_y) def dra...
false
f46893c5784cc16ad9c4bcaf19d47a126e1f02a5
Granbark/supreme-system
/binary_tree.py
1,080
4.125
4
class Node(): def __init__(self, value): self.value = value self.left = None self.right = None class BST(): def __init__(self): self.root = None def addNode(self, value): return Node(value) #returns a Node, see class def addBST(self, node, number): #node = current node, number is what yo...
true
6a5cf3421133b39a0108430efee4d3c9ba51933f
megnicd/programming-for-big-data_CA05
/CA05_PartB_MeganMcDonnell.py
2,112
4.1875
4
#iterator def city_generator(): yield("Konstanz") yield("Zurich") yield("Schaffhausen") yield("Stuttgart") x = city_generator() print x.next() print x.next() print x.next() print x.next() #print x.next() #there isnt a 5th element so you get a stopiteration error print "\n" citie...
true
0c0de06a03d52d8cf86523b07153d27032dd3cb0
sedakurt/pythonProject
/venv/conditionals.py
786
4.21875
4
#comparison Operastors ''' print(1 < 1) print(1 <= 1) print(1 > 1) print(1 >= 1) print(1 == 1) print(1 != 1) ''' ##if, elif, else code block #if name = input("What is your name? ") if name == "Seda": print("Hello, nice to see you {}".format(name)) elif name == "Bayraktar": print("Hello, you are a surname!") e...
false
4bb989ebaca1ed9e289611696a31e7db58cd04d1
tretyakovr/sobes-Lesson03
/Task-02.py
1,549
4.125
4
# Третьяков Роман Викторович # Факультет Geek University Python-разработки # Основы языка Python # Урок 3 # Задание 2: # Написать программу, которая запрашивает у пользователя ввод числа. На введенное число # она отвечает сообщением, целое оно или дробное. Если дробное — необходимо далее выполнить # сравнение чисел до ...
false
2d3fb98cd2c98c632c60fc9da686b6567c1ea68d
jaimedaniels94/100daysofcode
/day2/tip-calculator.py
402
4.15625
4
print("Welcome to the tip calculator!") bill = float(input("What was the total bill? $")) tip = int(input("What percentage tip would you like to give? 10, 12, or 15? ")) split = int(input("How many people will split the bill? ")) bill_with_tip = tip / 100 * bill + bill bill_per_person = bill_with_tip / split final_am...
true
17ec3f12074f33e8804dade2464a27e6c822602c
jaimedaniels94/100daysofcode
/day4/final.py
1,128
4.25
4
#Build a program to play rock, paper, scissors against the computer. import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______...
false
2b47e8987cc92f9069fa12915030329d764cf032
tomahim/project-euler
/python_solutions/problem3.py
780
4.125
4
from python_solutions.utils import timing @timing def compute_largest_prime_factor(value: int): denominator = 2 while denominator < value: disivion_result = value / denominator if disivion_result.is_integer(): value = disivion_result else: denominator += 1 r...
true
c70b8b6d2966f6620ad280ca6cabd29bac4cadc1
Harrywekesa/Sqlite-database
/using_place_holders.py
562
4.1875
4
import sqlite3 #Get personal data from the user aand insert it into a tuple First_name = input("Enter your first name: ") Last_name = input("Enter your last name: ") Age = input("Enter your age: ") personal_data = (First_name, Last_name, Age) #Execute insert statement for supplied personal data with sqlite3.connect("...
true
19e67b26e33be4b1b1ee557c3c9cb8043c251ecd
cuitianfeng/Python
/python3基础/5.Python修炼第五层/day5预习/协程函数.py
2,905
4.28125
4
#yield: #1:把函数的执行结果封装好__iter__和__next__,即得到一个迭代器 #2:与ruturn功能类似,都可以返回值, # 但不同的是,return只能返回一次值,而yield可以返回多次值 #3:函数暂停与再继续运行的状态是有yield保存 # def func(count): # print('start') # while True: # yield count # count+=1 # # g=func(10) # # print(g) # print(next(g)) # print(next(g)) # # ne...
false
b720f24465dda89e7ff7e6dd6f0fdde60fdb297d
vpreethamkashyap/plinux
/7-Python/3.py
1,594
4.21875
4
#!/usr/bin/python3 import sys import time import shutil import os import subprocess print ("\nThis Python script help you to understand Types of Operator \r\n") print ("Python language supports the following types of operators. \r\n") print ("Arithmetic Operators \r\n") print ("Comparison (Relational) Operators \r\n...
true
f0054948c66568ce30cb8d9e94d723b5179de097
MrCat9/HelloPython
/list中替换元素.py
298
4.21875
4
#先删除,在添加==替换 #对list中的某一个索引赋值,就可以直接用新的元素替换掉原来的元素,list包含的元素个数保持不变。 L = ['Adam', 'Lisa', 'Bart'] print(L) #['Adam', 'Lisa', 'Bart'] #L[2] = 'Paul' L[-1] = 'Paul' print(L) #['Adam', 'Lisa', 'Paul']
false
db59ee60efb684c780262407c276487760cca73c
RoshaniPatel10994/ITCS1140---Python-
/Array/Practice/Beginin array in lecture.py
1,815
4.5
4
# Create a program that will allow the user to keep track of snowfall over the course 5 months. # The program will ask what the snowfall was for each week of each month ans produce a total number # of inches and average. It will also print out the snowfall values and list the highest amount of snow and the lowest amo...
true
c3869c3a16815c7934e88768d75ee77a4bcc207d
RoshaniPatel10994/ITCS1140---Python-
/Quiz's/quiz 5/LookingForDatesPython.py
1,479
4.40625
4
#Looking For Dates Program #Written by: Betsy Jenaway #Date: July 31, 2012 #This program will load an array of names and an array of dates. It will then #ask the user for a name. The program will then look for the user in the list. #If the name is found in the list the user will get a message telling them #...
true
c4a91a468b3c96852d1365870230b15433f8007c
RoshaniPatel10994/ITCS1140---Python-
/Quiz's/quiz 2/chips.py
989
4.15625
4
# Roshani Patel # 2/10/20 # Chips # This program Calculate the cost of an order of chips. # Display program that will ask user how many bags of chips they want to buy. #In addition ask the user what size of bag. #If the bag is 8 oz the cost is 1.29 dollar if the bag is 16 oz then the cost is 3.59 dollars. #If ...
true
a95bdaa18d1b88eb8d178998f6af8f1066939c81
Lin-HsiaoJu/StanCode-Project
/stanCode Project/Wheather Master/weather_master.py
1,463
4.34375
4
""" File: weather_master.py Name: Jeffrey.Lin 2020/07 ----------------------- This program should implement a console program that asks weather data from user to compute the average, highest, lowest, cold days among the inputs. Output format should match what is shown in the sample run in the Assignment 2 Handout. """...
true
92e0031f054add61799cd4bfcd81a835e705af0d
ruthvika-mohan/python_scripts-
/merge_yearly_data.py
1,002
4.125
4
# Import required modules # Glob module finds all the pathnames matching a specified pattern # Pandas required to do merge operation # chdir() method in Python used to change the current working directory to specified path. from os import chdir from glob import glob import pandas as pdlib # Move to the path t...
true
a29e29d8f4e58d67a3d7cf38132b587cb8c27822
dinulade101/ECE322Testing
/command/cancelBookingCommand.py
2,224
4.3125
4
''' This file deals with all the commands to allow the user to cancel bookings. It will initially display all the user's bookings. Then the user will select the number of the booking displayed to cancel. The row of the booking in the db will be removed. The member who's booking was canceled will get an automated messag...
true
3735f2e08803537b4f8c1ba5fa4ad92e6109e16b
Jacalin/Algorithms
/Python/hash_pyramid.py
661
4.5
4
''' Implement a program that prints out a double half-pyramid of a specified height, per the below. The num must be between 1 - 23. Height: 4 # # ## ## ### ### #### #### ''' def hash_pyramid(): # request user input, must be num bewtween 1 - 23 n = int(input("please type in a number between 1 - 23:...
true
31fc3087cab6005638007c911291d6c23ae293ee
kyledavv/lpthw
/ex24.py
1,725
4.125
4
print("Let's practice everything.") print('You\'d need to know \'bout escapes with \\ that do:') print('\n newlines and \t tabs.') poem = """ \tThe lovely world with logic so firmly planted cannot discern \n the needs of love nor comprehend passion from intuition and requires an explanation \n\t\twhere the...
true
aa673ad99e3adc6a02d9e49a1c7d6b9d82ad2d2d
rawswift/python-collections
/tuple/cli-basic-tuple.py
467
4.34375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # create tuple a = ("one", "two", "three") # print 'em print a # how many node/element we have? print len(a) # 3 # print using format print "Counting %s, %s, %s..." % a # iterate for x in a: print x # print value from specific index print a[1] # 'two' # create an...
true
8829140909b516941d6ffc563cc083262210d3a0
v200510/Python_basics_and_application
/3.3 task-3.py
452
4.15625
4
# 3.3 Регулярные выражения в Python # Вам дана последовательность строк. # Выведите строки, содержащие две буквы "z", между которыми ровно три символа. # Sample Input: # zabcz # zzz # zzxzz # zz # zxz # zzxzxxz # Sample Output: # zabcz # zzxzz import re, sys [print(line.rstrip()) for line in sys.stdin if re.searc...
false
5caf2defe75b91c024c097d908ce5ed20c0b02e5
RianMarlon/Python-Geek-University
/secao5_estruturas_condicionais/exercicios/questao19.py
428
4.25
4
""" 19) Faça um programa para verificar se um determinado número inteiro é divisível por 3 ou 5, mas não simultaneamente pelos dois. """ numero = int(input("Digite um número: ")) if numero % 3 == 0 and not (numero % 5 == 0): print("Divisível por 3.") elif numero % 5 == 0 and not(numero % 3 == 0): print("Divi...
false
d798a6cdfe7e3f785f44ceee8e19daf6f57693c2
RianMarlon/Python-Geek-University
/secao5_estruturas_condicionais/exercicios/questao2.py
386
4.15625
4
""" 2) Leia um número fornecido pelo usuário. Se esse númerro for positivo, calcule a raiz quadrada do número. Se o número for negativo, mostre uma mensagem dizendo que o número é inválido. """ numero = int(input("Digite um número: ")) if numero > 0: print(f"\n{numero ** 2}") elif numero < 0: print("\nNúmero...
false
0d0a9b18fede86ea9b3afec3a588bc3920856e0e
RianMarlon/Python-Geek-University
/secao5_estruturas_condicionais/exercicios/questao11.py
592
4.125
4
""" 11) Escreva um programa que leia um número inteiro maior do que zero e devolva, na tela, a soma de todos os seus algarismos. Por exemplo, ao número 251 corresponderá o valor 8 (2 + 5 + 1). Se o número lido não dor maior do que zero, programa terminará com a mensagem 'Número inválido' """ numero = int(input("Digite...
false
ddbad1dbb4c52686a837700662e562d5a10fe720
RianMarlon/Python-Geek-University
/secao3_introducao/recebendo_dados.py
973
4.15625
4
""" Recebendo dados do usuário input() -> Todo dado recebido via input é do tipo String Em Python, string é tudo que estiver entrw: - Aspas simples; - Aspas duplas; - Aspas simples triplas; - Aspas duplas triplas; Exemplos: - Aspas Simples -> 'Angelina Jolie' - Aspas duplas -> "Angelina Jolie" - Aspas simples tripla...
false
5f3b816c0dad6a85f6f79ed2f49a928aff9dc750
RianMarlon/Python-Geek-University
/secao7_colecoes/exercicios1/questao23.py
740
4.125
4
""" 23) Ler dois conjuntos de números reais, armazenando-os em vetores e calcular o produto escalar entre eles. Os conjuntos têm 5 elementos cada. Imprimir os dois conjuntos e o produto escalar, sendo que o produto escalar é dado por: x1 * y1 + x2 * y2 + ... + xn * yn """ lista1 = [] lista2 = [] for i in range(5): ...
false
a5ea00a5b2bb36240557f80633cf45fcbd83f9fa
RianMarlon/Python-Geek-University
/secao7_colecoes/exercicios1/questao7.py
391
4.1875
4
""" 7) Escreva um programa que leia 10 números inteiros e os armazene em um vetor. Imprima o vetor, o maior elemento e a posição que ele se encontra. """ lista = [] for i in range(10): lista.append(int(input("Digite um número: "))) print(f"\nVetor: {lista}") print(f"Maior elemento: {max(lista)}") print(f"Posição...
false
87a50a44cff3abac564d6b98587beb4d73654016
RianMarlon/Python-Geek-University
/secao8_funcoes/exercicios/questao28.py
1,405
4.46875
4
""" 28) Faça uma função que receba como parâmetro o valor de um ângulo em grau e calcule o valor do cosseno desse ângulo usando sua respectiva série de Taylor: cos x = E(n=0) = (-1) ^ n / (2 * n)! * (x ^ 2 * n) = 1 - (x^2 / 2!) + (x^4 / 4!) - ... para todo x, onde x é o valor do ângulo em radianos. Considerar pi = 3.1...
false
2b6fb7c8bed6f3e072a808a9b3ee9c5dce5d89f3
RianMarlon/Python-Geek-University
/secao8_funcoes/exercicios/questao27.py
1,388
4.375
4
""" 27) Faça uma função que receba como parâmetro o valor de um ângulo em graus e calcule o valor do seno desse ângulo usando sua respectiva serie de Taylor: sin x = E (n = 0) = (-1) ^ n / (2n + 1)! * x ^ 2n + 1 = x - (x ^ 3 / 3!) + (x ^ 5 / 5!) - ... para todo x, onde x é o valor do ângulo em radianos. Considerar r ...
false
6d586cda0717f45a710b3ad05c1a464ea024d040
RianMarlon/Python-Geek-University
/secao7_colecoes/exercicios1/questao31.py
574
4.21875
4
""" 31) Faça um programa que leia dois vetores de 10 elementos. Crie um vetor que seja a união entre os 2 vetores anteriores, ou seja, que contém os números dos dois vetores. Não deve conter números repetidos. """ vetor1 = [] vetor2 = [] for i in range(10): vetor1.append(int(input("Digite um elemento do primeiro ...
false
0b86829b854e0c4d7ee2a34513d96bcb4dac423c
RianMarlon/Python-Geek-University
/secao13_leitura_escrita_de_arquivos/seek_e_cursors.py
1,665
4.4375
4
""" Seek e Cursors seek() -> é utilizada para moviementar o cursor pelo arquivo arquivo = open('texto.txt', encoding='utf-8') 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 ...
false
1e739098f5ed23750ecf47efd91e4f4d75c0ddc7
RianMarlon/Python-Geek-University
/secao13_leitura_escrita_de_arquivos/exercicio/questao7.py
1,425
4.53125
5
""" 7) Faça um programa que receba do usuário um arquivo texto. Crie outro arquivo texto contendo o texto do arquivo de entrada, mas com as vogais substituídas por '*' """ def substitui_vogais(txt): """Recebe um texto e retorna o mesmo com as vogais substituidas por '*'. Caso não seja passado um texto por par...
false
59ac398bcd634b7e5e4e8456fd8de56da39ae1ed
RianMarlon/Python-Geek-University
/secao8_funcoes/exercicios/questao14.py
1,181
4.40625
4
""" 14) Faça uma função que receba a distância em Km e a quantidade de litros de gasolina consumidos por um carro em um percurso, calcule o consumo em km/l e escreva uma mensagem de acordo com a tabela abaixo: | CONSUMO | (km/l) | MENSAGEM | menor que | 8 | Venda o carro! | entre | 8 e 12 ...
false
1063c487861ca1a0714420b887f4bc406225dc8f
RianMarlon/Python-Geek-University
/secao8_funcoes/exercicios/questao7.py
694
4.28125
4
""" 7) Faça uma função que receba uma temperatura en graus Celsius e retorne-a convertida em graus Fahrenheit. A fórmula de conversão é: F = C * (9.0/5.0) + 32.0, sendo F a temperatura em Fahrenheit e C a temperatura em Celsius. """ def converte_em_fahrenheit(celsius): """ Função que recebe uma temperatura em...
false
e632ec6cea6fbec7fe61eff27d85067309591f0b
RianMarlon/Python-Geek-University
/secao7_colecoes/exercicios2/questao12.py
717
4.1875
4
""" 12) Leia uma matriz de 3 x 3 elementos. Calcule e imprima a sua transposta. """ lista1 = [] for i in range(3): lista2 = [] for j in range(3): num = int(input("Digite um número: ")) lista2.append(num) lista1.append(lista2) print() lista_transposta = [] # Imprimindo a matriz escrit...
false
3ac4d3fe40faded55b34fdb5d4ee7f4d96b46294
RianMarlon/Python-Geek-University
/secao13_leitura_escrita_de_arquivos/exercicio/questao2.py
746
4.15625
4
""" 2) Faça um programa que receba do usuário um arquivo texto e mostre na tela quantas linhas esse arquivo possui """ nome_arquivo = str(input("Digite o caminho do arquivo ou o nome do mesmo " "(caso o arquivo esteja no mesmo local do programa): ")) nome_arquivo = nome_arquivo if ".txt" in n...
false
05f3c2709b5ef395ec8a39d1160720d98592dfd2
RianMarlon/Python-Geek-University
/secao7_colecoes/exercicios2/questao14.py
847
4.15625
4
""" 14) Faça um prorgrama para gerar automaticamente números entre 0 e 99 de uma cartela de bingo. Sabendo que cada cartela deverá conter 5 linhas de 5 números, gere estes dados de modo a não ter números repetidos dentro das cartelas. O programa deve exibir na tela a cartela gerada. """ from random import randint lis...
false
d1f57a43c27c0cfed1a993c42a06ca921968aa10
RianMarlon/Python-Geek-University
/secao13_leitura_escrita_de_arquivos/exercicio/questao6.py
1,464
4.40625
4
""" 6) Faça um programa que receba do usuário um arquivo texto e mostre na tela quantas vezes cada letra do alfabeto aparece dentro do arquivo. """ def qtd_letras(txt): """Recebe um texto e imprimi na tela cada letra do alfabeto e a quantidade de vezes que a mesma aparece no texto. Caso não seja passado um te...
false
05dbf2f6923071eccad18dc65d97a3e0baab3333
schlangens/Python_Shopping_List
/shopping_list.py
632
4.375
4
# MAKE sure to run this as python3 - input function can cause issues - Read the comments # make a list to hold onto our items shopping_list = [] # print out instruction on how to use the app print('What should we get at the store?') print("Enter 'DONE' to stop adding items.") while True: # ask for new items ...
true
ed5c9669052efef4d7003952c0a7f20437c5109d
alma-frankenstein/Rosalind
/RNA.py
284
4.1875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #Transcribing DNA to RNA #Given: A DNA string t #Return: The transcribed RNA string of t . filename = 'rosalind_rna.txt' with open(filename) as file_object: contents = file_object.read() rna = contents.replace('T', 'U') print(rna)
true
6a8203f812ccc5b829b20e7698246d8c327ac3af
dudejadeep3/python
/Tutorial_Freecodecamp/11_conditionals.py
530
4.34375
4
# if statement is_male = True is_tall = False if is_male and is_tall: print("You are a tall male.") elif is_male and not is_tall: print("You are a short male") elif not is_male and is_tall: print("You are not a male but tall") else: print("You are not male and not tall") def max_num(num1, num2, num3)...
true
dbfd05d60911bf8141c1bf910cad8229915e420a
dudejadeep3/python
/Tutorial_Freecodecamp/06_input.py
467
4.25
4
# Getting the input from the users name = input("Enter your name: ") age = input("Enter your age: ") print("Hello " + name + "! You are "+age) # Building a basic calculator num1 = input("Enter a number:") num2 = input("Enter another number:") result = float(num1) + float(num2); # we could use int() but it will remov...
true
0966afba7b408899717116feb36d960434974d7b
CODEREASYPYTHON/Calculator
/easy_calculator.py
661
4.21875
4
while True: number_one = input("Enter the first number:") query = input("Which arithmetic operation should be carried out? (+,-,/.,*):") number_two = input("Enter the second number:") Equal_1 = float(number_one) Equal_2 = float(number_two) if query == "+": print("Your result",Equal_1+E...
false
9b206c69562b967ae955947990826b5861a68255
franwatafaka/funciones_python
/ejemplos_clase/ejemplo_5.py
2,452
4.4375
4
# Funciones [Python] # Ejemplos de clase # Autor: Inove Coding School # Version: 2.0 # Ejemplos de parámetros ocultos en funciones conocidas def cantidad_letras(lista_palabras): for palabra in lista_palabras: cantidad_letras = len(palabra) print('Cantidad de letras de {}: {}'.format(palabra, cant...
false
cf717c597321786c758d22056fd1c90eb8d4b175
lima-oscar/GTx-CS1301xIV-Computing-in-Python-IV-Objects-Algorithms
/Chapter 5.1_Objects/Burrito5.py
1,764
4.46875
4
#In this exercise, you won't edit any of your code from the #Burrito class. Instead, you're just going to write a #function to use instances of the Burrito class. You don't #actually have to copy/paste your previous code here if you #don't want to, although you'll need to if you want to write #some test code at the bot...
true
09c67cc5a452e5af7021221d589c49e17f37d7b6
panhboth111/AI-CODES
/pandas/4.py
394
4.34375
4
#Question: Write a Pandas program to compare the elements of the two Pandas Series. import pandas as pd ds1 = pd.Series([2, 4, 6, 8, 10]) ds2 = pd.Series([1, 3, 5, 7, 10]) print("Series1:") print(ds1) print("Series2:") print(ds2) print("Compare the elements of the said Series:") print("Equals:") print(ds1 == ds2) prin...
true
2bf7cbe5bcecf17ebaf46be2f5420ebbde0163b0
panhboth111/AI-CODES
/pandas/16.py
530
4.28125
4
"""Question: Write a Pandas program to get the items of a given series not present in another given series. Sample Output: Original Series: sr1: 0 1 1 2 2 3 3 4 4 5 dtype: int64 sr2: 0 2 1 4 2 6 3 8 4 10 dtype: int64 Items of sr1 not present in sr2: 0 1 2 3 4 5 dtype: int64 """ import pandas as pd sr1 = pd.Series([1,...
true
e133ba7d9f305a476985d6d2659aefb7b91ddb51
MariinoS/projectEuler
/problem1.py
571
4.125
4
# Project Euler: Problem 1 Source Code. By MariinoS. 5th Feb 2016. """ # task: If we list all the natural numbers below 10 that are multiples of 3 or 5, # we get 3, 5, 6 and 9. The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. # # My Solution: """ list = ran...
true
4ede0c5bea3a9e14b82675234a3f43f5512d4a8f
datascience-bitacademy/python-basics
/03/04.object_copy.py
766
4.28125
4
# 레퍼런스 복사 import copy a = 1 b = a a = [1, 2, 3] b = [4, 5, 6] x = [a, b, 100] y = x print(x) print(y) print(x is y) # 얕은(swallow) 복사 a = [1, 2, 3] b = [4, 5, 6] x = [a, b, 100] y = copy.copy(x) print(x) print(y) print(x is y) print(x[0] is y[0]) # 깊은(deep) 복사 a = [1, 2, 3] b = [4, 5, 6] x = [a, b, 100] y = copy....
false
2834050573db40f828573a3a5e88137c4851382e
P-RASHMI/Python-programs
/Functional pgms/QuadraticRoots.py
979
4.3125
4
''' @Author: Rashmi @Date: 2021-09-17 19:10:01 @Last Modified by: Rashmi @Last Modified time: 2021-09-17 19:36:03 @Title : A program that takes a,d,c from quadratic equation and print the roots” ''' import math def deriveroots(a,b,c): """to calculate roots of quadratic equation parameter : a,b,c ret...
true
a40e98c3231f4f3a16e86dfe2eeb9951ae29b05d
P-RASHMI/Python-programs
/oops_sample/Innerclass.py
764
4.5
4
''' @Author: Rashmi @Date: 2021-09-20 17:10 @Last Modified by: Rashmi @Last Modified time: 2021-09-20 17:17 @Title : sample program to perform Concept of inner class and calling inner class values,inner class ''' class Student: def __init__(self,name,rollno): self.name = name self.rollno = rolln...
false
2af7aa31f51f43d8d4cdaaaf245833f3c215e9cf
P-RASHMI/Python-programs
/Logicalprogram/gambler.py
1,715
4.3125
4
''' @Author: Rashmi @Date: 2021-09-18 23:10 @Last Modified by: Rashmi @Last Modified time: 2021-09-19 2:17 @Title : Simulates a gambler who start with $stake and place fair $1 bets until he/she goes broke (i.e. has no money) or reach $goal. Keeps track of the number of times he/she wins and the number of bets he/she m...
true
65d56039fe3688d16aeb6737fbcd105df044155a
pranshulrastogi/karumanchi
/doubleLL.py
2,884
4.40625
4
''' implement double linked list ''' class Node: def __init__(self, data): self.data = data self.prev = None self.next = None class doubleLL: def __init__(self): self.head = None # insertion in double linked list def insert(self,data,pos=-1): assert pos >...
true
0765b7bc193f7bc799aa0b713b32b9c97ce7b3eb
maheshganee/python-data
/13file operation.py
2,798
4.65625
5
""" file operation:python comes with an inbuilt open method which is used to work with text files //the text files can operated in three operation modes they are read write append //open method takes atleast one parameter and atmost two parameters //first parameter represents the file name along with full path and sec...
true
1e171d3183670dd0bac6ab179a3b7c13c42f834c
rronakk/python_execises
/day.py
2,705
4.5
4
print "Enter Your birth date in following format : yyyy/mm/dd " birthDate = raw_input('>') print" Enter current date in following format : yyyy/mm/dd " currentDate = raw_input('>') birth_year, birth_month, birth_day = birthDate.split("/") current_year, current_month, current_day = currentDate.split("/") year1 = int(b...
true
f9baac6271366884fbb8caaf201ccb6b4e53e254
sunilmummadi/Trees-3
/symmetricTree.py
1,608
4.21875
4
# Leetcode 101. Symmetric Tree # Time Complexity : O(n) where n is the number of the nodes in the tree # Space Complexity : O(h) where h is the height of the tree # Did this code successfully run on Leetcode : Yes # Any problem you faced while coding this : No # Approach: To check for symmetry of a tree, check if ...
true
d908a2daa4ce12ec185d64cd232d1475598582a2
dltech-xyz/Alg_Py_Xiangjie
/.history/第2章/2-2/neizhi_20171113104609.py
561
4.375
4
car = ['奥迪', '宝马', '奔驰', '雷克萨斯'] #创建列表car print(len(car)) #输出列表car的长度 tuple2 = ('5', '4', '8') #创建元组tuple2 print(max(tuple2)) #显示元组tuple2中元素的最大值 tuple3 = ('5', '4', '8') #创建元组tuple3 print(min(tuple3)) #显示元组tuple3中元素的最小值 list1= ['Google', 'Taobao', 'Toppr', 'Baidu'] #创建列表list1 ...
false
4e1bc4ed86486ee94c63f439d96d7f663df5587c
mcfarland422/python101
/loops.py
277
4.21875
4
print "Loops file" # A for loop expects a starting point, and an ending point. # The ending poin (in range) is non-inclusive, meaning, it will stop when it gets there # i (below) is going to be the number of the loop it's on for i in range(1,10): if (i == 5): print
true
4df919c2b292cf09bf210ea8337023dea1c63bbf
Rosswell/CS_Exercises
/linked_list_manipulation.py
2,673
4.15625
4
'''Prompt: You have simple linked list that specifies paths through a graph. For example; [(node1, node2), (node2, node3)] node 1 connects to node 2 and node 2 connects to node 3. Write a program that traverses the list and breaks any cycles. So if node 1 links to both node 2 and node 2374, one link should be broken a...
true
41585c6dca2b0c40fbdd86fecbedecfa663e306a
Shadow-Arc/Eleusis
/hex-to-dec.py
1,119
4.25
4
#!/usr/bin/python #TSAlvey, 30/09/2019 #This program will take one or two base 16 hexadecimal values, show the decimal #strings and display summations of subtraction, addition and XOR. # initializing string test_string1 = input("Enter a base 16 Hexadecimal:") test_string2 = input("Enter additional Hexadecimals, else...
true
50d3d8fe9a65b183a05d23919c255b71378c7af5
alejandrox1/CS
/documentation/sphinx/intro/triangle-project/trianglelib/shape.py
2,095
4.6875
5
"""Use the triangle class to represent triangles.""" from math import sqrt class Triangle(object): """A triangle is a three-sided polygon.""" def __init__(self, a, b, c): """Create a triangle with sides of lengths `a`, `b`, and `c`. Raises `ValueError` if the three length values provided can...
true
5e4c5593c59e8218630172dd9690da00c7d8fc1c
CostaNathan/ProjectsFCC
/Python 101/While and for loops.py
1,090
4.46875
4
## while specify a condition that will be run repeatedly until the false condition ## while loops always checks the condition prior to running the loop i = 1 while i <= 10: print(i) i += 1 print("Done with loop") ## for variable 'in' collection to look over: ## the defined variable will change each iteratio...
true
959aae8e60bcc42ea90447dc296262c791e18d8c
CostaNathan/ProjectsFCC
/Python 101/Try & Except.py
298
4.21875
4
## try/except blocks are used to respond to the user something when an error occur ## best practice to use except with specific errors try: number = int(input("Enter a number: ")) print(number) except ZeroDivisionError as err: print(err) except ValueError: input("Invalid input")
true
1a4bc19b9deb798a2b3e18fabb62b53babd7e101
fernandorssa/CeV_Python_Exercises
/Desafio 63.py
1,077
4.15625
4
'''# Pede quantos termos da sequência Fibonacci n = int(input('Digite quantos termos da sequência: ')) # O contador foi definido como 4 pois n0, n1 e n2 não entram no WHILE. Dessa forma, o programa roda 3 vezes a menos cont = 4 n1 = n2 = 1 # Se o usuário pede 5 termos, o cont vai rodar 2 vezes, somado ao n0, n1 e n2: ...
false
df3955f45591745ac7c20b87d71d01a16f774cf1
OlivierParpaillon/Contest
/code_and_algo/Xmas.py
1,504
4.21875
4
# -*- coding:utf-8 -* """ Contest project 1 : Christmas Tree part.1 Olivier PARPAILLON Iliass RAMI 17/12/2020 python 3.7.7 """ # Python program to generate branch christmas tree. We split the tree in 3 branches. # We generate the first branch of the christmas tree : branch1. # We will use the same...
true
23bd8f9abc8622a7fba3ec85097241eacd9f3713
DLLJ0711/friday_assignments
/fizz_buzz.py
1,486
4.21875
4
# Small: add_func(1, 2) --> outputs: __ # More Complex: add_func(500, 999) --> outputs: __ # Edge Cases: add_func() or add_func(null) or add_func(undefined) --> outputs: ___ # Take a user's input for a number, and then print out all of the numbers from 1 to that number. #startFrom = int(input('Start From (...
true
27908f6c8668a493e416fc1857ac8fa49e7bb255
s3rvac/talks
/2017-03-07-Introduction-to-Python/examples/22-point.py
353
4.25
4
from math import sqrt class Point: """Representation of a point in 2D space.""" def __init__(self, x, y): self.x = x self.y = y def distance(self, other): return sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2) a = Point(1, 2) b = Point(3, 4) print(a.di...
true
7baaca13abcd7fc98fd5d9b78de0bc62557f4b83
s3rvac/talks
/2020-03-26-Python-Object-Model/examples/dynamic-layout.py
666
4.34375
4
# Object in Python do not have a fixed layout. class X: def __init__(self, a): self.a = a x = X(1) print(x.a) # 1 # For example, we can add new attributes to objects: x.b = 5 print(x.b) # 5 # Or even new methods into a class: X.foo = lambda self: 10 print(x.foo()) # 10 # Or even changing base classes d...
true
42b39efbe438ae62a818b8487aedeb5d71d4cf58
lafleur82/python
/Final/do_math.py
1,022
4.3125
4
import random def do_math(): """Using the random module, create a program that, first, generates two positive one-digit numbers and then displays a question to the user incorporating those numbers, e.g. “What is the sum of x and y?”. Ensure your program conducts error-checking on the answer and notifies ...
true
074f936e918b85a0b3ed669bb60f0d02d7a790db
daniel-reich/ubiquitous-fiesta
/PLdJr4S9LoKHHjDJC_22.py
909
4.3125
4
# 1-> find if cube is full or not, by checking len of cube vs len of current row. ​ # 2-> calculate the missing parts in current row, by deducting the longest len of row vs current row. ​ # 3-> if we have missing parts return it. ​ # 4-> if we don't have missing parts, but our len of cube is smaller than our longest r...
true
2950192f84c4b16ace89e832e95300b7b58db078
daniel-reich/ubiquitous-fiesta
/ZdnwC3PsXPQTdTiKf_6.py
241
4.21875
4
def calculator(num1, operator, num2): if operator=='+': return num1+num2 if operator=='-': return num1-num2 if operator=='*': return num1*num2 if operator=='/': return "Can't divide by 0!" if num2==0 else num1/num2
true
57fc2b657fc291816c34c85760c6a8b57c3d6677
daniel-reich/ubiquitous-fiesta
/suhHcPgaKdb9YCrve_24.py
311
4.1875
4
def even_or_odd(s): evenSum=0 oddSum=0 for i in s: if int(i)%2==0: evenSum+=int(i) else: oddSum+=int(i) if evenSum>oddSum: return "Even is greater than Odd" if evenSum<oddSum: return "Odd is greater than Even" if evenSum==oddSum: return "Even and Odd are the same"
false
c202ed548a40661673c3724e07d5807c440748a3
daniel-reich/ubiquitous-fiesta
/ZdnwC3PsXPQTdTiKf_12.py
286
4.25
4
def calculator(num1, operator, num2): if operator == "/": if not num2 == 0: return num1/num2 else: return "Can't divide by 0!" elif operator == "*": return num1*num2 elif operator == "+": return num1+num2 elif operator == "-": return num1-num2
false
7e8131e9fa9aaf0b419635a8f06519d48571a49d
daniel-reich/ubiquitous-fiesta
/ZwmfET5azpvBTWoQT_9.py
245
4.1875
4
def valid_word_nest(word, nest): while True: if word not in nest and nest != '' or nest.count(word) == 2: return False nest = nest.replace(word,'') if word == nest or nest == '': return True
true
39e97b4115d1bf32cfdb2dabf4c794fd1e44b4e7
daniel-reich/ubiquitous-fiesta
/suhHcPgaKdb9YCrve_16.py
237
4.34375
4
def even_or_odd(s): even=sum(int(x) for x in s if int(x)%2==0) odd=sum(int(x) for x in s if int(x)%2) return 'Even is greater than Odd' if even>odd else \ 'Odd is greater than Even' if odd>even else 'Even and Odd are the same'
false
9ce16fc28b4678e0b58aa237f496897100f851a9
daniel-reich/ubiquitous-fiesta
/mHRyhyazjCoze5jSL_8.py
298
4.15625
4
def double_swap(string,chr1,chr2): new_string = "" for char in string: if char == chr1: new_string = new_string + chr2 elif char == chr2: new_string = new_string + chr1 else: new_string = new_string + char return new_string
false
b7b5dc1ec31ac738b6ed4ef5f0bf7d383bc54fb2
daniel-reich/ubiquitous-fiesta
/MvtxpxtFDrzEtA9k5_13.py
496
4.15625
4
def palindrome_descendant(n): ''' Returns True if the digits in n or its descendants down to 2 digits derived as above are. ''' str_n = str(n) if str_n == str_n[::-1] and len(str_n) != 1: return True ​ if len(str_n) % 2 == 1: return False # Cannot produce a full set of...
true
b2cea9d9a6e9442f4ff3877a211ea24b8072d821
daniel-reich/ubiquitous-fiesta
/hzs9hZXpgYdGM3iwB_18.py
244
4.15625
4
def alternating_caps(txt): result, toggle = '', True for letter in txt: if not letter.isalpha(): result += letter continue result += letter.upper() if toggle else letter.lower() toggle = not toggle return result
true
08bd018bc3a79c324debfcd9c473c44be6454778
daniel-reich/ubiquitous-fiesta
/BpKbaegMQJ5xRADtb_23.py
1,028
4.125
4
def prime_factors(n): ''' Returns a list of the prime factors of integer n as per above ''' primes = [] for i in range(2, int(n**0.5) + 1): ​ while n % i == 0: primes.append(i) n //= i ​ return primes + [n] if n > 1 else primes ​ def is_unprimeable(n): ''' ...
false
48d9d502b12feb2a2c6c637cc5050d353a6e45d0
daniel-reich/ubiquitous-fiesta
/tgd8bCn8QtrqL4sdy_2.py
776
4.15625
4
def minesweeper(grid): ''' Returns updated grid to show how many mines surround any '?' cells, as per the instructions. ''' def mines(grid, i, j): ''' Returns a count of mines surrounding grid[i][j] where a mine is identified as a '#' ''' count = 0 lo...
true
e07c8e937363164c6a83778de6812098453d9fbe
daniel-reich/ubiquitous-fiesta
/JzBLDzrcGCzDjkk5n_21.py
268
4.1875
4
def encrypt(word): #Step 1: Reverse the input: "elppa" rword = word[::-1] rword = rword.replace('a','0') rword = rword.replace('e','1') rword = rword.replace('o','2') rword = rword.replace('u','3') rword = rword+'aca' return rword
false
17608253348421e9e8efeceef37697702b9e49b2
daniel-reich/ubiquitous-fiesta
/FSRLWWcvPRRdnuDpv_1.py
1,371
4.25
4
def time_to_eat(current_time): #Converted hours to minutes to make comparison easier breakfast = 420; lunch = 720; dinner = 1140; full_day = 1440; #Determines if it's morning or night morning = True; if (current_time.find('p.m') != -1): morning = False; #Splits the time from the A.M/P.M C...
true
88b08f253f89079d2055ca809f990b4bba66c970
daniel-reich/ubiquitous-fiesta
/kgMEhkNNjRmBTAAPz_19.py
241
4.125
4
def remove_special_characters(txt): l = [] for item in txt: if item in ['-','_',' '] or 'A'<=item<= 'Z'or 'a'<=item<='z' or '0'<=item<='9' : l.extend(item) print(l) return ''.join([item for item in l])
false
811e24a79e0ef363810682b9430e7e06fe1ac388
daniel-reich/ubiquitous-fiesta
/suhHcPgaKdb9YCrve_17.py
255
4.28125
4
def even_or_odd(s): e = 0 o = 0 for i in s: i = int(i) if i%2==0: e += i else: o += i if e > o: return "Even is greater than Odd" if o > e: return "Odd is greater than Even" return "Even and Odd are the same"
false
280b845a106c503186334374f3b8a19f9b335d58
daniel-reich/ubiquitous-fiesta
/dcX6gmNguEi472uFE_12.py
232
4.34375
4
def factorial(num): fact = 1 while num > 0: fact = fact*num num -= 2 return fact def double_factorial(num): print(num) if num == 0 or num == 1 or num == -1: return 1 else: return num * factorial(num-2)
false
f2cb2449e31eac8a7f3001a503cf34bb953440db
daniel-reich/ubiquitous-fiesta
/NNhkGocuPMcryW7GP_6.py
598
4.21875
4
import math ​ def square_areas_difference(r): # Calculate diameter d = r * 2 # Larger square area is the diameter of the incircle squared lgArea = d * d # Use the diameter of the circle as the hypotenuse of the smaller # square when cut in half to find the edges length # When the legs are equal length (b...
true
2163c89bda23d7bb9c02adc2729b3b678a695785
daniel-reich/ubiquitous-fiesta
/gJSkZgCahFmCmQj3C_21.py
276
4.125
4
def de_nest(lst): l = lst[0] #Define 'l' so a while loop can be used while isinstance(l,list): #repeat until l is not a list l = l[0] #This is a neat little trick in recursion, you can keep diving #into list by just taking the 0 index of itself! return l
true
701687d9659a7c7e4373ed7159096bf1b1f18a85
daniel-reich/ubiquitous-fiesta
/QuxCNBLcGJReCawjz_7.py
696
4.28125
4
def palindrome_type(n): decimal = list(str(n)) == list(str(n))[::-1] # assess whether the number is the same read forward and backward binary = list(str(bin(n)))[2:] == list(str(bin(n)))[2:][::-1] # assess whether the binary form of the number is the same read forward and backward ​ if((decimal) and (binary)): #...
true
13a03a6d6d627d8f0c36bb4b295a9b89cd8dd36e
lavakiller123/python-1
/mtable
333
4.125
4
#!/usr/bin/env python3 import colors as c print(c.clear + c.blue + 'Mmmmm, multiplication tables.') print('Which number?') number = input('> ' + c.green) print('table for ' + number) for multiplier in range(1,13): product = int(number) * multiplier form = '{} x {} = {}' print(form.format(number,multiplie...
true
177034604e43405fc616b4ea8c4017f96e8bacea
aliasghar33345/Python-Assignment
/Assignment_5/ASSIGNMENT_5.py
2,975
4.4375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: """ Answer # 1 Write a Python function to calculate the factorial of a number (a non-negative integer). The function accepts the number as an argument. """ def factorial(n): num = 1 while n > 0: num *= n n -= 1 return num print(factori...
true
7a5bf78bc03f1008220e365be65e95273686d56f
erik-kvale/HackerRank
/CrackingTheCodingInterview/arrays_left_rotation.py
2,412
4.4375
4
""" ------------------ Problem Statement ------------------ A left rotation operation on an array of size n shifts each of the array's elements 1 unit to the left. FOr example, if 2 left rotations are performed on array [1,2,3,4,5], then the array would become [3,4,5,1,2]. Given an array of n integers...
true
756347df8759c2befdb80feabcb255431be085d8
saiyampy/currencyconverter_rs-into-dollars
/main.py
898
4.28125
4
print("Welcome to rupees into dollar and dollar into rupees converter") print("press 1 for rupees into dollar:") print("press 2 for dollar into rupees:") try:#it will try the code choice = int(input("Enter your choice:\n")) except Exception as e:#This will only shown when the above code raises error print("You...
true
2d6ceb13782c1aa23f2f1c9dce160b7cb51cb5f3
nguya580/python_fall20_anh
/week_02/week02_submission/week02_exercise_scrapbook.py
2,398
4.15625
4
# %% codecell # Exercise 2 # Print the first 10 natural numbers using a loop # Expected output: # 0 # 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 x = 0 while x <= 10: print(x) x += 1 # %% codecell # Exercise 3: # Execute the loop in exercise 1 and print the message Done! after # Expected output: # 0 # 1 # 2 # 3...
true
d64a03f26d7dfd8bb4a7899770f29ce560b22381
Juahn1/Ejercicios-curso-de-python
/ejercicio_1_ecuacion.py
519
4.21875
4
#pasar la ecuacion a una expresion algoritmica (c + 5)(b ^2 -3ac)a^2 # ------------------ # 4a def ecuacion(a,b,c): x=((c+5)*((b**2)-3*a*c)*(a**2))/(4*a) print(f"El resultado es {x}") try: a=float(input("In...
false
63d67329e94978a29fcdf6bd2ee3a1d200660cbf
pyjune/python3_doc
/2_4.py
555
4.125
4
# 사칙연산 a = 3 b = 5 print(a+b) print(a+10) print(a-b) print(a*b) print(b*6) print(a/b) print(a/10) # 정수형 나눗셈 print(3//2) print(5//2) # 모드 연산 print(a%2) #a를 2로 나눈 나머지 print(b%a) #b를 a로 나눈 나머지 # 거듭 제곱 print(a**2) print(a**3) print(b**a) # 비교연산 a = 3 b = 5 print(a>0) print(a>b) print(a>=3) print(b<10) print(b<=5) print...
false
471bb7458f78b94190321bdcbaa0dce295cdb3f9
contactpunit/python_sample_exercises
/ds/ds/mul_table.py
1,088
4.21875
4
class MultiplicationTable: def __init__(self, length): """Create a 2D self._table of (x, y) coordinates and their calculations (form of caching)""" self.length = length self._table = { (i, j): i * j for i in range(1, length + 1) for j in range(...
true
d727cc2970a57f8343b1d222cae1a626727431ad
helong20180725/CSCE580-Projects
/machinelearning/helloTest.py
753
4.125
4
#note #1. Strings """ print("helloworld") capital="HI, YOU ARE CAPITAL LETTERS" print(capital.lower()) print(capital.isupper()) print(capital[4]) print(capital.index("T")) print(capital.replace("ARE","is")) print("\"") """ #2. numbers """ a =10 b = 3 c = -19 d = 4.23 print(10%3) #error print("the number is "+a) pr...
false