blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
6ff4fb20a4cb3fed80eab57bd874d5f8a3b6d934
hstabelin/Python_Lista_Exercicios
/Lista3 - Repeticao/Exercicio10.py
400
4.125
4
# Faça um programa que receba dois números inteiros e gere os números # inteiros que estão no intervalo compreendido por eles a = int(input('Informe o primeiro valor: ')) b = int(input('Informe o segundo valor: ')) c = [0] if a < b: while a < b: print(a) c.append(a) a = a + 1 exit() el...
false
419a64996f9270f2e25b6969d1352def3c969b76
theboyarintsev/Python
/Part 3/Task 2.py
832
4.28125
4
# Напишите функцию, вычисляющую длину отрезка по координатам его концов. # С помощью этой функции напишите программу, вычисляющую периметр треугольника по координатам трех его вершин. # На вход программе подается 3 пары целых чисел — координат x₁, y₁, x₂, y₂, x₃, y₃ вершин треугольника. from math import sqrt print('x1...
false
1947fecfb584b3fcc6e8b795ee833d9f16fa1918
niranjanh/RegExp
/regexp_16.py
697
4.46875
4
/* Comprehension: Escape Sequence Description Write a regular expression that returns True when passed a multiplication equation. For any other equation, it should return False. In other words, it should return True if there an asterisk - ‘*’ - present in the equation. Sample positive cases (should match all of the...
true
61f70e447fdee0f317ef90ec7fc649fafc5b8f7d
kmvinoth/Hackerrank
/Easy/lst_comprehension.py
900
4.375
4
""" Let's learn about list comprehensions! You are given three integers X,Y and Z representing the dimensions of a cuboid along with an integer N. You have to print a list of all possible coordinates given by i,j,k on a 3D grid where the sum of i+j+k is not equal to N. Here 0<=i<=X; 0<=j<=Y; 0<=k<=Z; Input Format Fou...
true
20e3fc287dae5c16e9ad0c0f1d63f5fec46723ec
zharinovaa/homework9
/polish_notation.py
1,056
4.1875
4
equation = input('Введите выражение : ') operations = equation.split() if len(operations) != 3: try: raise Exception('Необходимо ввести только 3 аргумента') except Exception as e: print(e) exit(0) result = 'Результат не получен' assert (operations[0] == '+') or (operations[0...
false
7c194fe3d8c6a81286e733ac83e70504271b88df
xyz010/Leetcode
/101 Symmetric Tree.py
741
4.125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def check(self,leftSub, rightSub): if leftSub == None and rightSub == None: return True elif ...
true
4e82f8cd9bb1ea8ef60061ac84b47222963a086b
erik-vojtas/Practice-field
/passwordChecker.py
1,676
4.21875
4
#Write a program to check the validity of password input by users. #Conditions: # At least 1 letter between [a-z] # At least 1 number between [0-9] # At least 1 letter between [A-Z] # At least 1 character from [$#@] # Minimum length of transaction password: 6 # Maximum length of transaction password: 12 def password...
true
02117a734be84fa3c948446902ab867fbe88f014
Temitayooyelowo/Udacity_Nanodegrees
/Data_Structures_and_Algorithms /Project_0/Task4.py
1,529
4.21875
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 4: The telephone company want to i...
true
c98a4ff408969037fb8e038cc7cc94691faf1a61
suruchee/python-basics
/Python-Practice/challenge2.py
418
4.65625
5
#Create a list of your favorite food items, the list should have minimum 5 elements. #List out the 3rd element in the list. #Add additional item to the current list and display the list. #Insert an element named tacos at the 3rd index position of the list and print out the list elements. food = ["rice","bread","milk","...
true
aaae65edbc24df9a01f2248b8fbb438933429114
suruchee/python-basics
/Python-Practice/regularExpression.py
1,600
4.1875
4
import re pattern = r"suru" if re.match(pattern,"asuruchi"): print('Match found') else: print('No match found') if re.search(pattern,"asuruchi"): print('Match found') else: print('No match found') print(re.findall(pattern,"asuruchisuru")) #find and replace import re string = "My name is John, Hi I'am...
false
e9ef572e9c29db7165008c41587441ec14afebb6
suruchee/python-basics
/Python-Practice/object-oriented-practice.py
1,612
4.25
4
class Students: def __init__(self, name, contact): self.name = name self.contact = contact def getdata(self): print("Accepting data") self.name = input("Enter name") self.contact = input("Enter contact") def putdata(self): print("The name is" + self.name, "T...
true
6604ec8bf1b16e8a1eba7fafae7b44e2e2b7ce43
DanielleRenee/python_practices
/danielle-functions.py
1,587
4.5625
5
# Define your function below. nums = [5, 12, 6, 7, 4, 9, 10] not_all_nums = [4, 5, 6, 8, 'w', 'o', 'w'] def even_or_odd(lst, string='even'): """ Take two arguments, a list and a string indicating whether the user wants a new list containing only the odd or even numbers. Return the user its new list. ...
true
cddb25d783549db4eaf2e2daf6e7236b14489a4b
zachknig/Pirple-work
/main.py
1,837
4.34375
4
""" -- HOMEWORK 1 -- Zach Koenig, 07.22.19 This assignment involves solidifying knowledge gained with assigning and printing variables within a python framework by creating and pushing metadata variables concerning my favorite song, Moscow by Autoheart. All data was collected using Spotify. """ # variable defi...
true
bbd16e7366ce210165e99e89a3fef964be3cf74b
CNM07/Python_Basics
/task1.py
436
4.34375
4
#Write a program which accepts a string as input to print "Yes" if the string is "yes", "YES" or "Yes", otherwise print "No". #Hint: Use input () to get the persons input word = input('Type a word:' ) if word == 'yes': print('Yes') elif word == 'Yes': print('Yes') elif word == 'YES': print('Yes') else: ...
true
4f2b5b0f5cf8b0c98ab3ec8e8a0b593d10c1ba91
JeanB762/python_cookbook
/find_commonalities_in_2_dict.py
553
4.3125
4
# You have two dictionaries and want to find out what they # might have in common (same keys, same values, etc.). # consider two dictionaries: a = { 'x' : 1, 'y' : 2, 'z' : 3 } b = { 'w' : 10, 'x' : 11, 'y' : 2 } # To find out what the two dictionaries have in common, simply # perform co...
true
964ac2ff4c3a83af8d0f61f5d42b51ccc844896a
eimearfoley/Carcassonne
/public_html/cgi-bin/Meeple.py
1,231
4.15625
4
class Meeple(object): """Creates a meeple Object 01/02/18 - Stephen and Euan Initiates a Meeple Object. player points to the player object which "owns" the Meeple placed is a boolean which represents if the Meeple is placed on the board or not colour is a string which represent...
true
ecba0f2ac4dfb7dc7ea6243fcfc0565b3aff7cdb
python-programming-1/homework-3-rantheway
/collatz.py
445
4.34375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 17 14:48:23 2019 @author: shen """ def collatz(num): while num != 1: if num % 2 == 0: num = num // 2 print(num) elif num % 2 == 1: num = 3 * num + 1 print(num) ...
false
d3d704d800c6d5d9a99d6022f2ae3f97e61f3ed4
chriskaringeg/Crimmz-pass-locker
/user_test.py
1,887
4.15625
4
import unittest from user import User class TestUser(unittest .TestCase): ''' Tets case that defines test cases for the user class behaviours Args: unittest.TestUser: TestUser class that helps in creating test cases ''' def setUp(self): ''' set up method to run bef...
true
28f26d0f4c1f28a207901f5f19932badf4c2cc33
Ritvik09/My-Python-Codes
/Python Codes/Calculator.py
1,501
4.125
4
# Print options (add,sub,mult,div) # 1=add 2=sub 3=mult 4=div # two inputs while True: print("Welcome User!") print("Press 1 for Addition") print("Press 2 for Subtraction") print("Press 3 for Multiplication") print("Press 4 for Division") Operation = int(input()) if Operation =...
true
1a6fcbe4f898b684fe086f26cdb05ea94dea8ffb
SACHSTech/ics2o-livehack1-practice-TheFaded-Greg-L
/minutes_days.py
652
4.4375
4
''' ------------------------------------------------------------------------------- Name: minutes_days.py Purpose: Converts Minutes to days, hours and minutes Author: Lui.G Created: 03/12/2020 ------------------------------------------------------------------------------ ''' # Variables for the converter minutes = i...
true
589c17376ba0bbcaed8bdd591a462b7a7359b2e2
zqhhn/Python
/day07/code/_set.py
793
4.34375
4
""" 创建一个set,需要提供一list作为输入集合 重复元素在set中会被自动过滤 通过add(key)方法可以添加元素到set中,可以重复添加,但不会有效果 通过remove(key)方法可以删除元素 set可以看成数学意义上的无序和无重复元素的集合,因此,两个set可以做数学意义上的交集、并集等操作: set和dict的唯一区别仅在于没有存储对应的value,但是,set的原理和dict一样,所以,同样不可以放入可变对象, 因为无法判断两个可变对象是否相等,也就无法保证set内部“不会有重复元素” """ s = set([1,2,3]) print(s) s = set([1,1,1,2,2,3,4,5,5]) s.ad...
false
b39323b5b8182ace36e3e81835963e3effd8c0e7
zqhhn/Python
/day07/code/_dic.py
853
4.28125
4
""" 把数据放入dict的方法,除了初始化时指定外,还可以通过key放入 1.通过in判断key是否存在 2.dict提供的get()方法,如果key不存在,可以返回None,或者自己指定的value: """ user_dic = {"wang":18,"MR":19} # print(user_dic["wang"]) user_dic["wang"] = 28 # print(user_dic["wang"]) # 把数据放入dict的方法,除了初始化时指定外,还可以通过key放入 user_dic["zhong"] = 13 # print(user_dic["zhong"]) # 通过in判断key是否存在...
false
21f8aa6c4f01ad917bec22dbac6d4f65611c6073
alexssantos/Python-codes
/Samples/Exercice/TP3-DR2/dr2-tp3-1.py
331
4.15625
4
myList = [] for element in range(5): myList.append(element) print(myList) if 3 in myList: myList.remove(3) else: print('myList do not have item 3') if 6 in myList: myList.remove(6) else: print('myList do not have item 6') print(myList) print('Length of myList: ', len(myList)) myList[-1] = 6 pr...
true
7f41fdc174d611267eff4bcec042c39d2e1a426a
alexssantos/Python-codes
/Samples/DateTime/time-datetime-modules.py
562
4.25
4
import time import datetime # --------- TIME Module --------- format = "%H:%M:%S" # Format print(time.strftime(format)) # 24 hour format # format = "%I:%M:%S" # Format print(time.strftime(format)) # 12 hour format # # Date with time-module format = "%d/%m...
true
8302a5d49be84c32fc24cb201ab43ce159fa6385
iBilbo/CodeWars
/alphabet_position.py
806
4.28125
4
""" kyu 8. INSTRUCTIONS. Welcome. In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don't return it. "a" = 1, "b" = 2, etc. """ def alphabet_position(text): my_dict = {"a": 1, "b": 2, "c": 3, "d": 4, "e": ...
false
208a814d1ffce74cd1bd7eaedb39395b76ddba70
huangichen97/SC101-projects
/SC101 - Github/Class&Object (Campy, Mouse Event)/draw_line.py
1,837
4.125
4
""" File: draw_line Name:Ethan Huang ------------------------- TODO: This program opens a canvas and draws circles and lines in the following steps: First, it detect if the click is a "first click" or a "second click". If first click, the program will draw a hollow circle by SIZE. If second click, the it wi...
true
45b1b9758b34f9ce252ff72bb3334c2e3f60e3aa
huangichen97/SC101-projects
/SC101 - Github/Weather_Master/weather_master.py
2,050
4.25
4
""" File: weather_master.py ----------------------- This program will implement a console program that asks weather data from user to compute the average, highest, lowest, cold days among the inputs. """ EXIT = -1 def main(): """ This program asks weather data from user to compute the average, highest, l...
true
861133ebd916dd067df917638a681321503ce0e3
Vazkito/Paquetes
/factorial_de_un_numero.py
214
4.125
4
def factorial(numero1): numero=int(numero1) resultado=numero while numero>1: resultado=resultado*(numero-1) numero=numero-1 print resultado
false
b06c56dbe88b9e6e56bab775d6ad4a119e97af19
dhyani21/Hackerrank-30-days-of-code
/Day 3: Intro to Conditional Statements.py
480
4.375
4
#Given an integer,n , perform the following conditional actions: # If n is odd, print Weird # If n is even and in the inclusive range of 2 to 5, print Not Weird # 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 n = int(input()) if(n%2 != 0): p...
false
9b5bf68a2f25bfdb2a276fbaa481d28859a9acdf
dhyani21/Hackerrank-30-days-of-code
/Day 25: Running Time and Complexity.py
576
4.1875
4
''' Task A prime is a natural number greater than 1 that has no positive divisors other than 1 and itself. Given a number, n, determine and print whether it is Prime or Not prime. ''' for _ in range(int(input())): num = int(input()) if(num == 1): print("Not prime") else: if(num % 2 == 0 and...
true
fe6db5c4e41116d07e7d1c2990fe6ec5fd59d29f
Cathryne/Python
/ex12.py
581
4.34375
4
# Exercise 12: Prompting People # http://learnpythonthehardway.org/book/ex12.html # request input from user # shorter alternative to ex11 with extra print "" height = float(raw_input("How tall are you (in m)? ")) weight = int(raw_input("How many kilograms do you weigh? ")) print "So, you're %r m tall and %d kg heavy....
true
a4d1185302940515a0e84701c6b485ff7d8e7eae
Cathryne/Python
/ex39a.py
1,843
4.59375
5
# Exercise 39: Dictionaries, Oh Lovely Dictionaries # http://learnpythonthehardway.org/book/ex39.html # create a mapping of state to abbreviation states = { 'Oregon': 'OR', 'Florida': 'FL', 'California': 'CA', 'New York': 'NY', 'Michigan': 'MI' } # create a basic set of states and some cities in t...
false
e8b2fd46e39711a75e83f590a86ffa5433116a1e
Cathryne/Python
/ex38sd6c.py
2,251
4.6875
5
# Exercise 38: Doing Things To Lists # http://learnpythonthehardway.org/book/ex38.html # Study Drill 6: other examples of lists and what do do with them # comparing word lists # quote examples for testing # Hamlet = "To be, or not to be, that is the question." # https://en.wikipedia.org/wiki/To_be,_or_not_to_be#Text #...
true
88e7900015a7c199e6e605beb15189e211af78d0
Cathryne/Python
/ex03.py
1,550
4.21875
4
# Exercise 3: Numbers and Math # http://learnpythonthehardway.org/book/ex3.html # general advice: leave space around all numbers & operators in mathematical operations, to distinguish from other code & esp. negative numbers print "I will now count my chickens:" print "Hens", 25 + 30 / 6 # , comma forces calculation r...
true
71d9d2c25a82558c813523cd9c7a935ffcbf5d78
Cathryne/Python
/ex19sd3.py
1,477
4.21875
4
# Exercise 19: Functions and Variables # http://learnpythonthehardway.org/book/ex19.html # Study Drill 3: Write at least one more function of your own design, and run it 10 different ways. def milkshake(milk_to_blend, fruit_to_blend, suggar_to_blend): """ Calculates serving size and prints out ingredient amounts fo...
true
42f65b2819021a0201c2ce3ee82ba39318beb466
RahulSundar/DL-From-Scratch
/MLP.py
1,821
4.1875
4
import numpy as np #import matplotlib.pyplot as plt '''This is a code to implement a MLP using just numpy to model XOR logic gate.Through this code, one can hope to completely unbox how a MLP model is setup.''' # Model Parameters '''This should consist of the no. of input, output, hidden layer units. Also, no.of inp...
true
c2b21f2737be09db89a51add64f1d86907b28c00
arsenijevicn/Python_HeadFirst
/chapter4/vsearch.py
243
4.15625
4
def search4vowels(): """Displays any vowels found in asked-for word""" vowels = set('aeiou') word = input("Upisite rec: ") found = vowels.intersection(set(word)) for vowels in found: print(vowels) search4vowels()
true
dac2f833ec8dda8eb23dcb88d4fed74f3b1848b8
wolflion/Code2019
/Python编程:从入门到实践/chap09类/chap09section02Car.py
1,138
4.3125
4
#9.2 使用类和实例 class Car(): def _init_(self, make, model, year): self.make = make self.model = model self.year = year self.odometer_reading = 0 #类中的属性要有初始值,除了形参传递,也可以直接赋值 def get_descriptive_name(self): long_name = str(self.year) + ' ' + self.make + ' ' + self.model return long_name.title() ...
false
a55318bd90912a236a47efdf4d5dfcecc24ea371
xiepf1101/python_study
/workspaceDemo/parentChild.py
903
4.21875
4
#coding=utf-8 #类的继承 class Parent: parentAttr = 100 def __init__(self): print("i am parent") def parentMethod(self): print("parent method") def myMethod(self): print("parentMethod") def setAttr(self,attr): Parent.parentAttr = attr ...
false
4dcb541a4c110aee3f795e990b3f096f5d00014d
AyushGupta22/RandomNumGenerator
/test.py
749
4.25
4
from rand import random #Testing our random function by giving min , max limit and getting output as list and then compute percentage of higher number for reference print('Enter min limit') min = int(input()) print('Enter max limit') max = int(input()) while max <= min: print('Wrong max limit\nEnter Again:...
true
5a0f54795e5b2777ebe9b2e9fdbdb07ee7db5e33
adilarrazolo83/lesson_two_handson
/main.py
714
4.28125
4
# Part 1. Create a program that will concatenate string variables together to form your birthday. day = "12" month = "October" year = "1983" my_birthday = month + " " + day + "," + year print(my_birthday) # Part 2. Concatenate the variables first, second, third, and fourth and set this concatenation to the variabl...
true
96dd3709ac413db258d3ab38be0bd957b51c117a
ktgnair/Python
/day_2.py
602
4.3125
4
#Datatypes #String #Anything inside a "" is considered as string print("Hello"[1]) #Here we can find at position 1 which character is present in word Hello print("1234" + "5678") #Doing this "1234" + "5678" will print just the concatenation of the two strings print("Hello World") #Integer print(1234 + 5678) #For ...
true
b3b3a3063b53e18e792d25c07f74d7a4d8441905
ktgnair/Python
/day_10.py
1,362
4.34375
4
# Functions with Outputs. # In a normal function if we do the below then we will get an error as result is not defined # def new_function(): # result = 3*2 # new_function() # print(result) # But using 'return' keyword in the below code we are able to store the output of a function i.e Functions with Outputs def m...
true
addc5679ff65e1454f5168d63ba1a72d098fbbe8
ktgnair/Python
/day_8-2.py
1,059
4.28125
4
# Prime Number Checker # You need to write a function that checks whether if the number passed into it is a prime number or not. # e.g. 2 is a prime number because it's only divisible by 1 and 2. # But 4 is not a prime number because you can divide it by 1, 2 or 4 user_input = int(input("Enter the number of your choic...
true
70ef560b7cc262f805a8b18c0fa269444276b665
ktgnair/Python
/day_5-5.py
1,685
4.1875
4
# Password Generator Project import random letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] number...
true
9d2c5436378129d0f27f90a77aea9dd6249bab94
ktgnair/Python
/day_4-4.py
1,247
4.71875
5
# Treasure Map # Write a program which will mark a spot with an X. # You need to add a variable called map.This map contains a nested list. # When map is printed this is what the nested list looks like: # ['⬜️', '⬜️', '⬜️'],['⬜️', '⬜️', '⬜️'],['⬜️', '⬜️', '⬜️'] # Format the three rows into a square, like this: # ['⬜️'...
true
27e08761ba250ff3ddf19c454df05fdf0acade2d
Alexanderdude/PythonInvestments
/finance_calculators.py
2,651
4.28125
4
import math # Imports the math module print("\n" + "Choose either 'investment' or 'bond' from the menu below to proceed: " + "\n" + "\n" + "investment \t - to calculate the amount of interest you'll earn on interest" + "\n" + "bond \t \t - to calculate the amount you'll have to pay on a home loan") # D...
true
c26242104a494b3a38fb578e1d437cc6853dd2ae
Jlemien/Beginner-Python-Projects
/Guess My Number.py
893
4.4375
4
7"""Overview: The computer randomly generates a number. The user inputs a number, and the computer will tell you if you are too high, or too low. Then you will get to keep guessing until you guess the number. What you will be Using: Random, Integers, Input/Output, Print, While (Loop), If/Elif/Else""" from random impor...
true
8af705ec7631c1bfa3d9e9f10e262dc153103ead
Jlemien/Beginner-Python-Projects
/University of Michigan Python Projects/Population.py
888
4.28125
4
print("I will give you an estimate for what the US population will be in the future") year = input("what year would you like a prediction for? ") years_into_the_future = float(year) - 2017 print("That is about", years_into_the_future, "years in the future.") current_population = 307357870 #I estimate that in X years t...
false
ff91ad850f74a826a95f395363dd00cf867c0990
Jlemien/Beginner-Python-Projects
/University of Michigan Python Projects/Debt.py
2,390
4.3125
4
#http://www.cse.msu.edu/~cse231/PracticeOfComputingUsingPython/01_Beginnings/FirstWeekProjects/Debt/project01.pdf #current debt is 19500000000000 #ask the user for the current national debt current_national_debt = float(input("What is the current national debt of the USA? ")) #ask the user what denomination of bull ...
false
a956f3b23892c56326cddaccf4b14b75e660706b
DKojen/HackerRank-Solutions
/Python/Text_wrap.py
552
4.15625
4
#https://www.hackerrank.com/challenges/text-wrap/problem #You are given a string and width . #Your task is to wrap the string into a paragraph of width . import textwrap string = 'ABCDEFGHIJKLIMNOQRSTUVWXYZ' max_width = 4 def wrap(string, max_width): return textwrap.fill(string,max_width) if __name...
true
275a568b7ccd4adb102c768fd74f8b8e78a04515
nickborovik/stepik_python_advanced
/lesson1_3.py
1,237
4.21875
4
# functions """ def function_name(argument1, argument2): return argument1 + argument2 x = function_name(2, 8) y = function_name(x, 21) print(y) print(type(function_name)) print(id(function_name)) """ """ def list_sum(lst): result = 0 for element in lst: result += element return result def sum...
true
f85cb21075e1320782d29d9f0b0063d95df2bc23
shreyas710/Third-Year-Programs-Computer-Engineering-SPPU
/Python & R programming/prac5.py
474
4.21875
4
#Title: Create lambda function which will return true when no is even: import mypackage.demo mypackage.demo.my_fun() value=lambda no:no%2==0 no=input("Enter the no which you want to check : ") print(value(int(no))) #title:filter function to obtain or print even no or print even no num_list=[1,2,3,4,5] x=list(filter...
true
b4fc0ae52373293a9d87f80a7e7124d8f32c927c
arashafazeli/tester-py2
/main.py
1,287
4.21875
4
print('hello world from\n Dr.krillzorz') print('Now iam down here\n') hello = 'This is a string inside a variable\n' universe = 42 foo = '42' bar = 1.25 space = ' ' d = 'world' ,bar #print(hello) #print(type(hello)) #print(world) #print(type(world)) #print(foo) #print(type(foo)) #print(bar) #print(type(doob)) #p...
false
f7c25f4592050bcb9df83d514d2f8df110c5d449
w-dayrit/learn-python3-the-hard-way
/ex21.py
1,595
4.15625
4
def add(a, b): print(f"ADDING {a} + {b}") return a + b def subtract(a, b): print(f"SUBTRACTING {a} - {b}") return a - b def multiply(a, b): print(f"MULTIPLYING {a} * {b}") return a * b def divide(a, b): print(f"DIVIDING {a} / {b}") return a / b print("Let's do some math with just fu...
true
e3cd5279375fc9b78d13676b76b98b76768f38a7
umaralam/python
/method_overriding.py
426
4.53125
5
#!/usr/bin/python3 ##Extending or modifying the method defined in the base class i.e. method_overriding. In this example is the call to constructor method## class Animal: def __init__(self): print("Animal Constructor") self.age = 1 class Mammal(Animal): def __init__(self): print("Mammal Constructor") self.we...
true
019b266b1aa9f3ce7251acb5959f93f175df1d9d
umaralam/python
/getter_setter_property.py
1,555
4.3125
4
#!/usr/bin/python3 class Product: def __init__(self, price): ##No data validation in place## # self.price = price ##Letting setter to set the price so that the validation is performed on the input## # self.set_price(price) ##Since using decorator for property object our constructor will get modified as## self.p...
true
ad6fd41bd59eed17e8d504fcb6fdfa9d7da7f7c7
ArsathParves/P4E
/python assingments/rduper.py
326
4.15625
4
#fname = input("Enter file name: ") #fh = open(fname) #inp=fh.read() #ufh=inp.upper() #sfh=ufh.rstrip() #print(sfh) ## Read a file and print them the characters in CAPS and strip /n from right of the lines fname = input("Enter file name: ") fh = open(fname) for lx in fh: ly=lx.rstrip() print(ly.uppe...
true
8a9f103b3ff3222d1b2b207c30fed67fee1c1450
ArsathParves/P4E
/python assingments/ex7-2.py
872
4.25
4
# 7.2 Write a program that prompts for a file name, then opens that file and reads through the file, looking for lines of the form: # X-DSPAM-Confidence: 0.8475(eg) # Count these lines and extract the floating point values from each of the lines and compute the average of those # values and produce an output as s...
true
d7f4292809f3d59cb76f62bc9d3bce9d33e1f70e
Sngunfei/algorithms
/sword2offer/InversePairs.py
2,392
4.21875
4
""" 给定一个数组,统计其内部的逆序对个数 归并排序 两个排好序的数组,如何统计逆序数?只需要每次复制的时候,把另一个数组中的剩余个数统计一下, 那么等复制完,这个数字就是答案了。那问题来了,如何得到两个排好序的数组呢? """ def mergeSort(nums, left, right): """ 归并排序 :param nums: :param left: :param right: :return: """ if left >= right: return 0 mid = left + ((right - left) >> 1...
false
32836815b3d948376d26030dff4fe454c654b591
nortonhelton1/classcode
/classes_and_objects (1)/classes_and_objects/customer-and-address.py
1,103
4.4375
4
class Customer: def __init__(self, name): self.name = name self.addresses = [] # array to represent addresses class Address: def __init__(self, street, city, state, zip_code): self.street = street self.city = city self.state = state self.zip_code = zip_co...
true
05acb84502e7e62ea9da1088ee08c1c945652c71
dylantzx/HackerRank
/30 Days Of Code/DictionariesAndMaps.py
635
4.125
4
############################# Question ########################### # https://www.hackerrank.com/challenges/30-dictionaries-and-maps/problem ################################################################## # Enter your code here. Read input from STDIN. Print output to STDOUT count = int(input()) list_of_queries = [...
true
097588bb6e41bfb37381b95dc6955fcd349ad2c3
zemi4/Python-tasks
/Sun Angle.py
1,085
4.28125
4
''' определить угол солнца над горизонтом, зная время суток. Исходные данные: солнце встает на востоке в 6:00, что соответствует углу 0 градусов. В 12:00 солнце в зените, а значит угол = 90 градусов. В 18:00 солнце садится за горизонт и угол равен 180 градусов. В случае, если указано ночное время (раньше 6:00 или позже...
false
c1f1c50534463aea935f74526059a3760f2bbfc7
abbasjam/abbas_repo
/python/dev-ops/python/pythan-class/string14.py
212
4.15625
4
print ("String Manipulations") print ("-------------------") x=input("Enter the String:") print ("Given String is:",x) if x.endswith('.txt'): print ("Yes!!!!!!!text file") else: print ("Not textfile")
true
5864a1d2a032b9379e2ce6118c2e77598116c81a
abbasjam/abbas_repo
/python/dev-ops/python/pythan-class/string7.py
234
4.15625
4
print ("String Manipulations") print ("-------------------") x=input("Enter the String:") print ("Given String is:",x) if x.isspace(): print ("String Contains only spaces ") else: print ("one or more chars are not spaces")
true
6ffce6b6ba40bad4d70bd8dc847cfcabc9dfdcbd
chapman-cs510-2017f/cw-03-sharonjetkynan
/sequences.py
610
4.4375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def fibonacci(n): """ object: fibonacci(n) returns the first n Fibonacci numbers in a list input: n- the number used to calculate the fibonacci list return: retList- the fibonacci list """ if type(n) != int: print(n) print(":inp...
true
f671a071f6f111ea4f63e2b6aea4dd8e1844d056
KyleHu14/python-alarm-clock
/main.py
1,704
4.28125
4
import time import datetime def print_title() -> None: # Prints the title / welcome string when you open the app print('#' * 26) print('#' + '{:^24s}'.format("Alarm Clock App") + '#') print('#' * 26) print() def take_input() -> str: # Takes the input from the user and checks if the input is ...
true
97e49ed0257e6f87dd9dd55ccaa7034b2f50ca9f
foleymd/boring-stuff
/more_about_strings/advanced_str_syntax.py
1,051
4.1875
4
#escape characters #quotation print('I can\'t go to the store.') print("That is Alice's cat.") print('That isn\'t Alice\'s "cat."') print("Hello, \"cat\".") print('''Hello, you aren't a "cat."''') #tab print('Hello, \t cat.') #newline print('Hello, \n cat.') print('Hello there!\nHow are you?\nI\'m fine!') #backslas...
true
185d9ce5496bb637090cae05cb093804d2170a36
vishwaka07/phython-test
/formatting.py
227
4.375
4
name = "Krishna" age = "18" # serval ways to print the data print("hello" + name + "your age is " + age) #python v3 print("hello {} your age is {} ".format(name,age)) #python 3.6 print(f"hello {name} your age is {age}")
false
7939df2c4af30d7527ab8919d69ba5055f43f7ce
vishwaka07/phython-test
/tuples.py
1,048
4.46875
4
# tuples is also a data structure, can store any type of data # most important tuple is immutable # u cannot update data inside the tuple # no append, no remove, no pop, no insert example = ( '1','2','3') #when to use : days , month #tuples are faster than lists #methods that can be used in tuples : count,index, len f...
true
0b15fd9864c222c904eef1e7515b5dd125e05022
Randheerrrk/Algo-and-DS
/Leetcode/515.py
1,209
4.1875
4
''' Find Largest Value in Each Tree Row ------------------------------------ Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed). Input: root = [1,3,2,5,3,null,9] Output: [1,3,9] Input: root = [1,2,3] Output: [1,3] Input: root = [1] Output: [1] Input: root = [1...
true
e6eada3e5ad01097e132123a75d6c2b3a134d977
shulme801/Python101
/squares.py
451
4.21875
4
squares = [value**2 for value in range(1,11)] print(squares) # for value in range(1, 11): # # square = value ** 2 # # squares.append(square) # squares.append(value**2) # print(f"Here's the squares of the first 10 integers {squares}") odd_numbers = list(range(1,20,2)) print(f"Here's the odd numbers from 1 th...
true
0b9e29c79c892215611b5cdb3e64ee2210d6f2a3
shulme801/Python101
/UdemyPythonCertCourse/Dunder_Examples.py
1,017
4.3125
4
# https://www.geeksforgeeks.org/customize-your-python-class-with-magic-or-dunder-methods/?ref=rp # declare our own string class class String: # magic method to initiate object def __init__(self, string): self.string = string # print our string object def __repr__(self): ...
true
9bd76fe2cca59bd95d2a5237d8bf34a13ed13c60
lawtonsclass/s21-code-from-class
/csci1/lec14/initials.py
742
4.21875
4
import turtle # imports the turtle library import math turtle.shape("turtle") # make the turtle look like a turtle turtle.up() turtle.backward(150) turtle.right(90) turtle.down() # put the turtle down so that we can draw again turtle.forward(200) # draw first line of L turtle.left(90) turtle.forward(...
true
f14f7efaf33491f9758099e639e1adf4fbc55c50
lawtonsclass/s21-code-from-class
/csci1/lec19/random_squares.py
1,136
4.21875
4
import turtle import random turtle.shape('turtle') turtle.speed('fastest') colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'] i = 1 while i <= 50: # draw a square with a random side length and a random color random_index = random.randint(0, len(colors) - 1) turtle.fillcolor(colors[rand...
true
0d613768179d34123018a637a31ce1327587c5fc
lawtonsclass/s21-code-from-class
/csci1/lec30/recursion.py
961
4.1875
4
def fact(n): # base case if n == 1: return 1 else: # recursive case! x = fact(n - 1) # <-- this is the "recursive call" # the answer is n * (n-1)! return n * x print(fact(5)) def pow(n, m): if m == 0: # base case return 1 else: # recursive case return n * pow(n, m-...
true
919bc6acd1abd0d772c86c501de1aa4e9395d103
Nihadkp/MCA
/Semester-01/Python-Programming-Lab/Course-Outcome-1-(CO1)/02-Leap-Year/Leap_year.py
300
4.375
4
# purpose - to find leap years of future year from current year startYear = 2021 print("Enter any future year") endYear = int(input()) print("List of leap years:") for year in range(startYear, endYear): if (0 == year % 4) and (0 != year % 100) or (0 == year % 400): print(year)
true
1407338619c9f08438e00a72f20ee2a1796ffaa2
Nihadkp/MCA
/Semester-01/Python-Programming-Lab/Course-Outcome-1-(CO1)/20-Remove-even-numbers-form-a-list-of-integers/Removing_Even_numbers_in_LIST.py
419
4.1875
4
# purpose- removing even numbers in list numberList = [] even_numberList = [] n = int(input("Enter the number of elements ")) print("\n") for i in range(0, n): print("Enter the element ", i + 1, ":") item = int(input()) numberList.append(item) print(" List is ", numberList) even_numberList = [x for x in n...
true
31dabba934c1b70d75263ef9bf71549651baa464
Nihadkp/MCA
/Semester-01/Python-Programming-Lab/Course-Outcome-1-(CO1)/03-List-Comprehensions/List_Operations.py
1,445
4.125
4
# purpose - program to perform some list operations list1 = [] list2 = [] print("Select operation.") print("1.Check Length of two list's are Equal") print("2.Check sum of two list's are Equal") print("3.whether any value occur in both ") print("4.Display Lists") while True: choice = input("Enter any choi...
true
7c9d95660844b66ff9becf9f656ed9f16f78ed79
mengeziml/sorepy
/sorepy/sorting.py
2,472
4.625
5
def bubble_sort(items): """Return array of items, sorted in ascending order. Args: items (array): list or array-like object containing numerical values. Returns: array: sorted in ascending order. Examples: >>> bubble_sort([6,2,5,9,1,3]) [1, 2, 3, 5, 6, 9] """ n...
true
4663b089240b5f113c3c49e7918204417dff77f7
BenWarwick-Champion/CodeChallenges
/splitStrings.py
581
4.125
4
# Complete the solution so that it splits the string into pairs of two characters. # If the string contains an odd number of characters then it should replace # the missing second character of the final pair with an underscore ('_'). # Example: # solution('abc') # should return ['ab', 'c_'] # solution('abcdef'...
true
992ad23ed86e3c42cebb5d4130acaba5dca70eda
ktsmpng/CleverProgrammerProjects
/yo.py
447
4.28125
4
# print from 1 to 100 # if number is divisble by 3 -- fizz # if number is divisble by 5 -- buzz # if divisible by both -- fizzbuzz # 2 # fizz # 3 def fizzbuzz(start_num, stop_num): print('_________________') for number in range(start_num, stop_num + 1): if number % 3 == 0 and number % 5 == 0: print("fizzbuzz"...
true
661171d9cc55d2b4c5ef7bbfe5c02f9cc5760c43
Topperz/pygame
/5.first.pygame.py
2,986
4.65625
5
""" Show how to use a sprite backed by a graphic. Sample Python/Pygame Programs Simpson College Computer Science http://programarcadegames.com/ http://simpson.edu/computer-science/ Explanation video: http://youtu.be/vRB_983kUMc """ import pygame import time import math # Define some colors BLACK = (0, 0, ...
true
9bb66c9e7dbbbdcc24a02c399aa13c3676038941
Bardoctorus/General-Bumtastic-Silly
/Bumdamentals/fizzbuzz.py
362
4.28125
4
""" any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz. Numbers divisible by both become fizz buzz. """ for i in range(1, 100): if i % 3 == 0 and i % 5 == 0: print("FizzBuzz") elif i % 3 == 0: print("Fizz") elif i % 5 == 0: pri...
false
39984a91ad8bc8209dca055467c40ad7560a898e
applecool/Python-exercises
/key_value.py
594
4.125
4
# Write a function that reads the words in words.txt and stores # them as keys in a dictionary. It doesn't matter what the values # are. # # I used the python's in-built function random to generate random values # One can use uuid to generate random strings which can also be used to # pair the keys i.e., in this case...
true
18460b5647f2e3b58d59e9d57410cc81cdcf60c7
cherrymar/google_cssi
/CSSI-Files/Example_Python/Day1/lesson1.py
679
4.25
4
""" print( "Hello World" ) #I can write a comment after this pound sign print( "bye bye" ) #variables name = "Cher Ma" print( "hi there: " ) print( name ) #user input user = raw_input("What's your name? " ) print( "Hi " + user ) num1 = int( raw_input( "Enter a number: " ) ) num2 = int( raw_input( "Enter another n...
false
3cf19e42662c084e91194204929d362112f3e98c
singerdo/songers
/第一阶段/课上实例练习/day02/demo05.py
582
4.34375
4
""" 类型转换 结果 = 类型名称(待转换数据) 练习:exercise04.py """ # 字符串 --> 整数 '''str_number = "250" int_number = int(str_number) print(type(int_number)) # 注意:待转换数据必须"长得像"代转类型 # print(int("250+"))# 250+ 不像 整数,所以报错(第三门课程解决) # print(int("1.23")) # 小数 --> 整数''' print(int(8.93)) # 8 # ? --> 字符串 print(str(100.444)) # 四舍...
false
d3210816dac9893a01061a6687f17b13304c3289
subreena10/dictinoary
/existnotexistdict.py
249
4.46875
4
dict={"name":"Rajiu","marks":56} # program to print 'exist' if the entered key already exist and print 'not exist' if entered key is not already exists. user=input("Enter ur name: ") if user in dict: print("exist") else: print("not exists")
true
090de8d31c4ea6ce5b30220d8e3f7679d8328db3
adreher1/Assignment-1
/Assignment 1.py
1,418
4.125
4
''' Rose Williams rosew@binghamton.edu Section #B1 Assignment #1 Ava Dreher ''' ''' ANALYSIS RESTATEMENT: Ask a user how many people are in a room and output the total number of introductions if each person introduces themselves to every other person once OUTPUT to monitor: introductions (i...
true
29a9472bf05258a090423ef24cc0c64311a6272b
acc-cosc-1336/cosc-1336-spring-2018-Miguelh1997
/src/midterm/main_exam.py
561
4.40625
4
#write import statement for reverse string function from exam import reverse_string ''' 10 points Write a main function to .... Loop as long as user types y. Prompt user for a string (assume user will always give you good data). Pass the string to the reverse string function and display the reversed string ''' def m...
true
f16f06d76cb51cff2e10bc64d9310890e041231b
abalidoth/dsp
/python/q8_parsing.py
673
4.3125
4
# The football.csv file contains the results from the English Premier League. # The columns labeled ‘Goals’ and ‘Goals Allowed’ contain the total number of # goals scored for and against each team in that season (so Arsenal scored 79 goals # against opponents, and had 36 goals scored against them). Write a program to r...
true
645e285a751310786073fefba08294bf7850b051
40309/variables
/assignment_improvement_exercise_py.py
402
4.28125
4
#john bain #variable improvement exercise #05-09-12 import math radius = float(input("Please enter the radius of the circle: ")) circumference = int(2* math.pi * radius) circumference = round(circumference,2) area = math.pi * radius**2 area = round(area,2) print("The circumference of this circle is {...
true
73760296f75889f8eaba190a9bc38c2d03555c95
40309/variables
/Development Exercise 3.py
342
4.1875
4
#Tony K. #16/09/2014 #Development Exercise 3 height = float(input("Please enter your height in inches: ")) weight = float(input("Please enter your height in stones: ")) centimeter = height* 2.54 kilogramm = weight * (1/0.157473) print("You are {0} cenimeters tall and you weigh {1} kilogramm".format(ce...
true
5df0fb2d35b5bda4776c288f974e6327a39ea9f7
trepudox/Python
/UNIP/exerc fac/exe11.py
882
4.25
4
#Escreva um programa que leia números inteiros. O programa deve ler até que o usuário digite 0. No final da execução #exiba a quantidade de numeros digitados assim como a soma e a media aritmética x = 1 contador = 0 soma = 0 media = 0 while True: if x == 0: break x = int(input('Digite um número, caso ...
false
29cdd670a2f1da4fed0120f2522b7b5a7820a807
fredo1712/github-tricks
/helloworld.py
650
4.15625
4
##my_string = "Hello World" ##print(my_string) ## ##var1 = "Allo \"Haiti est un pays de merde\" a dit Trump" ##print(var1) ## ## ##name = 'Phanou' ##greeting = f'Hello, {name}' ## ##print(greeting) ##your_name = input("Please enter your name: ") ##print (f'Hello, {your_name}') ## ##age = int(input("Please enter your a...
false
f88400c71dc8f6a5a8298f4ad5861eda45f73a86
Goryaschenko/Python_GeekBrain_HW
/Lesson_1/Max number.py
667
4.21875
4
""" Задание 3: Пользователь вводит целое положительное число. Найдите самую большую цифру в числе. Для решения используйте цикл while и арифметические операции. """ n = input("Введите целое положительное число ") n_len = len(n) i = 1 max_n = n[0] while i < n_len: if n[i] > max_n: max_n = n[i] i += 1 p...
false
3d1233434f7736cdc299f39fb440fafa3416d5a9
Goryaschenko/Python_GeekBrain_HW
/lesson_5/5_sum_from_file.py
1,702
4.125
4
""" Создать (программно) текстовый файл, записать в него программно набор чисел, разделенных пробелами. Программа должна подсчитывать сумму чисел в файле и выводить ее на экран. """ # Вы можете вводить числа и буквы не боясь что буквы попадут в список with open("5_sum_from_file.txt", "w", encoding='utf-8') as f: ...
false
b88bc6f0378938dc46e56f26fc80331a8dc91364
Goryaschenko/Python_GeekBrain_HW
/lesson_3/2_phonebook.py
1,237
4.1875
4
""" Реализовать функцию, принимающую несколько параметров, описывающих данные пользователя: имя, фамилия, год рождения, город проживания, email, телефон. Функция должна принимать параметры как именованные аргументы. Реализовать вывод данных о пользователе одной строкой. """ def phonebook(name, surname, birthday, citi...
false
5e20c1fde5e1ebd93f22d718ac78f699f31a387c
lloydieG1/Booking-Manager-TKinter
/data.py
1,013
4.1875
4
import sqlite3 from sqlite3 import Error def CreateConnection(db_file): ''' create a database connection to a SQLite database and check for errors :param db_file: database file :return: Connection object or None ''' #Conn starts as 'None' so that if connection fails, 'None' is returned conn = ...
true
f5c41d06bb1137f0d1aac5b0f1dbedc9604cc91b
NickNganga/pyhtontake2
/task3.py
547
4.125
4
def list_ends(a_list): return (a_list[0], a_list[len(a_list)-1]) # number of elements num = int(input("Enter number of elements : ")) # Below line read inputs from user using map() function put = list(map(int,input("\nEnter the numbers : ").strip().split()))[:num] # Below Line calls the function created above. p...
true