blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
0819ffcd81a015ea16ff6493531e4f70a635f304
guillermd/Python
/Learning Projects Python/Ejercicios/ejercicio2.py
1,931
4.34375
4
class ejercicio2(): #Escribir un programa que pregunte el nombre del usuario en la consola # y un número entero e imprima por pantalla en líneas distintas # el nombre del usuario tantas veces como el número introducido. def HacerEjercicio(self): nombre=input("Dame tu nombre:") vueltas...
false
9bc0f38b22e60a26543a6f607b4b58bdacb28b41
guillermd/Python
/Learning Projects Python/Basic/Tuplas.py
649
4.28125
4
miTupla=("item1", 18, "item3") print(miTupla) #busqueda de elementos print(miTupla.index("item3")) #Convertir una tuppla en Lista miLista=list(miTupla) print (miLista) #Convertir una lista en tupla miLista.append(7) miTupla2=tuple(miLista) print (miTupla2) #buscar elementos en la tupla => in print("item1" in miTupla) #...
false
7ccff781110f6a1cdefcda48c00fca3c9be5e0b6
AbrahamCain/Python
/PasswordMaker.py
1,501
4.375
4
#Password Fancifier by Cyber_Surfer #This program takes a cool word or phrase you like and turns it into a decent password #you can comment out or delete the following 3 lines if using an OS other than Windows import os import sys os.system("color e0") #It basically alters the colors of the terminal #Enter a passwo...
true
74a3dd1a7ec3f71e4dd641f42e22738c989128d4
Autumn-Chrysanthemum/complete-python-bootcamp
/Python-Object-and-Data-Structure-Basics/Section_5/If_elif_else.py
635
4.125
4
# control flow # if some_condition: # execute some code # elif some_other_condition: # do something different # else: # do something else if True: print("It is True") hungry = True if hungry: print("feed me") else: print("i not hungry") location = "Bank" if location == "Auto Shop": pri...
false
0f679c78696c3d221458ece5c214502f58449c9d
GuillermoDeLaCruz/python--version3
/name.py
726
4.4375
4
# name = "ada lovelace" print(name.title()) print(name.upper()) print(name.lower()) # Combining or Concatenating Strings # Python uses the plus symbol (+) to combine strings first_name = "ada" last_name = "lovelace" full_name = first_name + " " + last_name print(full_name) print("Hello, " + full_name.title() + "!") ...
true
741bf635cffb29fe1c30c23b9516cc1d77ea00af
abhijitmamarde/py_notebook
/programs/class_str_repr_methods.py
558
4.1875
4
class Point: '''Defines simple 2D Points''' def __init__(self): self.x = 10 self.y = 20 def __str__(self): return "Point(x=%d, y=%d)" % (self.x, self.y) def __repr__(self): return "P(x=%d, y=%d)" % (self.x, self.y) def show(self, flag, capital): '''prints the...
false
f841f92cb177b6123adc3c8db14ecd6680078069
annabaig2023/Madlibs
/main.py
521
4.28125
4
# string concatenation # swe = "Anna Baig" # print (swe + " likes to code") # # print (f"{swe} likes to code") # # print ("{} likes to code".format(swe)) swe = input("Name: ") adj = input("Adjective: ") verb1 = input("Verb: ") verb2 = input("Verb: ") famous_person = input("Famous person: ") madlib = ("Hi! My name is...
false
ad8ad997ed8f9103cff43928d968f78201856399
kevyo23/python-props
/what-a-birth.py
1,489
4.5
4
#! /usr/bin/env python # -*- coding: utf-8 -*- # what-a-birth.py - simple birthday monitor, check and add birthdays # Kevin Yu on 28/12/2016 birthdays = {'Alice': 'Apr 1', 'Bob': 'Dec 12', 'Carol': 'Mar 4'} all_months = 'January February March April May June July August September October November December' while True...
true
dc5b049c6635da54baaa0f9246d722aa090cf8f6
HelenMaksimova/python_lessons
/lesson_4/lesson_4_5.py
768
4.15625
4
# Реализовать формирование списка, используя функцию range() и возможности генератора. # В список должны войти четные числа от 100 до 1000 (включая границы). # Необходимо получить результат вычисления произведения всех элементов списка. from functools import reduce start_list = [elem for elem in range(100, 1001) if e...
false
f98aeb7d429aae2a54eaaa52530889c6129ddc57
Vikas-KM/python-programming
/repr_vs_str.py
741
4.375
4
# __str__ vs __repr__ class Car: def __init__(self, color, mileage): self.color = color self.mileage = mileage # print and it returns always string # for easy to read representation def __str__(self): return '__str__ : a {self.color} car with {self.mileage} mileage'.format(self...
true
cbb68b5a739a298268d2f150aa25841ff4156ffe
sp2013/prproject
/Assgn/Linear_Regression2.py
1,597
4.1875
4
''' Linear_Regression2.py Implements Gradient Descent Algorithm ''' import numpy as np import random import matplotlib.pyplot as plt def linear_regression2(): ''' 1. Read training data in to input, output array. 2. Initialize theta0 - y intercept, theta1 - slope of line. 3. Repeat f...
true
5c33baae0e50f099028f50a221f18e0d1437f30a
babzman/Babangida_Abdullahi_day30
/Babangida_Abdullahi_day30.py
1,429
4.28125
4
def nester(n): """Given a string of digits S, This function inserts a minimum number of opening and closing parentheses into it such that the resulting string is balanced and each digit d is inside exactly d pairs of matching parentheses.Let the nesting of two parentheses within a string be the substring that oc...
true
74789b8d7f88978a688db1b902cdb8954f315a22
AlvinJS/Python-practice
/Group6_grades.py
747
4.15625
4
# Function to hold grade corresponding to score def determinegrade(score): if 80 <= score <= 100: return 'A' elif 65 <= score <= 79: return 'B' elif 64 <= score <= 64: return 'C' elif 50 <= score <= 54: return 'D' else: return 'F' count = 0 # Use range(10...
true
fab1979adbfa20245e24943f73ba15566cd06f69
magotheinnocent/Simple_Chatty_Bot
/Simple Chatty Bot/task/bot/bot.py
1,188
4.25
4
print("Hello! My name is Aid.") print("I was created in 2020.") print("Please, remind me your name.") name = str(input()) print(f"What a great name you have, {name}!") print("Let me guess your age.") print("Enter remainders of dividing your age by 3, 5 and 7") remainder1 = int(input()) remainder2 = int(input()) remaind...
true
fd73641925aa29814156330883df9d132dbcb802
goodwjsphone/WilliamG-Yr12
/ACS Prog Tasks/04-Comparision of two.py
296
4.21875
4
#write a program which takes two numbers and output them with the greatest first. num1 = int(input("Input first number ")) num2 = int(input("Input second number ")) if num1 > num2: print (num1) else: print(num2) ## ACS - You need a comment to show where the end of the if statement is.
true
a7b9758e30b5b2ef0ae6a43a68671ce37f709c9a
joao-pedro-serenini/recursion_backtracking
/fibonacci_problem.py
678
4.1875
4
def fibonacci_recursion(n): if n == 0: return 1 if n == 1: return 1 return fibonacci_recursion(n-1) + fibonacci_recursion(n-2) # top-down approach def fibonacci_memoization(n, table): if n not in table: table[n] = fibonacci_memoization(n-1, table) + fibonacci_memoiz...
false
a606701ff19aeb87aa7747cd39d40feb826ccb29
PhyzXeno/python_pro
/transfer_to_x.py
991
4.25
4
# this piece of code will convert strings like "8D4C2404" into "\x8D\x4C\x24\x04" # which will then be disassembled by capstone and print the machine code import sys from capstone import * # print("the hex string is " + sys.argv[1]) the_str = sys.argv[1] def x_encode(str): the_str_len = len(str) count = 0 the_x...
true
7bc36647921f253c1ed133c6593de0c35104d261
AgustinParmisano/tecnicatura_analisis_sistemas
/ingreso/maxmin.py
592
4.3125
4
#!/usr/bin/python # coding=utf-8 ''' Realizar un programa que lea dos números enteros desde teclado e informe en pantalla cuál de los dos números es el mayor. Si son iguales debe informar en pantalla lo siguiente: “Los números leídos son iguales”. ''' num1 = int(raw_input('Ingrese un número: ')) num2 ...
false
ba9f1fd6c7c56f7673b760b605b0fc17d14e0556
mylgcs/python
/训练营day02/01_函数.py
851
4.15625
4
# 将一个常用的功能封装为一个单独的代码片段,用一个单词来表示,通过这个单词,只需极简结的代码,即可实现这个功能, # 这样的代码片段,称为"函数"! # 比如print 和 input就是函数 # 函数 def print_poetry(): print("春眠不觉晓,处处蚊子咬,夜来嗡嗡声,叮的包不少。") # 函数调用 print_poetry() # 函数的参数与返回值 # 通过参数将数据传递给函数,通过返回值将运算的结果回传 def add(a, b): return a + b # 运算结果可以赋值给另一个变量,也可以直接使用 c = add(1, 2) print(c) # 调用函数的...
false
de62d877172215f9cbb0b30b24e8009b3485bf47
cpkoywk/IST664_Natural_Language_Processing
/Lab 1/assignment1.py
1,148
4.21875
4
''' Steps: get the text with nltk.corpus.gutenberg.raw() get the tokens with nltk.word_tokenize() get the words by using w.lower() to lowercase the tokens make the frequency distribution with FreqDist get the 30 top frequency words with most_common(30) and print the word, frequency pairs ''' #Import required modules im...
true
eb9d5ad1a3bb38c87c64f435c2eabd429405ddc3
niall-oc/things
/codility/odd_occurrences_in_array.py
2,360
4.28125
4
# -*- coding: utf-8 -*- """ Author: Niall O'Connor # https://app.codility.com/programmers/lessons/2-arrays/odd_occurrences_in_array/ A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the sam...
true
203ae511e881868303be870501531fb41c688fea
niall-oc/things
/codility/dis_analysis.py
840
4.125
4
def factorial(n): # recursive if not n: return 1 else: return n * factorial(n-1) def factorial_for(n): if not n: return 1 else: r = 1 for i in range(1, n+1): r = i*r return r def factorial_while(n): if not n: return 1 else...
false
db239ae5d7cc670f71e8af8d99bc441f4af2503a
niall-oc/things
/puzzles/movies/movies.py
2,571
4.1875
4
#!/usr/bin/python # -*- coding: utf-8 -*- """ Given the following list in a string seperated by \n characters. Jaws (1975) Starwars 1977 2001 A Space Odyssey ( 1968 ) Back to the future 1985. Raiders of the lost ark 1981 . jurassic park 1993 The Matrix 1999 A fist full of Dollars 10,...
true
e6ea4c49d3012708cededb29a1f79f575561c82f
niall-oc/things
/codility/frog_jmp.py
2,058
4.15625
4
# -*- coding: utf-8 -*- """ Author: Niall O'Connor # https://app.codility.com/programmers/lessons/3-time_complexity/frog_jmp/ A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a f...
true
fdec6fee3a57a11783c40eafcb9125b11e174f51
Anshu-Singh1998/python-tutorial
/fourty.py
289
4.28125
4
# let us c # Write a function to calculate the factorial value of any integer enyered # through the keyboard. def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) n = int(input("Input a number to compute the factorial : ")) print(factorial(n))
true
5ca65e5362eca7bf9cfeda1021564e6c20ccb4a5
Anshu-Singh1998/python-tutorial
/eight.py
228
4.25
4
# let us c # input a integer through keyboard and find out whether it is even or odd. a = int(input("Enter a number to find out even or odd:")) if a % 2 == 0: print("the number is even") else: print("the number is odd")
true
4516d98fd3db1d9c9049bb6cb3d1fe18e9e7914b
Anshu-Singh1998/python-tutorial
/nineteen.py
268
4.15625
4
# From internet # Write a program to remove an element from an existing array. from array import * num = list("i", [4, 7, 2, 0, 8, 6]) print("This is the list before it was removed:"+str(num)) print("Lets remove it") num.remove(2) print("Removing performed:"+str(num))
true
a17e198eeaac4a06b472845f6dffdd2bcf1f74c3
damsonli/mitx6.00.1x
/Mid_Term/problem7.py
2,190
4.4375
4
''' Write a function called score that meets the specifications below. def score(word, f): """ word, a string of length > 1 of alphabetical characters (upper and lowercase) f, a function that takes in two int arguments and returns an int Returns the score of word as defined by t...
true
622b10cab635fa09528ffdeab353bfd42e69bdc7
damsonli/mitx6.00.1x
/Final Exam/problem7.py
2,105
4.46875
4
""" Implement the class myDict with the methods below, which will represent a dictionary without using a dictionary object. The methods you implement below should have the same behavior as a dict object, including raising appropriate exceptions. Your code does not have to be efficient. Any code that uses a Python di...
true
de17bb8bd8f94f087845cd59e2ad83f7b43f8ebd
Nicolanz/holbertonschool-web_back_end
/0x00-python_variable_annotations/3-to_str.py
269
4.21875
4
#!/usr/bin/env python3 """Module to return str repr of floats""" def to_str(n: float) -> str: """Function to get the string representation of floats Args: n (float): [float number] Returns: str: [str repr of n] """ return str(n)
true
94c63cf09da1e944b67ca243ee40f67ad3550cf5
Nicolanz/holbertonschool-web_back_end
/0x00-python_variable_annotations/9-element_length.py
435
4.28125
4
#!/usr/bin/env python3 """Module with correct annotation""" from typing import Iterable, Sequence, List, Tuple def element_length(lst: Iterable[Sequence]) -> List[Tuple[Sequence, int]]: """Calculates the length of the tuples inside a list Args: lst (Sequence[Iterable]): [List] Returns: ...
true
aedfe44fe94a31da053f830a56ad5842c77b4610
jesseklein406/data-structures
/simple_graph.py
2,747
4.28125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """A data structure for a simple graph using the model from Martin BroadHurst http://www.martinbroadhurst.com/graph-data-structures.html """ class Node(object): """A Node class for use in a simple graph""" def __init__(self, name, value): """Make a new nod...
true
097a3e342b6f3d947ea81924e8b89a1563b425bc
ElAouane/Python-Basics
/104_List.py
1,195
4.5625
5
#LIST #Defining a list #The syntax of a list is [] crazy_landlords = [] #print(type(crazy_landlords)) # We can dynamically define a list crazy_landlords = ['My. Richards', 'Raj', 'Mr. Shirik', 'Ms Zem'] #Access a item in a list. #List are organized based on the index crazy_landlords = ['My. Richards', 'Raj', 'Mr. S...
false
dfc818c931c516d40f82d5d2b16c18bd2b2ff20d
vibhor3081/GL_OD_Tracker
/lib.py
2,986
4.1875
4
import pandas as pd def queryTable(conn, tablename, colname, value, *colnames): """ This function queries a table using `colname = value` as a filter. All columns in colnames are returned. If no colnames are specified, `select *` is performed :param conn: the connection with the database to be used t...
true
e617e0788ff6129a6717d7cc26bb2a9fe2e7f12b
yasmineElnadi/python-introductory-course
/Assignment 2/2.9.py
330
4.1875
4
#wind speed ta=float(input("Enter the Temperature in Fahrenheit between -58 and 41:")) v=eval(input("Enter wind speed in miles per hour:")) if v < 2: print("wind speed should be above or equal 2 mph") else: print("the wind chill index is ", format(35.74 + (0.6215*ta) - (35.75* v**0.16) + (0.4275 * ta * v**0.16)...
true
1b6d2d0843efad0980c4fa09aa7388c3b1eb609c
birkirkarl/assignment5
/Forritun/Æfingardæmi/Hlutapróf 1/practice2.py
241
4.28125
4
#. Create a program that takes two integers as input and prints their sum. inte1= int(input('Input the first integer:')) inte2= int(input('Input the second integer:')) summan= int(inte1+inte2) print('The sum of two integers is:',+summan)
true
18ad8bcf6e920438f101c955b30c4e4d11f72e4b
birkirkarl/assignment5
/Forritun/Assignment 10 - lists/PascalTriangle.py
422
4.15625
4
def make_new_row(row): new_row = [] for i in range(0,len(row)+1): if i == 0 or i == len(row): new_row.append(1) else: new_row.append(row[i]+row[i-1]) return new_row # Main program starts here - DO NOT CHANGE height = int(input("Height of Pascal's triangle (...
true
35b5bcedc003939f44bef58326dd49e725717da4
LucianoUACH/IP2021-2
/PYTHON/Funcion1/funcion1.py
219
4.25
4
print("Ingrese el valor de X:") x = float(input()) #f = ((x+1)*(x+1)) + ((2*x)*(2*x)) f = (x+1)**2 + (2*x)**2 # el operador ** la potencia print("El resultado es: " + str(f)) # str() tranforma un número a una palabra
false
b74ac298e5cba51c032cee6114decf658a67f494
dhurataK/python
/score_and_grades.py
804
4.1875
4
def getGrade(): print "Scores and Grades" for i in range(0,9): ip = input() if(ip < 60): print "You failed the exam. Your score is: "+str(ip)+" Good luck next time!" elif (ip >= 60 and ip <= 69): print "Score: "+str(ip)+"; Your grade is D" elif (ip >= 70 a...
true
739202147eac8f44a40e213cbd6bafdcc26dcea1
17leungkaim/programming-portfolio
/grading.py
426
4.1875
4
# program to figure out grades score = int(raw_input("Enter your test score")) if score >= 93: print "A" elif score >= 90: print "-A" elif score >= 87: print "B+" elif score >=83: print "B" elif score >=80: print "-B" elif score >=77: print "+C" elif score >=73: print "C" elif score >=70: print "-C" elif sco...
false
495dffd2bb07f45cc5bb355a1a00d113c2cd6288
cadyherron/mitcourse
/ps1/ps1a.py
981
4.46875
4
# Problem #1, "Paying the Minimum" calculator balance = float(raw_input("Enter the outstanding balance on your credit card:")) interest_rate = float(raw_input("Enter the annual credit card interest rate as a decimal:")) min_payment_rate = float(raw_input("Enter the minimum monthly payment rate as a decimal:")) monthl...
true
f3fb695d70656cd48495be8fc89af09dd3cee40a
learning-triad/hackerrank-challenges
/gary/python/2_if_else/if_else.py
838
4.40625
4
#!/bin/python3 # # https://www.hackerrank.com/challenges/py-if-else/problem # Given a positive integer n where 1 <= n <= 100 # If n is even and in the inclusive range of 6 to 20, print "Weird" # If n is even and greater than 20, print "Not Weird" def check_weirdness(n): """ if n is less than 1 or greater than...
true
d13d318c78f4f902ef6b1a1474a832c70db6b9f2
demptdmf/python_lesson_3
/range.py
2,788
4.21875
4
# Когда использовать RANGE # позволяет создать последовательность целых чисел numbers = range(10) print(numbers) print(type(numbers), '— это диапазон') print(list(range(1, 20, 2))) # Напечатать список от 1 до 20 с шагом "2" — 1+2, 3+2, 5+2 и так далее for number in range(1, 20, 2): # Просто ...
false
c6f81be710ff83f95f7b3ed87711cdcc40251903
florenciano/estudos-Python
/livro-introducao-a-programacao-em-python/cap10/classe-objeto-all.py
2,004
4.125
4
# -*- coding: utf-8 -*- #abrindo conta no banco Tatú class Cliente(object): def __init__(self, nome, telefone): self.nome = nome self.telefone = telefone #movimentando a conta """ Uma conta para representar uma conta do banco com seus clientes e seu saldo """ class Conta(object): def __init__(self, clientes, nu...
false
6373d12759eabd9b3ffadbc995b49d28b9f6fae7
Ftoma123/100daysprograming
/day30.py
550
4.375
4
#using range() in Loop for x in range(6): print(x) print('____________________') #using range() with parameter for x in range(2,6): print(x) print('____________________') #using range() with specific increment for x in range(2,20,3): #(start, ende, increment) print(x) print('____________________') #else ...
false
1083052e37b5556980972557425aeac95fa7931b
arensdj/math-series
/series_module.py
2,753
4.46875
4
# This function produces the fibonacci Series which is a numeric series starting # with the integers 0 and 1. In this series, the next integer is determined by # summing the previous two. # The resulting series looks like 0, 1, 1, 2, 3, 5, 8, 13, ... def fibonacci(n): """ Summary of fibonacci function: compu...
true
a8b4639a8a2de162236ba3ced3ce9229a2d1579d
Nadjamac/Mod1_BlueEdtech
/Aula11_Dicionários/Aula11_Dicionarios_Conteúdo.py
1,012
4.15625
4
#Criando uma lista de tuplas -> estrutura de dados que associa um elemento a outro # lista = [("Ana" , "123-456") , ("Bruno" , "321-654") , ("Cris" , "213 - 546") , ("Daniel" , "231 - 564") , ("Elen" , "111-222")] #Sintaxe de um dicionário # dicionario = {"Ana" : "123-456"} #Criando um dicionário # lista_dicionari...
false
e7189b646cedb06f82885acbe6801cb776aa9a96
chocolate1337/python_base
/lesson_011/01_shapes.py
1,122
4.125
4
# -*- coding: utf-8 -*- import simple_draw as sd # На основе вашего кода из решения lesson_004/01_shapes.py сделать функцию-фабрику, # которая возвращает функции рисования треугольника, четырехугольника, пятиугольника и т.д. # # Функция рисования должна принимать параметры # - точка начала рисования # - угол наклона ...
false
ce9d1cd697671c12003a39b17ee7a9bfebf0103d
dlaststark/machine-learning-projects
/Programming Language Detection/Experiment-2/Dataset/Train/Python/letter-frequency-3.py
890
4.125
4
import string if hasattr(string, 'ascii_lowercase'): letters = string.ascii_lowercase # Python 2.2 and later else: letters = string.lowercase # Earlier versions offset = ord('a') def countletters(file_handle): """Traverse a file and compute the number of occurences of each letter retu...
true
1215bc74ec9edc0701ce6004ccd9031ad6c079ff
The-SIVA/python
/average length of the word in the sentence.py
343
4.15625
4
sentenct_list = input().split() length_of_sentence_list = len(sentenct_list) sum_of_all_words_lengths = 0 for word in sentenct_list: length_of_word = len(word) sum_of_all_words_lengths += length_of_word average_length_of_words_in_sentence = (sum_of_all_words_lengths/length_of_sentence_list) print(average_lengt...
false
7424e3d1c91b4052176e86aeedc9261a86490a14
kiukin/codewars-katas
/7_kyu/Descending_order.py
546
4.125
4
# Kata: Descending Order # https://www.codewars.com/kata/5467e4d82edf8bbf40000155/train/python # Your task is to make a function that can take any non-negative integer as a argument and # return it with its digits in descending order. Essentially, rearrange the digits to # create the highest possible number. # Exam...
true
36a0cb1db271953430c191c321286014bc97ed6d
Asabeneh/Fundamentals-of-python-august-2021
/week-2/conditionals.py
997
4.40625
4
is_raining = False if is_raining: print('I have to have my umbrella with me') else: print('Go out freely') a = -5 if a > 0: print('The value is positive') elif a == 0: print('The value is zero') elif a < 0: print('This is a negative number') else: print('It is something else') # weather = in...
true
d6e5435f634beb7a11f6095bb3f697fbeb426fb8
hossein-askari83/python-course
/28 = bult in functions.py
898
4.25
4
number = [0, 9, 6, 5, 4, 3, -7, 1, 2.6] print("-----------") # all , any print(any(number)) # if just one of values was true it show : true (1 and other numbers is true) print(all(number)) # if just one of values was false it show : false (0 is false) print("-----------") # min , max print(max(number)) # show m...
true
4b77591a779a29ea29cad5805a335ee7b5b9da5f
rintukutum/functional-gene-annotation
/fact_function.py
205
4.15625
4
def factorial (n): f = 1 while (n >0 ): f = f * n n = n - 1 return f print("Input your number") n= int(input()) print ("factorial of your input number:", factorial(n))
false
f7df70c87749177fdb0473207659ba0ee49741c0
beyzakilickol/week1Wednesaday
/palindrome.py
591
4.15625
4
word = input('Enter the word: ') arr = list(word) second_word = [] for index in range(len(arr)-1, -1 , -1): second_word.append(arr[index]) print(second_word) reversed = ''.join(second_word) print(reversed) def is_palindrome(): if(word == reversed): return True else: return False print(i...
false
24f522cdedbbbe2c80fb94ba468f366102de7d06
beepboop271/programming-contest-stuff
/CCC-15-J1.py
248
4.125
4
month = input() day = input() if month < 2: output = "Before" elif month > 2: output = "After" else: if day < 18: output = "Before" elif day > 18: output = "After" else: output = "Special" print output
false
b707c3f7f4ebc050b4f9b97502c8505a35acb690
guohuahua2012/samples
/OOP/study_class.py
1,305
4.15625
4
#coding=utf-8 ''' author:chunhua ''' ''' 对象的绑定方法 在类中,没有被任何装饰器的方法就是绑定的到对象到的方法,这类方法专门为对象定制 ''' class People1: country = 'China' def __init__(self, name): self.name = name def eat(self): print("%s is eating--1" %self.name) people1 = People1('nick') print(people1.eat()) ''' 类的绑定方法 @classm...
false
0e4a586b1bfb3a97d3311b61d8653e0041c42eb0
sinceresiva/DSBC-Python4and5
/areaOfCone.py
499
4.3125
4
''' Write a python program which creates a class named Cone and write a function calculate_area which calculates the area of the Cone. ''' import math class ConeArea: def __init__(self): pass def getArea(self, r, h): #SA=πr(r+sqrt(h**2+r**2)) return math.pi*r*(r+math.sqrt(h**2+r**2)) con...
true
928d5d403a69cd99e6c9ae579a6fc34b87965c1c
kostyafarber/info1110-scripts
/scripts/rain.py
468
4.125
4
rain = input("Is it currently raining? ") if rain == "Yes": print("You should take the bus.") elif rain == "No": travel = int(input("How far in km do you need to travel? ")) if travel > 10: print("You should take the bus.") elif travel in range(2, 11): print("You should ride your bike....
true
a2d0a7288f4fc9ce22f9f1447e1e70046b80b30b
tschutter/skilz
/2011-01-14/count_bits_a.py
733
4.125
4
#!/usr/bin/python # # Given an integer number (say, a 32 bit integer number), write code # to count the number of bits set (1s) that comprise the number. For # instance: 87338 (decimal) = 10101010100101010 (binary) in which # there are 8 bits set. No twists this time and as before, there is # no language restriction....
true
1d48da6a7114922b7e861afa93ddc03984815b0c
iZwag/IN1000
/oblig3/matplan.py
477
4.21875
4
# Food plan for three residents matplan = { "Kari Nordmann": ["brod", "egg", "polser"], "Magda Syversen": ["frokostblanding", "nudler", "burger"], "Marco Polo": ["oatmeal", "bacon", "taco"]} # Requests a name to check food plan for person = input("Inquire the food plan for a resident, by typi...
true
914134c3475f4618fa39fbbde917a4ada837968f
iZwag/IN1000
/oblig5/regnefunksjoner.py
1,933
4.125
4
# 1.1 # Function that takes two parameters and returns the sum def addisjon(number1, number2): return number1 + number2 # 1.2 # Function that subtracts the second number from the first one def subtraksjon(number1, number2): return number1 - number2 # 1.2 # Function that divides the first argument by the sec...
true
67b284c3f8dcaed9bdde75429d81c7c96f31847c
keithkay/python
/python_crash_course/functions.py
2,432
4.78125
5
# Python Crash Course # # Chapter 8 Functions # functions are defined using 'def' def greeting(name): """Display a simple greeting""" # this is an example of a docstring print("Hello, " + name.title() + "!") user_name = input("What's your name?: ") greeting(user_name) # in addition to the normal positional ...
true
03ec200798e7dfd44352b6997e3b6f2804648732
keithkay/python
/python_crash_course/classes.py
776
4.5
4
# Python Crash Course # # Chapter 9 OOP # In order to work with an object in Python, we first need to # define a class for that object class Dog(): """A simple class example""" def __init__(self, name, age): """Initializes name and age attributes.""" self.name = name self.age = age ...
true
d146d5541c713488ed3e3cc0497baea68cf368ff
tcsfremont/curriculum
/python/pygame/breaking_blocks/02_move_ball.py
1,464
4.15625
4
""" Base window for breakout game using pygame.""" import pygame WHITE = (255, 255, 255) BALL_RADIUS = 8 BALL_DIAMETER = BALL_RADIUS * 2 # Add velocity component as a list with X and Y values ball_velocity = [5, -5] def move_ball(ball): """Change the location of the ball using velocity and direction.""" ba...
true
56cb3dc1b9ef863246aa518d8a83b90b3f0c2d9d
trcooke/57-exercises-python
/src/exercises/Ex07_area_of_a_rectangular_room/rectangular_room.py
830
4.125
4
class RectangularRoom: SQUARE_FEET_TO_SQUARE_METER_CONVERSION = 0.09290304 lengthFeet = 0.0 widthFeet = 0.0 def __init__(self, length, width): self.lengthFeet = length self.widthFeet = width def areaFeet(self): return self.lengthFeet * self.widthFeet def areaMeters(sel...
true
750f8c4d04bdd56ed851412e6b4b478ff9b4a0c3
gchh/python
/code/7-5.py
1,295
4.1875
4
class Student(object): def __init__(self,name): self.name=name s=Student('Bob') s.score=90 print(s.__dict__) del s.score print(s.__dict__) class Student1(object): name ='Student' p=Student1() print(p.name) #打印name属性,因为实例并没有name属性,所以会继续查找class的name属性 print(Student1.name) #打印类的name属性 p.name='Mich...
false
71400d34dacc010d4351186485e9266fda5e7513
kosvicz/swaroop
/user_input.py
338
4.15625
4
#!/usr/bin/env python3 #--*-- conding: utf-8 --*-- def reverse(text): return text[::-1] def is_palindrome(text): return text == reverse(text) something = input('Введите текск: ') if(is_palindrome(something)): print('Да, это палиндром') else: print('Нет, это не палиндром')
false
9ba7fb40eacf3ebca5c5fb9a5ac9e823f1ef9df0
mccabedarren/python321
/p12.p3.py
1,098
4.46875
4
#Define function "sqroot" (Function to find the square root of input float) #"Sqroot" calculates the square root using a while loop #"Sqroot" gives the number of guesses taken to calculate square root #The program takes input of a float #if positive the program calls the function "sqroot" #if negative the program...
true
dc5b545562df84e36ce8696cdaa33e0239a37001
mccabedarren/python321
/p13.p2.py
431
4.46875
4
#Program to print out the largest of two user-entered numbers #Uses function "max" in a print statement def max(a,b): if a>b: return a else: return b #prompt the user for two floating-point numbers: number_1 = float(input("Enter a number: ")) number_2 = float(input("Enter another number: ")) ...
true
e0fc45ba2b2da28b629f3c6bf7ce6c85d4334ca4
elizabethadventurer/Treasure-Seeker
/Mini Project 4 part 1.py
1,575
4.28125
4
# Treasure-Seeker #Introduction name = input("Before we get started, what's your name?") print("Are you ready for an adventure", name, "?") print("Let's jump right in then, shall we?") answer = input("Where do you thnk we should start? The old bookstore, the deserted pool, or the abandoned farm?") if answer == "the d...
true
55ca7df15d0ec947e09b3c0390030ea750143a6c
zingpython/webinarPytho_101
/five.py
233
4.25
4
def even_or_odd(): number = int(input("Enter number:")) if number % 2 == 1: print("{} is odd".format(number)) elif number % 2 == 0: print("{} is even".format(number)) even_or_odd() # "Dear Mr.{} {}".format("John","Murphy")
false
6e6545bf2e9b4a7ff360d8151e6418168f777ff8
sagarujjwal/DataStructures
/Stack/StackBalancedParens.py
986
4.15625
4
# W.A.P to find the given parenthesis in string format is balanced or not. # balanced: {([])}, [()] # non balanced: {{, (() from stack import Stack def is_match(p1, p2): if p1 == '[' and p2 == ']': return True elif p1 == '{' and p2 == '}': return True elif p1 == '(' and p2 == ')': ...
true
380769147add0ecf5e071fa3eb5859ee2eded6da
alexmeigz/code-excerpts
/trie.py
1,185
4.40625
4
# Trie Class Definition # '*' indicates end of string class Trie: def __init__(self): self.root = dict() def insert(self, s: str): traverse = self.root for char in s: if not traverse.get(char): traverse[char] = dict() traverse = traver...
true
03995a46974520e6d587e3c09a24fa1c98a6423f
brownboycodes/problem_solving
/code_signal/shape_area.py
443
4.1875
4
""" Below we will define an n-interesting polygon. Your task is to find the area of a polygon for a given n. A 1-interesting polygon is just a square with a side of length 1. An n-interesting polygon is obtained by taking the n - 1-interesting polygon and appending 1-interesting polygons to its rim, side by side. Y...
true
298ce4a268c6242ee4b18db1b5029995ebaa183f
brownboycodes/problem_solving
/code_signal/adjacent_elements_product.py
362
4.125
4
""" Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. """ def adjacentElementsProduct(inputArray): product=0 for i in range(0,len(inputArray)-1): if inputArray[i]*inputArray[i+1]>product or product==0: product=inputArray[i...
true
98edf9ce118f9641f55d08c6527da8d01f03b49a
kirubeltadesse/Python
/examq/q3.py
604
4.28125
4
# Kirubel Tadesse # Dr.Gordon Skelton # J00720834 # Applied Programming # Jackson State University # Computer Engineering Dept. #create a program that uses a function to determine the larger of two numbers and return the larger to the main body of the program and then print it. You have to enter the numbers from the...
true
9b773282655c5e3a6a35f9b59f22ddb221386870
AyvePHIL/MLlearn
/Sorting_alogrithms.py
2,275
4.21875
4
# This is the bubbleSort algorithm where we sort array elements from smallest to largest def bubbleSort(arr): n = len(arr) # Traverse through all array elements for i in range(n - 1): # range(n) also work but outer loop will repeat one time more than needed (more efficient). # Last i eleme...
true
2486925e16396536f048f25889dc6d3f7675549a
NathanielS/Week-Three-Assignment
/PigLatin.py
500
4.125
4
# Nathaniel Smith # PigLatin # Week Three Assignment # This program will take input from the usar, translate it to PigLatin, # and print the translated word. def main (): # This section of code ask for input from the usar and defines vowels word = input("Please enter an English word: ") vowels = "AEIOUaeiou" ...
true
4d872b88871da0fd909f4cb71954a3f0f8d0f43f
RocketDonkey/project_euler
/python/problems/euler_001.py
470
4.125
4
"""Project Euler - Problem 1 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. """ def Euler001(): num = 1000 r = range(3, num) for index, i in enumerate(xrange(3, num)): ...
true
54406e46376433c727027b350e1b7b6a6f818181
kamil-fijalski/python-reborn
/@Main.py
2,365
4.15625
4
# Let's begin this madness print("Hello Python!") int1 = 10 + 10j int2 = 20 + 5j int3 = int1 * int2 print(int3) print(5 / 3) # floating print(5 // 3) # integer str1 = "Apple" print(str1[0]) print(str(len(str1))) print(str1.replace("p", "x") + " " + str1.upper() + " " + str1.lower() + " " + str1.swapcase()) # me...
true
7b2d9aa4ece7d8a777def586cb3af02685eac071
omer-goder/python-skillshare-beginner
/conditions/not_in_keyword.py
347
4.1875
4
### 17/04/2020 ### Author: Omer Goder ### Checking if a value is not in a list # Admin users admin_users = ['tony','frank'] # Ask for username username = input("Please enter you username?") # Check if user is an admin user if username not in admin_users: print("You do not have access.") else: p...
true
f457e6763c190e10b297912019aa76ad7dc899a4
omer-goder/python-skillshare-beginner
/dictionary/adding_user_input_to_a_dictionary.py
997
4.375
4
### 04/05/2020 ### Author: Omer Goder ### Adding user input to a dictionary # Creat an empty dictionary rental_properties = {} # Set a flag to indicate we are taking apllications rental_open = True while rental_open: # while True # prompt users for name and address. username = input("\nWhat is your nam...
true
fd1ccd8e94a9a2f7d68ce5caade21b4727a5356e
omer-goder/python-skillshare-beginner
/conditions/or_keyword.py
418
4.21875
4
### 17/04/2020 ### Author: Omer Goder ### Using the OR keyword to check values in a list # Names registered registered_names = ['tony','frank','mary','peter'] username = input("Please enter username you would like to use.\n\n").lower() #Check to see if username is already taken if username in registered_na...
true
34c12dde56d3cb3176565750b4292d6a062105df
omer-goder/python-skillshare-beginner
/list/a_list_of_numbers.py
552
4.25
4
### 15/04/2020 ### Author: Omer Goder ### Creating a list of numbers # Convert numbers into a list numbers = list(range(1,6)) print(numbers) print('\n') # print("List of even number in the range of 0 to 100:") even_numbers = list(range(0,102, 2)) print(even_numbers) print('\n') print("List of square va...
true
97360bd4a55477713e3868b9c9af811143151aca
omer-goder/python-skillshare-beginner
/class/class_as_attribute(2).py
1,127
4.34375
4
### 11/05/2020 ### Author: Omer Goder ### Using a class as an attribute to another class class Tablet(): """This will be the class that uses the attribute.""" def __init__(self, thickness, color, battery): """Initialize a parameter as a class""" self.thickness = thickness self.color = color self.battery = ...
true
f385856290585e7e625d82c6f1d0b6f5aa171f71
akram2015/Python
/HW4/SECURITY SCANNER.py
631
4.4375
4
# this program Prompt user for a file name, and read the file, then find and report if file contains a string with a string ("password=") in it. # file name = read_it.txt found = True userinput = input ("Enter the file name: ") string = input ("Enter the string: ") myfile = open (userinput) # open the file that might...
true
c6ee4574166c0e00e6e7bddad59ca354677ea66a
akram2015/Python
/HW3/BunnyEars.py
431
4.3125
4
# Recursive function that return the number of ears for bunnies def bunny_ears(n): # n number of bunnies if n <= 0: # 0 bunny condition return 0 elif n % 2 == 0: # for even numbers of bunnies return bunny_ears(n-1) + 2 else: # for odd numbers of bunnies return bun...
false
8e2989008f52b56dee43360378533c5b4a757d90
josego85/livescore-cli
/lib/tt.py
2,078
4.40625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import re ''' module to convert the given time in UTC to local device time _convert() method takes a single time in string and returns the local time convert() takes a list of time in string format and returns in local time NOTE: any string not in the format "...
true
0c900e9b4ad2f2b3e904ee61661cda39ed458646
shivraj-thecoder/python_programming
/Swapping/using_tuple.py
271
4.34375
4
def swap_tuple(value_one,value_two): value_one,value_two=value_two,value_one return value_one,value_two X=input("enter value of X :") Y=input("enter value of Y :") X, Y=swap_tuple(X,Y) print('value of X after swapping:', X) print('value of Y after swapping:', Y)
true
ad00ddf3a4f192d2017d9bb8fbb5dd4d90d9a065
Mengeroshi/python-tricks
/3.Classes-and-OOP/4.3.copying_arbitrary_objects.py
779
4.1875
4
import copy """Shallow copy of an object """ class Point: def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return f'Point({self.x!r}, {self.y!r})' a = Point(23, 42) b = copy.copy(a) print(a) print(b) print(a is b) class Rectangle: def __init__(self, topleft, ...
false
1c77967940f1f8b17e50f4f2632fb34a13b3daf0
sweetysweat/EPAM_HW
/homework1/task2.py
692
4.15625
4
""" Given a cell with "it's a fib sequence" from slideshow, please write function "check_fib", which accepts a Sequence of integers, and returns if the given sequence is a Fibonacci sequence We guarantee, that the given sequence contain >= 0 integers inside. """ from typing import Sequence def check_fibonacci...
true
d10cd2ab04df7e4720f72bf2f5057768e8bfad3f
sweetysweat/EPAM_HW
/homework8/task_1.py
1,745
4.21875
4
""" We have a file that works as key-value storage, each line is represented as key and value separated by = symbol, example: name=kek last_name=top song_name=shadilay power=9001 Values can be strings or integer numbers. If a value can be treated both as a number and a string, it is treated as number. Write a wrappe...
true
4209cfd3b879e1c02531a7e8dae52dee26d2cce0
bahadirsensoz/PythonCodes
/fahrenheit.py
266
4.28125
4
while(True): print("CELSIUS TO FAHRENHEIT CONVERTER") celsius = float(input("Please enter your degree by celcius:")) #Ali Bahadır Şensöz fahr=1.8*celsius+32 print("Your temperature " +str(celsius) + " Celsius is " +str(fahr) + " in Fahrenheit.")
false
50e50015e425e4ba5a924775ded68b79cba31edc
sawall/advent2017
/advent_6.py
2,729
4.21875
4
#!/usr/bin/env python3 # memory allocation # #### part one # # The debugger would like to know how many redistributions can be done before a blocks-in-banks # configuration is produced that has been seen before. # # For example, imagine a scenario with only four memory banks: # # The banks start with 0, 2, 7, and 0 bl...
true
910db0a0156d0f3c37e210ec1931fd404f1357e9
aymhh/School
/Holiday-Homework/inspector.py
1,095
4.125
4
import time print("Hello there!") print("What's your name?") name = input() print("Hello there, " + name) time.sleep(2) print("You have arrived at a horror mansion!\nIt's a large and spooky house with strange noises coming from inside") time.sleep(2) print("You hop out of the car and walk closer...") time.sleep(2) pri...
true
24d025d8a89380a8779fbfdf145083a9db64fc07
shahad-mahmud/learning_python
/day_16/unknow_num_arg.py
324
4.15625
4
def sum(*nums: int) -> int: _sum = 0 for num in nums: _sum += num return _sum res = sum(1, 2, 3, 5) print(res) # Write a program to- # 1. Declear a funtion which can take arbitary numbers of input # 2. The input will be name of one or persons # 3. In the function print a message to greet every ...
true
382a8a2f5c64f0d3cd4c1c647b97e19e2c137fda
shahad-mahmud/learning_python
/day_3/if.py
417
4.1875
4
# conditional statement # if conditon: # logical operator # intendation friend_salary = float(input('Enter your salary:')) my_salary = 1200 if friend_salary > my_salary: print('Friend\'s salary is higher') print('Code finish') # write a program to- # a. Take a number as input # b. Identify if a number is po...
true
ec55765f79ce87e5ce0f108f873792fecf5731f6
shahad-mahmud/learning_python
/day_7/python_function.py
347
4.3125
4
# def function_name(arguments): # function body def hello(name): print('Hello', name) # call the funciton n = 'Kaka' hello(n) # Write a program to- # a. define a function named 'greetings' # b. The function print 'Hello <your name>' # c. Call the function to get the message # d. Modify your function and add a...
true
b0824befae2b1d672ac6ec693f97e7c801366c0c
srinivasdasu24/regular_expressions
/diff_patterns_match.py
1,534
4.53125
5
""" Regular expression basics, regex groups and pipe character usage in regex """ import re message = 'Call me at 415-555-1011 tomorrow. 415-555-9999 is my office.' phoneNum_regex = re.compile( r'\d\d\d-\d\d\d-\d\d\d\d') # re.compile to create regex object \d is - digit numeric character mob_num = phoneNum_re...
true