blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
9f3e5247a1c58d8c2e625138306b8422bc430afc
mayIlearnloopsbrother/Python
/chapters/chapter_6/ch6a.py
300
4.15625
4
#!/usr/bin/python3 #6-5 Rivers rivers = { 'nile': 'egypt', 'mile': 'fgypt', 'oile': 'ggypt', } for river, country in rivers.items(): print(river + " runs through " + country) print("\n") for river in rivers.keys(): print(river) print("\n") for country in rivers.values(): print(country)
false
e65ff801f6792b85f1878d3520b994f2e9dfa682
Ernestbengula/python
/kim/Task3.py
269
4.25
4
# Given a number , check if its pos,Neg,Zero num1 =float(input("Your Number")) #Control structures -Making decision #if, if else,elif if num1>0: print("positive") elif num1==0 : print("Zero") elif num1<0: print(" Negative") else: print("invalid")
true
7737b93b5c93234ab9a28e8a3b6d3b23f740dd76
abhiranjan-singh/DevRepo
/calculater.py
383
4.1875
4
def mutiply(x, y): return x*y print(mutiply(int(input("enter the 1st number ")),int(input("Enter the second number ")))) #m = int(input("enter the 1stnumber ")) #n = int(input("enter the second number ")) # print(mutiply(input("enter the 1st number"),input("enter the second number"))) #print(mutiply(m, n)) #pr...
false
4359dd4f67584016be61c50548e51c8117ee2bc7
xpbupt/leetcode
/Medium/Complex_Number_Multiplication.py
1,043
4.15625
4
''' Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the definition. Example 1: Input: "1+1i", "1+1i" Output: "0+2i" Explanation: (1 + i) * (1 + i) = 1 + i2 + 2 * i = 2i, and you need convert it to the form of 0+2i. Example 2:...
true
509db82ab08a4667d0642c5f952301717c291fb9
patiregina89/Exercicios-Logistica_Algoritimos
/Condicao_Parada999.py
1,444
4.21875
4
print("*"*12,"FACULDADE CESUSC","*"*12) print("CURSO: ANÁLISE E DESENV. DE SISTEMAS") print("Discipl.: Lógica Computacional e Algorítimos") print("Turma: ADS11") print("Nome: Patricia Regina Rodrigues") print("Exercício:Condição parada 999") print(("*"*42)) ''' Crie um programa que leia vários números intei...
false
a83d4a66c989c107a57dadf4dcfb8e597e14a107
CoCode2018/Refresher
/Python/笨办法学Python3/Exercise 18.py
1,416
4.71875
5
""" Exercise 18: Names, Variables, Code, Functions 1.Every programmer will go on and on about functions introduce vt.介绍;引进;提出;作为…的 about to 即将,正要,刚要;欲 explanation n.解释;说明;辩解;(消除误会后)和解 tiny adj.极小的,微小的 n.小孩子;[医]癣 related adj.有关系的;叙述的 vt.叙述(relate过去式和过去分词) break down 失败;划分(以便分析);损坏;衰弱...
false
edace158002f255b7bbfd8d5708575912ab065d9
Varsha1230/python-programs
/ch4_list_and_tuples/ch4_lists_and_tuples.py
352
4.1875
4
#create a list using[]--------------------------- a=[1,2,4,56,6] #print the list using print() function----------- print(a) #Access using index using a[0], a[1], a[2] print(a[2]) #change the value of list using------------------------ a[0]=98 print(a) #we can also create a list with items of diff. data types c=[45,...
true
c43b35b690a329f582683f9b406a66c826e5cabf
Varsha1230/python-programs
/ch3_strings/ch3_prob_01.py
435
4.3125
4
#display a user entered name followed by Good Afternoon using input() function-------------- greeting="Good Afternoon," a=input("enter a name to whom you want to wish:") print(greeting+a) # second way------------------------------------------------ name=input("enter your name:") print("Good Afternoon," +name) #---...
true
5b3ef497693bc27e3d5fee58a9a77867b8f18811
Varsha1230/python-programs
/ch11_inheritance.py/ch11_1_inheritance.py
731
4.125
4
class Employee: #parent/base class company = "Google" def showDetails(self): print("this is an employee") class Programmer(Employee): #child/derived class language = "python" # company = "YouTube" def getLanguage(self): print("the language is {self.language}") def s...
true
1c424c81442732b5b5c2d7616919ac81bc4dfcd2
mittgaurav/Pietone
/power_a_to_b.py
637
4.21875
4
# -*- coding: utf-8 -*- """ Created on Sun Mar 3 13:57:40 2019 @author: gaurav cache half power results. O(log n) """ def power(a, b): """power without pow() under O(b)""" print("getting power of", a, "for", b) if a == 0: return 0 if b == 1: return a elif b == 0: return...
false
e0e4e39fd90e6e7bb8024ff3636229043ae63b40
eddylongshanks/repl-code
/Week 1 Example Code/_week1-program.py
1,984
4.125
4
class User: def __init__(self, name, age): self.name = name self.age = age def details(self): return "Name: " + self.name + "\nAge: " + str(self.age) +"\n" def __str__(self): return "Name: " + self.name + "\nAge: " + str(self.age) +"\n" def __repr__(self):...
false
c25ee297552465456ca50c12ce5df934c9d399bf
IsaacMarovitz/ComputerSciencePython
/MontyHall.py
2,224
4.28125
4
# Python Homework 11/01/20 # In the Monty Hall Problem it is benefical to switch your choice # This is because, if you switch, you have a rougly 2/3 chance of # Choosing a door, becuase you know for sure that one of the doors is # The wrong one, otherwise if you didnt switch you would still have the # same 1/3 chance...
true
155a6195c974de35a6de43dffe7f1d2065d40787
IsaacMarovitz/ComputerSciencePython
/Conversation2.py
1,358
4.15625
4
# Python Homework 09/09/2020 # Inital grade 2/2 # Inital file Conversation.py # Modified version after inital submisions, with error handeling and datetime year # Importing the datetime module so that the value for the year later in the program isn't hardcoded import datetime def userAge(): global user_age us...
true
774ce49dd157eca63ab05d74c0d542dd33b4f14a
Nyame-Wolf/snippets_solution
/codewars/Write a program that finds the summation of every number between 1 and num if no is 3 1 + 2.py
629
4.5
4
Summation Write a program that finds the summation of every number between 1 and num. The number will always be a positive integer greater than 0. For example: summation(2) -> 3 1 + 2 summation(8) -> 36 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 tests test.describe('Summation') test.it('Should return the correct t...
true
62ef143a7d1a7dd420ad2f2f4b8a4ec9dda89f4f
DanielOram/simple-python-functions
/blueberry.py
2,627
4.625
5
#Author: Daniel Oram #Code club Manurewa intermediate #This line stores all the words typed from keyboard when you press enter myString = raw_input() #Lets print out myString so that we can see proof of our awesome typing skills! #Try typing myString between the brackets of print() below print() #With our stri...
true
15cc2f889516a57be1129b8cad373084222f2c30
viniciuschiele/solvedit
/strings/is_permutation.py
719
4.125
4
""" Explanation: Permutation is all possible arrangements of a set of things, where the order is important. Question: Given two strings, write a method to decide if one is a permutation of the other. """ from unittest import TestCase def is_permutation(s1, s2): if not s1 or not s2: return False if ...
true
9332ac35cb63d27f65404bb86dfc6370c919c2be
viniciuschiele/solvedit
/strings/is_permutation_of_palindrome.py
1,117
4.125
4
""" Explanation: Permutation is all possible arrangements of a set of things, where the order is important. Palindrome is a word or phrase that is the same forwards and backwards. A string to be a permutation of palindrome, each char must have an even count and at most one char can have an odd count. Question: Given ...
true
67fe9255295af578c9721b7847299ebe185cf5b8
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Personal_programs/Input_E_rapprString.py
676
4.34375
4
# La funzione input(...) restituisce un tipo stringa, anche se viene passato un numero int o float # Puoi rappresentare una stringa concatenata in diversi modi: # 1- Concatenandola con + e convertendo i numeri con str() ----> 'numero: ' + str(3.6) # 2- Utilizzando la virgola( , ) come separatore tra stringhe e numeri ...
false
7de1ba91ebbb95ade3f54e652560b2c65369b1e3
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Corso_CISCO_netacad/Strings_in_Python/s8_center_method.py
720
4.25
4
# The one-parameter variant of the center() method makes a copy of the original string, # trying to center it inside a field of a specified width. # The centering is actually done by adding some spaces before and after the string. # Demonstrating the center() method print('[' + 'alpha'.center(10) + ']') print('[' + 'B...
true
27598f79de97818823527e23f3969c27959f8702
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Corso_CISCO_netacad/Strings_in_Python/s15_split.py
617
4.46875
4
# The # split() # method does what it says - it splits the string and builds a list of all detected substrings. # The method assumes that the substrings are delimited by whitespaces - the spaces don't take part in the operation, # and aren't copied into the resulting list. # If the string is empty, the resulting list i...
true
0c10af8575d97394bbcb9c2363a82fe424df2bd0
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Corso_CISCO_netacad/integers_octal_exadecimal.py
1,053
4.53125
5
# If an integer number is preceded by an 0O or 0o prefix (zero-o), # it will be treated as an octal value. This means that the number must contain digits taken from the [0..7] range only. # 0o123 is an octal number with a (decimal) value equal to 83. print(0o123) # The second convention allows us to use hexadecimal n...
true
fd80e5cecb0c723cf52c16e6b112648476b37388
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Python_Data_Science_Toolbox_Part1/Nested_Functions/NestedFunc1.py
548
4.1875
4
# Define three_shouts def three_shouts(word1, word2, word3): """Returns a tuple of strings concatenated with '!!!'.""" # Define inner def inner(word): """Returns a string concatenated with '!!!'.""" return word + '!!!' # Return a tuple of strings return (inner(word1), inner(wor...
true
15d42320cb2c5217991e7b6202330c9e5e5fa414
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Corso_CISCO_netacad/Strings_in_Python/s7.py
458
4.4375
4
# Demonstrating the capitalize() method print('aBcD'.capitalize()) print("----------------------") # The endswith() method checks if the given string ends with the specified argument and returns True or False, # depending on the check result. # Demonstrating the endswith() method if "epsilon".endswith("on"): prin...
true
a959f8c5d7ec65d50fea6f6ca640524a04e13501
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Regular_Expressions_in_Python/Positional_String_formatting/Positional_formatting1.py
812
4.15625
4
# positional formatting ------> .format() wikipedia_article = 'In computer science, artificial intelligence (AI), sometimes called machine intelligence, ' \ 'is intelligence demonstrated by machines, ' \ 'in contrast to the natural intelligence displayed by humans and anima...
true
968bee9c854610fd5799d875dae04d4227c74cfe
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Functions and packages/PackagesInPython/MathPackageInPython.py
653
4.34375
4
""" As a data scientist, some notions of geometry never hurt. Let's refresh some of the basics. For a fancy clustering algorithm, you want to find the circumference, C, and area, A, of a circle. When the radius of the circle is r, you can calculate C and A as: C=2πr A=πr**2 To use the cons...
true
100d7f48a899c20b52ee5479eccd7422a87aa667
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Python_Lists/Python_Lists11.py
707
4.125
4
# you can also remove elements from your list. You can do this with the del statement: # Pay attention here: as soon as you remove an element from a list, the indexes of the elements that come after the deleted element all change! x = ["a", "b", "c", "d"] print(x) del(x[1]) # del statement print(x) ...
true
1ff840fef8bc267fcf37268800d9bd29dd86f521
Pasquale-Silv/Improving_Python
/Python Programming language/DataCampPractice/Python_Data_Science_Toolbox_Part2/Generators_and_GENfunc_yield/GEN2.py
462
4.34375
4
# [ LIST COMPREHENSION ] # ( GENERATOR ) # Recall that generator expressions basically have the same syntax as list comprehensions, # except that it uses parentheses () instead of brackets [] # Create generator object: result result = (num for num in range(31)) # Print the first 5 values print(next(result)) print(ne...
true
6ab7b8b1135b74d6572efd98bb64f86f85e468ce
ryanmp/project_euler
/p076.py
1,263
4.15625
4
''' counting sums explanation via example: n == 5: 4 + 1 3 + 2 3 + 1 + 1 2 + 2 + 1 2 + 1 + 1 + 1 1 + 1 + 1 + 1 + 1 if sum == 5 -> there are 6 different combos ''' def main(): return 0 # how many different ways can a given number be written as a sum? # note: combinations, not permutations def count_sum_reps(n): '...
true
240066b054c327e6a05ab214ce54466ba9b39d6f
gonzrubio/HackerRank-
/InterviewPracticeKit/Dictionaries_and_Hashmaps/Sherlock_and_Anagrams.py
992
4.15625
4
"""Given a string s, find the number of pairs of substrings of s that are anagrams of each other. 1<=q<=10 - Number of queries to analyze. 2<=|s|<=100 - Length of string. s in ascii[a-z] """ def sherlockAndAnagrams(s): """Return the number (int) of anagramatic pairs. s (list) - input string """ n...
true
d38f462e41e1f2fd0e9f07623bca3fc6a5619272
mikaelgba/PythonDSA
/cap5/Metodos.py
1,411
4.25
4
class Circulo(): # pi é um varialvel global da classe pi = 3.14 # com raio = 'x valor' toda vez que criar um objeto Circulo ele automaticamnete já concidera que o raio será 'x valor' #mas se colocar um outro valor ele vai sobreescrever o 'x valor' def __init__( self, raio = 3 ): ...
false
5a9c5719e053d265dd173e766008bc33118b6dae
peterzhou84/datastructure
/samples/python/array.py
1,542
4.4375
4
#coding=utf-8 #!/usr/bin/python3 ''' 展示在Python中,如何操作数组 ''' ################################################# ### 一维数组 http://www.runoob.com/python3/python3-list.html squares = [1, 4, 9, 16, 25, 36] print("打印原数组:") print(squares) ''' Python的编号可以为正负 +---+---+---+---+---+---+ | 1 | 4 | 9 | 16| 25| 36| +---+---+---+--...
false
d1d844be30625c6e2038e0596b19c05cf9a489fa
DarioBernardo/hackerrank_exercises
/recursion/num_decodings.py
2,241
4.28125
4
""" HARD https://leetcode.com/problems/decode-ways/submissions/ A message containing letters from A-Z can be encoded into numbers using the following mapping: 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mappi...
true
5d792080e230b43aa25835367606510d0bb63af7
feynmanliang/Monte-Carlo-Pi
/MonteCarloPi.py
1,197
4.21875
4
# MonteCarloPi.py # November 15, 2011 # By: Feynman Liang <feynman.liang@gmail.com> from random import random def main(): printIntro() n = getInput() pi = simulate(n) printResults(pi, n) def printIntro(): print "This program will use Monte Carlo techniques to generate an" print "experimental...
true
9e7d64fbc8fd69a5d56e3f65a057a2a3ce08da27
revanth465/Algorithms
/Searching Algorithms.py
1,403
4.21875
4
# Linear Search | Time Complexity : O(n) import random def linearSearch(numbers, find): for i in numbers: if(i==find): return "Found" return "Not Found" numbers = [1,3,5,23,5,23,34,5,63] find = 23 print(linearSearch(numbers,find)) # Insertion Sort | Time Complex...
true
e9c965347e640a3dc9c568f854d7840faa5ff31a
OlegZhdanoff/python_basic_07_04_20
/lesson_2_2.py
809
4.21875
4
""" 2. Для списка реализовать обмен значений соседних элементов, т.е. Значениями обмениваются элементы с индексами 0 и 1, 2 и 3 и т.д. При нечетном количестве элементов последний сохранить на своем месте. Для заполнения списка элементов необходимо использовать функцию input(). """ my_list = [] el = 1 i = 0 while el: ...
false
6c82627929fa81cdd0998309ec049b8ef4d7bc86
Helen-Sk-2020/JtBr_Arithmetic_Exam_Application
/Arithmetic Exam Application/task/arithmetic.py
2,032
4.125
4
import random import math def check_input(): while True: print('''Which level do you want? Enter a number: 1 - simple operations with numbers 2-9 2 - integral squares of 11-29''') x = int(input()) if x == 1 or x == 2: return x break else: ...
true
b513eaa39db2de8aab8d3e3b99d2d4f342d26b14
Gi-lab/Mathematica-Python
/07-Mate.py
351
4.3125
4
lista_numeros = [] quantidade = int(input('Quantos numeros voce deseja inserir? ')) while len(lista_numeros) + 1 <= quantidade: numero = int(input('Digite um numero ')) lista_numeros.append(numero) maior_numero = max(lista_numeros) print(f'O maior número da lista é {maior_numero}') input('Digite uma t...
false
0a6b38b73eea3f054edadbf5dc5f08ee4c524cb1
Jrjh27CS/Python-Samples
/practice-python-web/fibonacci.py
690
4.21875
4
#Challenge given by https://www.practicepython.org #Jordan Jones Apr 16, 2019 #Challenge: Write a program that asks the user how many Fibonnaci numbers to generate and then generates them. # Take this opportunity to think about how you can use functions. # Make sure to ask the user to enter the num...
true
dcbe36488dc453401fb81abd4a01dd2fe29bcbbf
moribello/engine5_honor_roll
/tools/split_names.py
1,231
4.375
4
# Python script to split full names into "Last Name", "First Name" format #Note: this script will take a .csv file from the argument and create a new one with "_split" appended to the filename. The original file should have a single column labled "Full Name" import pandas as pd import sys def import_list(): while ...
true
50d6496496531c365527290d9d12bcf4fb1f1c5f
DanilkaZanin/vsu_programming
/Time/Time.py
559
4.125
4
#Реализация класса Time (из 1 лекции этого года) class Time: def __init__(self, hours, minutes, seconds): self.hours = hours self.minutes = minutes self.seconds = seconds def time_input(self): self.hours = int(input('Hours: ')) self.minutes = int(input('Minutes...
false
86773d8aa5d642f444192ecc1336560c86d718ca
siddu1998/sem6_labs
/Cloud Computing/Assignment 1/question9.py
218
4.40625
4
# Write a Python program to find whether a given number (accept from the user) # is even or odd, print out an appropriate message to the user. n=int(input("please enter the number")) print("even" if n%2==0 else "odd")
true
316aa2bdc7e255944d154ce075592a157274c9bc
Jeremyreiner/DI_Bootcamp
/week5/Day3/daily_challenges/daily_challenge.py
2,874
4.28125
4
# Instructions : # The goal is to create a class that represents a simple circle. # A Circle can be defined by either specifying the radius or the diameter. # The user can query the circle for either its radius or diameter. # Other abilities of a Circle instance: # Compute the circle’s area # Print the circle and get ...
true
0cdc78355fca028bb19c771c343ae845b702f555
Jeremyreiner/DI_Bootcamp
/week5/Day1/Daily_challenge/daily_challenge.py
2,265
4.40625
4
# Instructions : Old MacDonald’s Farm # Take a look at the following code and output! # File: market.py # Create the code that is needed to recreate the code provided above. Below are a few questions to assist you with your code: # 1. Create a class called Farm. How should this be implemented? # 2. Does the Farm class ...
true
44971d0672295eea12f2d5f3ad8dad4faea2c47f
Bawya1098/python-Beginner
/Day3/Day3_Assignments/hypen_separated_sequence.py
273
4.15625
4
word = str(input("words to be separated by hypen:")) separated_word = word.split('-') sorted_separated_word = ('-'.join(sorted(separated_word))) print("word is: ", word) print("separated_word is:", separated_word) print("sorted_separated_word is: ", sorted_separated_word)
true
8ea1a9399f7b7325159494391e648245e0e76179
Danielkaas94/Any-Colour-You-Like
/code/python/PythonApplication1.py
2,115
4.1875
4
def NameFunction(): name = input("What is your name? ") print("Aloha mahalo " + name) return name def Sum_func(): print("Just Testing") x = input("First: ") y = input("Second: ") sum = float(x) + float(y) print("Sum: " + str(sum)) def Weight_func(): weight = int(input("Weight: ...
false
26b5cff2b5c9a9eca56befae9956bc895690c60e
sundusaijaz/pythonpractise
/calculator.py
681
4.125
4
num1 = int(input("Enter 1st number: ")) num2 = int(input("Enter 2nd number: ")) op = input("Enter operator to perform operation: ") if op == '+': print("The sum of " + str(num1) + " and " + str(num2) + " = " +str(num1+num2)) elif op == '-': print("The subtraction of " + str(num1) + " and " + str(num2) + " = " +...
false
3da597b2bcdcdaf16bfa50bc86a060fa56173667
ND13/zelle_python
/chapter_2/futval.py
792
4.15625
4
#!/usr/bin/python3.6 # File: futval.py # A program that computes an investment carried 10 years into future # 2.8 Exercises: 5, 9 def main(): print("This program calculates the future value of a 10-year investment.") principal = float(input("Enter the principal amount: ")) apr = float(input("Enter the ann...
true
7482b65b788259f74c8719944618f9d856417780
ND13/zelle_python
/chapter_3/pizza.py
450
4.3125
4
# sphere_2.py # calculates the price per square inch of circular pizza using price and diameter def main(): price = float(input("Enter the price for your pizza: $")) diameter = float(input("Enter the diameter of the pizza: ")) radius = diameter / 2 area = 3.14159 * radius ** 2 price_per_sq_inch = ...
true
f75081ff4aa02c2d226247c160a69e941149c980
zhaokaiju/fluent_python
/c07_closure_deco/p05_closure.py
728
4.34375
4
""" 闭包: 闭包指延伸了作用域的函数,其中包含函数定义体中引用、但是不在定义体中定义的非全局变量。 函数是不是匿名的没关系,关键是它能访问定义体之外定义的非全局变量。 """ def make_averager(): """ 闭包 """ # 局部变量(非全局变量)(自由变量) series = [] def averager(new_value): series.append(new_value) total = sum(series) return total / len(series) retu...
false
171042e8da302efa359e350feaf92915e9d33b8b
codeking-hub/Coding-Problems
/AlgoExpert/find3LargestNums.py
711
4.125
4
def findThreeLargestNumbers(array): # Write your code here. three_largest = [None, None, None] for num in array: updateThreeLargest(num, three_largest) return three_largest def updateThreeLargest(num, three_largest): if three_largest[2] == None or num > three_largest[2]: shiftValu...
false
a9bbd74af9b343cf940c2a7eeb6de12dbcc4bdd9
ElenaPontecchiani/Python_Projects
/0-hello/12-calculatorV2.py
466
4.1875
4
n1 = float(input("First number: ")) n2 = float(input("Second number: ")) operator = input("Digit the operator: ") def calculatorV2 (n1, n2, operator): if operator == '+': return n1+n2 elif operator == '-': return n1-n2 elif operator == '*': return n1*n2 elif operator == '/': ...
false
def2e855860ded62733aa2ddcfe4b51029a8edd2
PSReyat/Python-Practice
/car_game.py
784
4.125
4
print("Available commands:\n1) help\n2) start\n3) stop\n4) quit\n") command = input(">").lower() started = False while command != "quit": if command == "help": print("start - to start the car\nstop - to stop the car\nquit - to exit the program\n") elif command == "start": if started: ...
true
f6b50fb2c608e9990ed1e3870fd73e2039e17b3d
ananyo141/Python3
/uptoHundred.py
301
4.3125
4
#WAP to print any given no(less than 100) to 100 def uptoHundred(num): '''(num)-->NoneType Print from the given number upto 100. The given num should be less than equal to 100. >>>uptoHundred(99) >>>uptoHundred(1) ''' while(num<=100): print(num) num+=1
true
437c321c8a52c3ae13db3bfa5e48c7a5dac2c1eb
ananyo141/Python3
/gradeDistribution/functions.py
2,519
4.15625
4
# This function reads an opened file and returns a list of grades(float). def findGrades(grades_file): '''(file opened for reading)-->list of float Return a list of grades from the grades_file according to the format. ''' # Skip over the header. lines=grades_file.readline() grades_list=[]...
true
67613b888eaa088a69a0fec26f1ace376f95cbbb
ananyo141/Python3
/calListAvg.py
624
4.15625
4
# WAP to return a list of averages of values in each of inner list of grades. # Subproblem: Find the average of a list of values def calListAvg(grades): '''(list of list of num)--list of num Return the list of average of numbers from the list of lists of numbers in grades. >>> calListAvg([[5,2,4,3],[...
true
b7e98df96a4a263667a93d2ae87d397457cd0cb4
ananyo141/Python3
/addColor.py
362
4.1875
4
#WAP to input colors from user and add it to list def addColor(): '''(NoneType)-->list Return the list of colors input by the user. ''' colors=[] prompt="Enter the color you want to add, press return to exit.\n" color=input(prompt) while color!='': colors.append(color) ...
true
1766b55fbf0337bcff4a3514a1e6542c8bceb78e
ktkthakre/Python-Crash-Course-Practice-files
/Chapter 3/guestlist.py
1,767
4.4375
4
#list exercise 3.4 guest = ['dog','cat','horse'] print(f"Please join us to dinner Mr.{guest[0].title()}.") print(f"Please join us to dinner Mr.{guest[1].title()}.") print(f"Please join us to dinner Mr.{guest[2].title()}.") #list exercise 3.5 print(f"\nOh No, Mr.{guest[2].title()} cannot join us for dinner."...
false
66c033aa71f59194e22a89054896197aa2c42757
GowthamSingamsetti/Python-Practise
/rough10.py
899
4.25
4
# PYTHON program for bubble sort print("PYTHON PROGRAM FOR BUBBLE SORT TECHNIQUE (Ascending Order)") print("-"*70) list = [12,4,45,67,98,34] print("List before sorting" , list) for i in range(0,6): flag = 0 for j in range(0,5): if(list[j]>list[j+1]): temp = list[j] list...
false
cf8f65d4d28bdc98a8a7cc9cf2ce7d0453bfb980
hudaoling/hudaoling_20200907
/Python全栈_老男孩Alex/3-列表-字典-字符串-购物车/String_UseMethod.py
2,733
4.21875
4
# Author:Winnie Hu name="My Name is {name},She is a worker and She is {year} old" print(name.capitalize())#首字母 print(name.count("i")) print(name.center(50,"-")) #打印50个字符,不够用-补齐,并摆放中间 print(name.endswith("ker")) #判断是否以什么结尾 print(name.expandtabs(tabsize=30))# \ 把这个键转换成多少个空格 print(name.find("is")) #取字符的索引位置,从0开始计算 print...
false
29e7e1d222edafc4c2a4c229949848a004ae4285
hudaoling/hudaoling_20200907
/Python全栈_老男孩Alex/7 面向对象编程/静态方法-类方法-属性方法.py
2,048
4.21875
4
# Author:Winnie Hu #动态方法 class Dog(object): def __init__(self,name): self.name=name def eat(self,food): print("动态方法self.:","%s is eating %s"%(self.name,food)) d=Dog("jinmao") d.eat("baozi") #静态方法 class Dog(object): def __init__(self,name): self.name=name # 静态方法,实际上跟类没什么关系了,就可理...
false
6ccdbdcc90fffe223051131e8b7cc1b2c5bb9341
vlytvynenko/lp
/lp_hw/ex8.py
780
4.28125
4
formatter = "{} {} {} {}" #Defined structure of formatter variable #Creating new string based on formatter structure with a new data print(formatter.format(1, 2, 3, 4)) #Creating new string based on formatter structure with a new data print(formatter.format('one', 'two', 'three', 'four')) #Creating new string based on...
true
738774b4756d730e942bcb8c88ec3801afe4b54c
legitalpha/Spartan
/Day_9_ques1_Russian_peasant_algo.py
285
4.125
4
a = int(input("Enter first number : ")) b = int(input("Enter second number : ")) count = 0 while a!=0: if a%2==1: count +=b b=b<<1 a=a>>1 if a%2==0: b=b<<1 a=a>>1 print("The product of first and second number is ",count)
true
edbbed7b9a0ebeae3e1478b4988008deed3cee2e
dgquintero/holbertonschool-machine_learning
/math/0x03-probability/binomial.py
1,951
4.125
4
#!/usr/bin/env python3 """class Binomial that represents a Binomial distribution""" class Binomial(): """ Class Binomial that calls methos CDF PDF """ def __init__(self, data=None, n=1, p=0.5): """ Class Binomial that calls methos CDF PDF """ self.n = int(n) self.p = float(p) ...
true
d5491b784640d17450cbf52b9ecd8019f5b630a7
kvanishree/AIML-LetsUpgrade
/Day4.py
1,393
4.25
4
#!/usr/bin/env python # coding: utf-8 # In[8]: #Q1 print("enter the operation to perform") a=input() if(a=='+'): c=(3+2j)+(5+4j) print(c) elif(a=='-'): c=(3+2j)-(5+4j) print(c) elif(a=='*'): c=(3+2j)*(5+4j) print(c) elif(a=='/'): c=(3+2j)/(5+4j) print(c) elif(a=='//'): print("floo...
true
dcbe69d5095815419df2130635fca147b87a0c74
gaurab123/DataQuest
/02_DataAnalysis&Visualization/01_DataAnalysisWithPandas-Intermediate/05_WorkingWithMissingData/11_UsingColumnIndexes.py
1,692
4.15625
4
import pandas as pd titanic_survival = pd.read_csv('titanic_survival.csv') # Drop all columns in titanic_survival that have missing values and assign the result to drop_na_columns. drop_na_columns = titanic_survival.dropna(axis=1, how='any') # Drop all rows in titanic_survival where the columns "age" or "sex"...
false
5a29550eb1b08000b460873abfbc9bf3b5b7ed3d
alwinsheejoy/College
/SNIPPETS/Python/strings/strings.py
381
4.1875
4
str_name = 'Python for Beginners' #012356789 print(str_name[0]) # P print(str_name[-1]) # s print(str_name[0:3]) # 0 to 2 Pyt print(str_name[0:]) # 0 to end(full) Python for Beginners print(str_name[:5]) # 0 to 4 Pytho print(str_name[:]) # [0:end] (full) - copy/clone a string. copied_str = str_name[:] #...
false
45031662df9be1dafbac90323ea6b977949328f5
Jerwinprabu/practice
/reversepolish.py
596
4.34375
4
#!/usr/bin/python """ reverse polish notation evaluator Functions that define the operators and how to evaluate them. This example assumes binary operators, but this is easy to extend. """ ops = { "+" : (lambda a, b: a + b), "-" : (lambda a, b: a - b), "*" : (lambda a, b: a * b) } def eval(tokens): stack = [...
true
c5363e8be7c3e46cd35561d83880c3162f6ece0f
ataicher/learn_to_code
/careeCup/q14.py~
911
4.3125
4
#!/usr/bin/python -tt import sys def isAnagram(S1,S2): # remove white space S1 = S1.replace(' ',''); S2 = S2.replace(' ','') # check the string lengths are identical if len(S1) != len(S2): return False # set strings to lower case S1 = S1.lower(); S2 = S2.lower() # sort strings S1 = sorted(S1); S2 ...
true
9317aaa0cb94a12b89f6960525791598088003d6
HeavenRicks/dto
/primary.py
2,273
4.46875
4
#author: <author here> # date: <date here> # --------------- Section 1 --------------- # # ---------- Integers and Floats ---------- # # you may use floats or integers for these operations, it is at your discretion # addition # instructions # 1 - create a print statement that prints the sum of two numbers # ...
true
2c4c928322977ee0f99b7bfe4a97728e09402656
PropeReferio/practice-exercises
/random_exercises/temp_converter.py
586
4.28125
4
unit = input("Fahrenheit or Celsius?") try_again = True while try_again == True: if unit == "Fahrenheit": f = int(input("How many degrees Fahrenheit?")) c = f / 9 * 5 - 32 / 9 * 5 print (f"{f} degrees Fahrenheit is {c} degrees Celsius.") try_again = False elif unit == "Celsius"...
false
849c615ac2f77f6356650311deea9da6c32952bf
andrearus-dev/shopping_list
/myattempt.py
1,719
4.1875
4
from tkinter import * from tkinter.font import Font window = Tk() window.title('Shopping List') window.geometry("400x800") window.configure(bg="#2EAD5C") bigFont = Font(size=20, weight="bold") heading1 = Label(window, text=" Food Glorious Food \n Shopping List", bg="#2EAD5C", fg="#fff", font=bigFo...
true
026dc30173ab7427f744b000f55558ffc19099e8
glaxur/Python.Projects
/guess_game_fun.py
834
4.21875
4
""" guessing game using a function """ import random computers_number = random.randint(1,100) PROMPT = "What is your guess?" def do_guess_round(): """Choose a random number,ask user for a guess check whether the guess is true and repeat whether the user is correct""" computers_number = rand...
true
46f70133d8fc36aa8c21c51ba8cd35efd18fcfc7
MenggeGeng/FE595HW4
/hw4.py
1,520
4.1875
4
#part 1: Assume the data in the Boston Housing data set fits a linear model. #When fit, how much impact does each factor have on the value of a house in Boston? #Display these results from greatest to least. from sklearn.datasets import load_boston from sklearn.linear_model import LinearRegression import matpl...
true
9d723b583cec6a1c2ec2aea6497eec0d6dd6d27f
ageinpee/DaMi-Course
/1/Solutions/Solution-DAMI1-Part3.py
2,024
4.15625
4
''' Solution to Part III - Python functions. Comment out the parts you do not wish to execute or copy a specific function into a new py-file''' #Sum of squares, where you can simply use the square function you were given def sum_of_squares(x, y): return square(x) + square(y) print sum_of_squares(3, 5) # Try out you...
true
45fc9452f03b169869eb753bf3ffc017540dd052
sejinwls/2018-19-PNE-practices
/session-5/ex-1.py
620
4.1875
4
def count_a(seq): """"THis function is for counting the number of A's in the sequence""" # Counter for the As result = 0 for b in seq: if b == "A": result += 1 # Return the result return result # Main program s = input("Please enter the sequence: ") na = count_a(s) print...
true
e14736ccc657561a7db0a6653d64f05953b85d30
aratik711/100-python-programs
/eval_example.py
320
4.28125
4
""" Please write a program which accepts basic mathematic expression from console and print the evaluation result. Example: If the following string is given as input to the program: 35+3 Then, the output of the program should be: 38 Hints: Use eval() to evaluate an expression. """ exp = input() print(eval(exp))
true
d33e36b0734802ce63caaa7310a21ecb2b6081d6
aratik711/100-python-programs
/subclass_example.py
382
4.125
4
""" Question: Define a class named American and its subclass NewYorker. Hints: Use class Subclass(ParentClass) to define a subclass. """ class American: def printnationality(self): print("America") class NewYorker: def printcity(self): American.printnationality(self) p...
true
2f133b9e5687578ca73e329c24c3197512b7d790
sureshpodeti/Algorithms
/dp/slow/min_steps_to_minimize_num.py
740
4.15625
4
''' Minimum steps to minimize n as per given condition Given a number n, count minimum steps to minimize it to 1 according to the following criteria: If n is divisible by 2 then we may reduce n to n/2. If n is divisible by 3 then you may reduce n to n/3. Decrement n by 1. brute-force solution: tim...
false
f7b05c070eb88efe3ea889c2d77647a6e9cf6b4d
sureshpodeti/Algorithms
/dp/slow/min_cost_path.py
1,157
4.125
4
''' Min cost path: Given a matrix where each cell has some interger value which represent the cost incurred if we visit that cell. Task is found min cost path to reach (m,n) position in the matrix from (0,0) position possible moves: one step to its right, one step down, and one step diagonally ...
true
e8019a0d7da90f1633bd139a32ca191887b08c10
naroladhar/MCA_101_Python
/mulTable.py
1,074
4.125
4
import pdb pdb.set_trace() def mulTable(num,uIndexLimit): ''' Objective : To create a multiplication table of numbers Input Variables : num : A number uIndexLimit: The size of the multiplication table Output Variables: res : The result of the product return value...
true
92aca135af4da75cb0cd32b9bfac71515384e04d
hakanguner67/class2-functions-week04
/exact_divisor.py
376
4.125
4
''' Write a function that finds the exact divisors of a given number. For example: function call : exact_divisor(12) output : 1,2,3,4,6,12 ''' #users number number = int(input("Enter a number : ")) def exact_divisor(number) : i = 1 while i <= number : # while True if ((number % i )==0) : ...
true
89aa00e1cd5480b1e976fe94a3bbd044f8f671de
hakanguner67/class2-functions-week04
/counter.py
590
4.21875
4
''' Write a function that takes an input from user and than gives the number of upper case letters and smaller case letters of it. For example : function call: counter("asdASD") output: smaller letter : 3 upper letter : 3 ''' def string_test(s): upper_list=[] smaller_list=[] for i in s: if i....
true
38ed49911be4adb634aa662aed898a56c244c5ac
mariadiaz-lpsr/class-samples
/5-4WritingHTML/primeListerTemplate.py
944
4.125
4
# returns True if myNum is prime # returns False is myNum is composite def isPrime(x, myNum): # here is where it will have a certain range from 2 to 100000 y = range(2,int(x)) # subtract each first to 2 primenum = x - 2 count = 0 for prime in y: # the number that was divided will then be divided to find rema...
true
120526d1004799d849367a701f6fa9c09c6bbe05
mariadiaz-lpsr/class-samples
/quest.py
1,314
4.15625
4
print("Welcome to Maria's Quest!!") print("Enter the name of your character:") character = raw_input() print("Enter Strength (1-10):") strength = int(input()) print("Enter Health (1-10):") health = int(input()) print("Enter Luck (1-10):") luck = int(input()) if strength + health + luck > 15: print("You have give ...
true
7251ebc79e8c4968588276efb33d05320b032750
mariadiaz-lpsr/class-samples
/names.py
1,010
4.3125
4
# it first prints the first line print("These are the 5 friends and family I spend the most time with: ") # these are the 2 list name names and nams names = ['Jen', 'Mom', 'Dad', 'Alma', 'Ramon'] nams = ['Jackelyn', 'Judy', 'Elyssa', 'Christina', 'Cristian'] # it is concatenating both of the lists names_nams = names...
true
434182c9ca2fa8b73c4f2fd0b4d9197720b7d406
pktippa/hr-python
/basic-data-types/second_largest_number.py
430
4.21875
4
# Finding the second largest number in a list. if __name__ == '__main__': n = int(input()) arr = list(map(int, input().split())) # Converting input string into list by map and list() new = [x for x in arr if x != max(arr)] # Using list compressions building new list removing the highest number print(max...
true
3c09d0c67801c8748794d163a275a6c6f5b88378
pktippa/hr-python
/itertools/permutations.py
678
4.15625
4
# Importing permutations from itertools. from itertools import permutations # Taking the input split by space into two variables. string, count = input().split() # As per requirement the given input is all capital letters and the permutations # need to be in lexicographic order. Since all capital letters we can directl...
true
e03cc807d94143ba7377b192d5784cbdb07b1abd
pktippa/hr-python
/math/find_angle_mbc.py
376
4.34375
4
# importing math import math # Reading AB a = int(input()) # Reading BC b = int(input()) # angle MBC is equal to angle BCA # so tan(o) = opp side / adjacent side t = a/b # calculating inverse gives the value in radians. t = math.atan(t) # converting radians into degrees t = math.degrees(t) # Rounding to 0 decimals and ...
true
bed0fc094ed0b826db808aa4449cbf31686cbd2a
aryakk04/python-training
/functions/dict.py
549
4.53125
5
def char_dict (string): """ Prints the dictionary which has the count of each character occurrence in the passed string argument Args: String: It sould be a string from which character occurrence will be counted. Returns: Returns dictionary having count of each character in ...
true
2e0deae0231338db84a2f11cd64994bf82900b33
seanakanbi/SQAT
/SampleTests/Sample/classes/Calculator.py
1,677
4.375
4
import math from decimal import * class Calculator(): """ A special number is any number that is - is between 0 and 100 inclusive and - divisible by two and - divisible by five. @param number @return message (that displays if the number is a special number) """...
true
0df98d530f508a752e42a67ad7c6fe0a2608f823
JaiAmoli/Project-97
/project97.py
266
4.21875
4
print("Number Guessing Game") print("guess a number between 1-9") number = int(input("enter your guess: ")) if(number<2): print("your guess was too low") elif(number>2): print("your guess was too high") else: print("CONGRATULATIONS YOU WON!!!")
true
7b9c3c2cd1a9f753a9f3df2adeb84e846c9eb1b4
mschaldias/programmimg-exercises
/list_merge.py
1,395
4.34375
4
''' Write an immutable function that merges the following inputs into a single list. (Feel free to use the space below or submit a link to your work.) Inputs - Original list of strings - List of strings to be added - List of strings to be removed Return - List shall only contain unique values - Li...
true
d089ecb536c7d01e7387f82dbe93da65da98358c
yogabull/TalkPython
/WKUP/loop.py
925
4.25
4
# This file is for working through code snippets. ''' while True: print('enter your name:') name = input() if name == 'your name': break print('thank you') ''' """ name = '' while name != 'your name': name = input('Enter your name: ') if name == 'your name': print('thank you') """ ...
true
8837287f4ef533b32c594b35c8b432216cb8c628
yogabull/TalkPython
/ex3_birthday_program/ex3_program_birthday.py
1,221
4.28125
4
"""This is a birthday app exercise.""" import datetime def main(): print_header() bday = get_user_birthday() now = datetime.date.today() td = compute_user_birthday(bday, now) print_birthday_info(td) def print_header(): print('-----------------------------') print(' Birthday App')...
false
ce930feff941e3e78f9629851ce0c8cc08f8106b
yogabull/TalkPython
/WKUP/fStringNotes.py
694
4.3125
4
#fString exercise from link at bottom table = {'John' : 1234, 'Elle' : 4321, 'Corbin' : 5678} for name, number in table.items(): print(f'{name:10} --> {number:10d}') # John --> 1234 # Elle --> 4321 # Corbin --> 5678 ''' NOTE: the '10' in {name:10} means make the name var...
true
c7fc3ced3296f7e181ba9714534800b59d20dd53
thevirajshelke/python-programs
/Basics/subtraction.py
586
4.25
4
# without user input # using three variables a = 20 b = 10 c = a - b print "The subtraction of the numbers is", c # using 2 variables a = 20 b = 10 print "The subtraction of the numbers is", a - b # with user input # using three variables a = int(input("Enter first number ")) b = int(input("Enter first number ")) c ...
true
ef45e2377ab4276345644789a17abdd20da69aca
johnehunt/computationalthinking
/week4/tax_calculator.py
799
4.3125
4
# Program to calculate tax band print('Start') # Set up 'constants' to be used BASIC_RATE_THRESHOLD = 12500 HIGHER_RATE_THRESHOLD = 50000 ADDITIONAL_RATE_THRESHOLD = 150000 # Get user input and a number income_string = input('Please input your income: ') if income_string.isnumeric(): annual_income = int(income_st...
true
8d7ca111c403010de98909a1850ae5f7a1d54b2b
johnehunt/computationalthinking
/number_guess_game/number_guess_game_v2.py
1,262
4.34375
4
import random # Print the Welcome Banner print('===========================================') print(' Welcome to the Number Guess Game') print(' ', '-' * 40) print(""" The Computer will ask you to guess a number between 1 and 10. """) print('===========================================') # Initialise the...
true
0f25b7552ca48fbdc04ee31bd873d899ffae26c6
johnehunt/computationalthinking
/week4/forsample.py
813
4.34375
4
# Loop over a set of values in a range print('Print out values in a range') for i in range(0, 10): print(i, ' ', end='') print() print('Done') print('-' * 25) # Now use values in a range but increment by 2 print('Print out values in a range with an increment of 2') for i in range(0, 10, 2): print(i, ' ', end=...
true
2acb0005b760b130fc4c553b8f9595c91b828c0e
tainagdcoleman/sharkid
/helpers.py
2,892
4.125
4
from typing import Tuple, List, Dict, TypeVar, Union import scipy.ndimage import numpy as np import math Num = TypeVar('Num', float, int) Point = Tuple[Num, Num] def angle(point: Point, point0: Point, point1: Point) -> float: """Calculates angles between three points Args: point...
true