blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
ba2ce236426a14d35f10540770106ef7e14735a2
maheboob76/ML
/Basics/Perceptron_vs_Sigmoid.py
1,077
4.25
4
# -*- coding: utf-8 -*- """ http://neuralnetworksanddeeplearning.com/chap1.html#exercise_263792 Small example to show difference between a perceptron and sigmoid neuron For a Machine Learning model to learn we need a mechanism to adjust output of model by small adjustments in input. This example shows why a percpt...
true
0feaf36241b524d9dc47f5b980aa9219471e2a55
dilsonm/CeV
/mundo1/ex035.py
545
4.21875
4
""" Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um triangulo. """ verde = '\033[0;32m' vermelho = '\033[0;31m' r1 = int(input('Digite o comprimento da PRIMEIRA reta ')) r2 = int(input('Digite o comprimento da SEGUNDA reta ')) r3 = int(input('Digite o comprim...
false
d45712e72812d145f416d7a56fcddc2b32333a0f
iguess1220/py
/0912/tuple2.py
725
4.34375
4
#赋值的右侧为多个数据,有自动组包为元组 """ a = 10,20,'heh' print(type(a)) print(a) """ """ a = 10 b = 20 # 交换变量1 临时变量 temp = a a = b b = temp print(a,b) # 交换变量2 计算公式 a = a + b b = a - b a = a - b print(a,b) # 交换变量3 ,元组特性 b,a=a,b # 右侧多个数据会自动组包为元组,当左侧被赋值数量和右侧对等时,进行赋值 print(a,b) """ """ a = 10 b = 20 c = 30 c,b,a = a,c,b print(a,b,c)...
false
9ae1347de0841b79e77cf9efc8fa204eea5e0c09
iguess1220/py
/0918/eval.py
515
4.25
4
# 列表转换成字符串后再转列表出现的问题 # str1 = "[1,2,3,4]" # list1 = list(str1) # 出现的并不时我们要的结果,列表会把字符串所有元素都拆解 # print(list1) # 使用函数eval可解决 # list2 = eval(str1) # print(list2) # 也可以转换字典,整数,浮点数等 # str2 = "{'a':'2','c':'7'}" # print(eval(str2)) # eval 不要在工作中使用,可自动识别函数并执行,很危险 a = eval(input("please input: ")) print(a) #print(__import__(...
false
c0556765191e7d7e49ad7f34b79770933d9e98c0
iguess1220/py
/0918/lambda.py
368
4.15625
4
# 匿名函数 # a = lambda x,y: x+y # print(a(1,2)) # #定义匿名函数并直接调用 # result =(lambda x,y: x*y)(1,2) # print(result) # 传入可变参数, 返回列表生成式,直接调用取值 result = (lambda *x: [i*i for i in x ])(1,2,3,4) print(result) # 解包赋值 a,b,c = (lambda *x: [i*i for i in x ])(2,4,6) print(a) print(b) print(c)
false
c55b3aedeabb43ac12481bb7a5b2ba7d1bacd0b7
iguess1220/py
/0913/qiepian.py
316
4.1875
4
str1 = 'hello,world' # 切片格式 字符串[开始索引:结束索引] 范围: [) print(str1[-1:]) print(str1[:5]) #果如从第一个开始,即0,可以省略,不写零,直接: print(str1[6:]) # 如果截取到最后,可省略最后的数字 print(str1[-5:]) # 可倒数,从倒数第六个到结尾
false
4fe62261defaeed3b3dcc21aff9d1bebdca21225
MarcusDMelv/Summary-Chatbot
/voice.py
1,395
4.125
4
# Code based on https://www.geeksforgeeks.org/text-to-speech-changing-voice-in-python/ # Python program to show # how to convert text to speech import pyttsx3 # Initialize the converter converter = pyttsx3.init() # Set properties before adding # Things to say # Sets speed percent # Can be more than 100 converter.se...
true
4f3f602373b166d9a2a9af94c5a33befa671208c
grantthomas/project_euler
/python/p_0002.py
955
4.1875
4
# Even Fibonacci numbers # Problem 2 # Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find...
true
64b527ed4f5a3a18da10ee421e7b88b06e90bed7
kkbaweja/CS303
/Hailstone.py
2,487
4.4375
4
# File: Hailstone.py # Description: A program that computes the hailstone sequence for every number in a user defined range # Student Name: Keerat Baweja # Student UT EID: kkb792 # Course Name: CS 303E # Unique Number: 50860 # Date Created: 2/7/2016 # Date Last Modified: 2/9/2016 def ma...
true
81603ced0143981ee6540c89ee829ff663547c2f
v-erse/pythonreference
/Science Libraries/Numpy/arraymath.py
1,033
4.34375
4
import numpy as np print("Array Math:") # Basic mathematical functions operate on ndarrays in an elementwise fashion a = np.arange(10).reshape(2, 5) b = np.arange(10).reshape(2, 5) print(a + b) print(a*b) # We can use the dot function to find dot products of vectors and multiply # matrices (the matrixmultiplication.j...
true
afe6d64552f6328412a7129f7a2fad6eadc8c554
andres-zibula/geekforgeeks-problems-solved
/basic/twisted_prime_number.py
554
4.15625
4
""" Author: Andres Zibula Github: https://github.com/andres-zibula/geekforgeeks-problems-solved Problem link: http://practice.geeksforgeeks.org/problems/twisted-prime-number/0 Description: A number is said to be twisted prime if it is a prime number and reverse of the number is also a prime number. """ import math ...
true
ca26154644fcfa864afdd7063d0c435040183a0d
ErycPerovani/Jogo_de_adivinhacao.py
/forca.py
966
4.125
4
def jogar(): print("************************************") print("**** Bem vindo ao jogo da forca ****") print("************************************") palavra_secreta = "Bacana" letras_acertadas = ["_", "_", "_", "_", "_" ,"_"] letras_faltando = str(letras_acertadas.count("_")) enforcou ...
false
8f9692a0be3836b363adc733511e4addbfc12292
coder2000-kmj/Python-Programs
/numprime.py
595
4.34375
4
''' This is a program to print prime numbers starting from a number which will be given by the user and the number of prime numbers to be printed will also be specified by the user ''' def isprime(n,i=2): if n<=2: return True if n==2 else False if n%i==0: return False if i*i>n: ...
true
d8dd66792916b405fc40b6dbc17b2c8fbb0e5a9e
DipankerBaral/Tkinter-project
/circle.py
1,263
4.3125
4
#mid point circle drawing algorithm # -*- coding: utf-8 -*- from tkinter import * def sympoints(x,y): w.create_text(x + x_centre, y + y_centre,text='.') w.create_text(y + x_centre, x + y_centre,text='.') w.create_text(x + x_centre, -y + y_centre,text='.') w.create_text(y + x_centre, -x + y_centre,text='.') w.cre...
false
ecc4d29375e3c6200c6ac3b8f9f3b4f4c0769ca7
alphashooter/python-examples
/homeworks-2/homework-2/task2.py
574
4.125
4
import calendar from datetime import datetime target: int while True: day_name = input(f'Enter day name ({calendar.day_name[0]}, etc.): ') for day, name in enumerate(calendar.day_name): if name == day_name: target = day break else: print('invalid input') con...
true
eca16d3794404a3659a448df344b120d26e9fe2e
mey1k/PythonPratice
/PythonPriatice/InsertionSort.py
252
4.15625
4
def insertionSort(x): for size in range(1, len(x)): val = x[size] i = size while i > 0 and x[i-1] > val: x[i] = x[i-1] i -= 1 x[i] = val print(x) insertionSort([3,23,14,123,124,123,12,3])
true
bd40b86f7639ce864d19963092c1535a68118866
kulvirvirk/list_methods
/main.py
1,619
4.6875
5
# The list is a collection that is ordered and changeable. Allows duplicate members. # List can contain other lists # 1. create a list of fruits # 2. using append(), add fruit to the list # 3. use insert(), to insert another fruit in the list # 4. use extend() method to add elements to the list # 5. use pop() method ...
true
a232c1dbe330abefd09cb6c54916776cfae04c2b
darkscaryforest/example
/python/classes.py
1,316
4.21875
4
#!/usr/bin/python class TestClass: varList = [] varEx1 = 12 def __init__(self): print "Special init function called." self.varEx2 = 13 self.varEx3 = 14 def funcEx(self): print self.varEx2 return "hello world" x = TestClass() print "1. Classes, like functions, must be declared before use.\n" \ "Calling...
true
0d3ea4123385980f8b24ecc5b59397e5e813372d
SnakeTweaker/PyStuff
/module 6 grocery list.py
1,490
4.125
4
''' Author: CJ Busca Class: IT-140 Instructor: Lisa Fulton Project: Grocery List Final Date: 20284 ''' #Creation of empty data sctructures grocery_item = {} grocery_history = [] #Loop function for the while loop stop = 'go' while stop !='q': #This block asks the user to input name, quantity, ...
true
0c4f077fa6e50d24ad81f1e7de30b08e60ac34f6
radishmouse/2019-11-function-demo
/adding-quiz.py
437
4.3125
4
def add(a, b): return a + b # print(a + b) # if you don't have a `return` # your function automatically # returns `None` # Write a function that can be called like so: add(1, 1) # I expect the result to be 2 num1 = int(input("first number: ")) num2 = int(input("second number: ")) num3 = int(input(...
true
21e783fc5101c5cc328ec3fb5ea750e4f3773f72
Sushmitha2708/Python
/Data Modules/JSONModulesFromFiles.py
926
4.21875
4
#this progam deals with how to load JSON files into python objects and then write those # objects back to JSON files import json # to load a JSON file into a python object we use JSON 'load' method #load method--> loads a file into python object #loads method --> loads a string into a python object # to l...
true
b6d0f2e9b62f82970b371114f8734acc87026c0a
Sushmitha2708/Python
/Loops and Conditionals/ForLoop.py
236
4.125
4
#SET COMPREHENSIONS # set is similar to list but with unique values nums=[1,1,1,2,3,5,5,5,4,6,7,7,8,9,9] #list my_set=set() for n in nums: my_set.add(n) print(my_set) #comprehension my_set={n for n in nums} print(my_set)
true
b8a25af14fa7bbc39227418c6aa6a8f57edc3200
LLjiahai/python-django-web
/pdjango_web/python_note/基础/python3-5/regex_study.py
1,005
4.34375
4
import re ''' python的正则表达式可以通过re模块来访问,这是在查找函数中使用非常频繁的一个组件。re.search返回一个匹配对象 随后可以用这个对象的group或者groups方法获取匹配的模式 python re模块的match(),search() re模块的match()匹配是从字符串的开始位置匹配,只有从0位置匹配成功才有返回,否则返回none search()匹配字符串中有无符合模式要求的子串 例如: re.match('world','hello world'),会返回none re.search(‘world’,‘hello world’).span()返回(6,10) group和gro...
false
7da4fa2f89f95532f15bf6e442d8d83af17f3bb4
XanderEagle/unit6
/unit6.py
1,349
4.3125
4
# by Xander Eagle # November 6, 2019 # this program displays the Birthday Paradox showing the percent of people that have the sme birthday based on the # amount of simulations import random def are_duplicates(nums): """finds the duplicates :return: true if there is a duplicate false if no duplica...
true
2865d43f5210b945eadc07481a14436f34b3ad23
Mike7P/python-projects
/Guessing_game/guessing_game.py
1,147
4.125
4
print("Welcome to Kelly's Number Guessing Game!") print("I'm thinking of a number between 1 and 100.") attempts = 0 difficulty_choosing = False random_num = randint(1, 100) # print(f"Pssst, the correct answer is {random_num}") def guessing_func(guess, random_num): global attempts attempts -= 1 if guess == rando...
true
d7dd96224064d98e702d82a4b781989d265e0fcb
nathanhwyoung/code_wars_python
/find_the_parity_outlier.py
910
4.4375
4
# https://www.codewars.com/kata/5526fc09a1bbd946250002dc # You are given an array (which will have a length of at least 3, but could be very large) containing integers. # The array is either entirely comprised of odd integers or entirely comprised of even integers except for a # single integer N. Write a method that ...
true
78f52eed0d2426d52462b9467f6224ead214b4fb
pavankumarNama/PythonLearnig
/Ex_Files_Python_Standard_Library_EssT/Exercise Files/Chapter 5/05_01/datetime_start.py
810
4.34375
4
# Basics of dates and times from datetime import date, time, datetime # TODO: create a new date object tdate = date.today() print(tdate) # TODO: create a new time object t = time(15, 20, 20) print(t) # TODO: create a new datetime object dt = datetime.now() dt1 = datetime.today() print(dt) print(dt1) # TODO: access...
true
da07296f30030b450f9b1a3d754c4e777138a946
cannibalcheeseburger/PyShitCodes
/LEETSPEAK/AdvancedLeet.py
579
4.125
4
dic = {"a":"4","b":"|3","c":"(","d":"|)","e":"3","f":"|=", "g":"9","h":"|-|","i":"!","j":"_|","k":"|<","l":"|_", "m":"/\\/\\","n":"|\\|","o":"0","p":"|D","q":"q", "r":"|2","s":"5","t":"7","u":"(_)","v":"\\/","w":"\\/\\/","x":"><", "y":"`/","z":"2"} inpoot = input("Enter String to conver...
false
6c506a5b929738c7bfe76797f93923041020f061
okeonwuka/PycharmProjects
/ProblemSolvingWithAlgorithmsAndDataStructures/Chapter_1_Introduction/pg29_selfcheck_practice.py
2,996
4.15625
4
import random # create alphabet characters including 'space' character alphabet_list = ['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', ' '] # create empty list to house character matches from target s...
true
8c40de2b5d9cfbb59af3428537caac07ed102c99
okeonwuka/PycharmProjects
/Horizons/pythonPracticeNumpyArrays.py
1,687
4.40625
4
# The numpy module gives users access to numpy arrays and several computation tools. # Numpy arrays are list-like objects intended for computational use. from pprint import pprint import numpy as np my_array = np.array([1, 2, 3]) pprint(my_array) # Operations on a numpy array are made element by element (unlike fo...
true
fa7839e158a42655a6bbdab05620c5fa0d1e7aa7
wp-lai/xpython
/code/kthlargest.py
922
4.21875
4
""" Task: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. >>> find_kth_largest([3, 2, 1, 5, 6, 4], 2) 5 """ from random import randint def find_kth_largest(nums, k): # find a random pivot length = len(nums) ...
true
7d17cbaddef7f2dad0a85adad69a2d838c7f2936
wp-lai/xpython
/code/int2binary.py
1,431
4.1875
4
""" Task: Converting decimal numbers to binary numbers >>> convert_to_binary(25) '0b11001' >>> convert_to_binary(233) '0b11101001' >>> convert_to_binary(42) '0b101010' >>> convert_to_binary(0) '0b0' >>> convert_to_binary(1) '0b1' """ # Solution 1: # keep dividing by 2, store the remainder in a stack # read in re...
true
c65b02fc056b996dacd941e299fe558d47785d6d
erinnlebaron3/python
/partitionstr.py
2,573
4.78125
5
# partition function works in Python is it's going to look inside the string for whatever you pass in as the argument. # once it finds that it then partitions the entire string and separates it into three elements and so it is going to take python and it is going to be the first element. # whenever you call partiti...
true
dd552daf2cf44e1a08733c54e31204750afc4f43
erinnlebaron3/python
/List.py
2,563
4.875
5
# like an array. It is a collection of values and that collection can be added to. You can remove items. You can query elements inside of it. # Every time that you want a new database query what it's going to do is it's going to look at its set of data structures and it's going to go and it's going to put them in that....
true
9673ae62285d1caf5117a936bb1e05b7699a76a6
erinnlebaron3/python
/PackageProject.py
2,385
4.4375
4
# will help you on the entire course capstone project # Technically you have learned everything that you need to know in order to build out this project. # helps to be familiar with some of the libraries that can make your life a little bit easier and # make your code more straightforward to implement # web scrape...
true
077bbfec6567508594cadabda71238de6829b41c
erinnlebaron3/python
/NegativeIndexStr.py
777
4.15625
4
# In review the first value here is zero. The next one is one and it counts all the way up in successive values. # However if you want to get to the very back and you actually want to work backwards then we can work with negative index sentence = 'The quick brown fox jumped over the lazy dog' print(sentence[-1]) a...
true
ad51a4b6182415c29a404f0457b9d168f2ced94d
erinnlebaron3/python
/decimalVSfloat.py
2,791
4.46875
4
# in python all decimals are floating numbers unless decimal is called # you can create a decimal is to copy decimal it has to be all like this with it titled with the capital D and decimal spelled out and then because it's a # function we're going to call decimal. # when it comes to anything that is finance related o...
true
f3566a6b295b511718e3fac82156d6bad58b52a0
erinnlebaron3/python
/FuncConfigFallBck.py
1,356
4.40625
4
# syntax for doing is by performing something like this where I say teams and then put in the name of the key and then that is going to perform the query. # want to have a featured team so I can say featured team store this in a variable. teams = { "astros": ["Altuve", "Correa", "Bregman"], "angels": ["Trout", "...
true
023d47ee8dced82d994b1660c359715d72761482
erinnlebaron3/python
/lenNegIndex.py
1,462
4.46875
4
# LENGTH # the length function and it's actually called the L E N which is short for length # this is going to give you the count for the full number of elements in a list # there is a difference between length and index # LENGTH # remember the counter starts and the index starts at 0. # even though we have four el...
true
6a88efb4a656dfda208f49f561d287175734e755
erinnlebaron3/python
/FilesinPy.py/Create&WriteFile.py
1,659
4.625
5
# very common use case for working with the files system is to log values # gonna see how we can create a file, and then add it to it. # create a variable here where I'm going to open up a file. # I'm going to show you here in the console that if I type ls, you can see we do not have a file called logger. # functi...
true
0ae57c234dc5a9daa688426e8c4953980f510f65
erinnlebaron3/python
/Slice2StoreSlice.py
2,968
4.78125
5
# here are times where you may not know or you may not want to hard code in this slice range. # And so in cases like that Python actually has a special class called slice which we can call and store whatever these ranges we want # biggest reasons why you'd ever use this slice class over using just this explicit versi...
true
3c34b20a2bfb075095cd8395e86b312cb3b418e0
pravallikachowdary/pravallika
/pg23.py
465
4.1875
4
# in arr[] of size n # python function to find minimum # in arr[] of size n def smallest(arr,n): # Initialize minimum element min = arr[0] # Traverse array elements from second # and compare every element with # current min for i in range(1, n): if arr[i] > min: min =...
false
987adf3d6c77ee903e0cf74b398c8cfdcb2d54f3
jibinsamreji/Python
/MIni_Projects/carGameBody.py
964
4.15625
4
print("Welcome player! Type 'help' for more options..!") user_input = input(">") i = 0 start = False stop = False while user_input.upper() == "HELP": if i < 1: print(""" start - to start the car stop - to stop the car quit - to exit""") i += 1 game_option = input(">").upper()...
true
3d8b2938eed4cd2d299218d4dd787d80518e8154
victorsibanda/python-basics
/102_python_data_types.py
1,696
4.59375
5
#Strings #Text and Characters #Syntax #"" and '' #Define a string #Anything that is text is a string my_string = 'Hey I am a cool string B)' print(my_string) type(my_string) #Concatenation joint_string = 'Hey I am another' + ' cool string, ' + my_string print (joint_string) #example two of concatenation name = 'M...
true
faa0ffceb30031674446ed24efdb4e6085fa9873
victorsibanda/python-basics
/101_python_variables_print_type.py
531
4.1875
4
# Variables # it is like a box, you give it a name, and put stuff inside book = 'Rich dad poor dad' ## Print function #Outputs content to the terminal (makes it visible) print(book) # Type function #Allows us to check data types data_type_of_book = type(book) print (data_type_of_book) #input() - prompt for user...
true
d6320818cdbf2b26bcffb410c1cad8e27ef9477f
devionb/MIM_Software_code_sample
/Part_A.py
642
4.375
4
# Devion Buchynsky # Part A - Reverse the string if its length is a multiple of 4. # multiples of 4: 4,8,12,16...... multiple_of_4_string_letter = 'abcd' multiple_of_5_string_letter = 'abcde' print('Before function is ran.') print(multiple_of_4_string_letter) print(multiple_of_5_string_letter) def reverse_string(s...
true
064a088d379dc1010eaa365e9857615bcd8f4d56
diallog/PY4E
/assignment5.2/assignment5.2_noIntTest.py
1,133
4.1875
4
# Assignment 5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the ...
true
4b0ec224525c1b9e584710cbe2456aa7c2f9000d
diallog/PY4E
/assignment2.3/assignment2.3.py
606
4.21875
4
# This assignment will obtain two pieces of data from the user and perform a calculation. # This script begins with a hint from the course...but lets do a little over-achievement. print("Alright, let's do our first calculation in Python using information obtained from the user.\r") # This first line is provided for ...
true
7c023a7743c6f76a6f4c5b2bd46535ccae3d2efe
priyanshu3666/my-lab-practice-codes
/if_else_1.py
237
4.21875
4
#Program started num = int(input("Enter a number")) #input taking from user if (num%2) == 0 : #logic start print("The inputted muber",num," is Even") else : print("The inputted muber",num," is Odd") #logic ends #Program Ends
true
1f3007154c8734dce197638aae123261f4fd3eca
iamdoublewei/Leetcode
/Python3/125. Valid Palindrome.py
983
4.28125
4
''' Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" Output: true Example 2: Input: "race a car" Output: false ''' #Orig...
true
336f4764f1208ed1e8cea45946a6e097187ec098
iamdoublewei/Leetcode
/Python3/1507. Reformat Date.py
1,545
4.375
4
''' Given a date string in the form Day Month Year, where: Day is in the set {"1st", "2nd", "3rd", "4th", ..., "30th", "31st"}. Month is in the set {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}. Year is in the range [1900, 2100]. Convert the date string to the format YYYY-MM-DD, ...
true
38e0976de0b8376345610a411550df8ca5639293
iamdoublewei/Leetcode
/Python3/680. Valid Palindrome II.py
1,005
4.15625
4
''' Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Example 2: Input: "abca" Output: True Explanation: You could delete the character 'c'. Note: The string will only contain lowercase characters a-z. The maximum length o...
true
84a99ce38f0a9fa7e7456be2ec28f70c54b8d41d
iamdoublewei/Leetcode
/Python3/849. Maximize Distance to Closest Person.py
1,464
4.25
4
''' In a row of seats, 1 represents a person sitting in that seat, and 0 represents that the seat is empty. There is at least one empty seat, and at least one person sitting. Alex wants to sit in the seat such that the distance between him and the closest person to him is maximized. Return that maximum distance to...
true
98ceacd32d0924643b4f6caa745e67c3f754951e
iamdoublewei/Leetcode
/Python3/417. Pacific Atlantic Water Flow.py
2,184
4.40625
4
''' There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges. The island is partitioned into a grid of square cells. You are given an m x n integer matrix he...
true
06603409c216e418a50c655532a82a17429f040c
iamdoublewei/Leetcode
/Python3/2000. Reverse Prefix of Word.py
1,366
4.40625
4
''' Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist in word, do nothing. For example, if word = "abcdefd" and ch = "d", then you should reverse the segment that start...
true
e3b81970fb6473a49d9a480991999a110605927d
kirakrishnan/krishnan_aravind_coding_challenge
/TLS/turtle_simulator.py
2,218
4.125
4
import turtle import time def setup_simulator_window(): """ set up a window with default settings to draw Traffic Lights :param: :return t: turtle object """ t = turtle.Turtle() t.speed(0) t.hideturtle() screen = turtle.Screen() screen.screensize() screen.setup(width = 1.0,...
true
91c081afcb0ca54068bd1a38049c3da5ddd73c6a
evantarrell/AdventOfCode
/2020/Day 2/day2.py
1,622
4.21875
4
# Advent of Code 2020 - Day 2: Password Philosophy # Part 1, read input file with each line containing the password policy and password. Find how many passwords are valid based on their policies # Ex: 1-3 a: abcde is valid as there is 1 a in abcde # but 3-7 l: ablleiso is not valid as there are only 2 l's in ablleiso ...
true
2ed81826bd5979dfb2b87405901f552b614f00f6
zanixus/py-hw-mcc
/professor_analysis_KM.py
1,194
4.125
4
#!/usr/bin/python3 """ Kevin M. Mallgrave Professor Janet Brown-Sederberg CTIM-285 W01 16 Feb 2019 Grade analysis script that handles tuple input. """ def mean(number_list): number_sum = 0 for i in number_list: number_sum = i + number_sum number_mean = number_sum / len(number_li...
false
684f9a65b6c72684f2355958751ae8d4b1de97a5
kaushikram29/python1
/character.py
220
4.21875
4
X=input("Enter your character") if((X>="a" and X<="z) or (X>="A" and X<="Z")): print(X, "it is an alphabet") elif ((X>=0 and Z<=9)): print(X ,"it is a number or digit") else: print(X,"it is not alphabet or digit")
true
c17a66237825077916c7c9b03add598dc9017e55
urbanskii/UdemyPythonCourse
/secao05/se05E27.py
690
4.25
4
""" 27 - Escreva um programa que, dada a idade de um nadador, classifique-o em uma das seguintes categorias: Categoria Idade Infantil A 5 a 7 Infantil B 8 a 10 Juvenil A 11 a 13 Juvenil B 14 a 17 Sênior maiores de 18 anos """ def main(): idade = int(input('Informe a idade: ')) if 5 <= idade <= 7: ...
false
e09f4233d7f2b2cff76cde0daee108b1b631613c
urbanskii/UdemyPythonCourse
/secao04/se04E46.py
411
4.375
4
""" 46 - Faça um programa que leia um número inteiro positivo de três dígitos (de 100 a 999). Gere outro número formado pelos dígitos invertidos do número lido, Exemplo: Númerolido = 123 NúmeroGerado = 321. """ def main(): numero = input('Digite o numero de 3 digitos: ') print(f'Númerolido: {numero}') ...
false
02f0bf58d7c57dac995888980e0dc1aeeb03be48
urbanskii/UdemyPythonCourse
/secao04/se04E06.py
519
4.125
4
""" 6 - Leia uma temperatura em graus Celsius e apresente-a convertida em graus Fahrenheit. A fórmula de conversão é: F = C*(9.0/5.0)+32.0, sendo F a temperatura em Fahrenheit e C a temperatura em Fahrenheit. """ def main(): temperatura_celsius_input = float(input('Digite a temperatura em Celsius: ')) ...
false
9035b3faa2a4970955d628c1d91584c1a3033b9e
urbanskii/UdemyPythonCourse
/secao04/se04E14.py
412
4.125
4
""" 14 - Leia um ângulo em graus e apresente-o convertido em radianos. A fórmula de conversão é: R = G* π (Pi)/180, sendo G o Ângulo em graus e R em radianos e π (Pi) = 3.14. """ def main(): angulo = float(input('Digite um ângulo em graus: ')) radiano = angulo * 3.14/180 print(f'Resultado do ângulo em ...
false
6701c714d5dfef2b71e9dc7f39a6c906fb73b849
urbanskii/UdemyPythonCourse
/secao04/pep8.py
1,731
4.125
4
""" PEP8 - Python Enhancement Proposal São propostas de melhorias para a linguagem Python The Zen of Python import this A ideia da PEP8 é que possamos escrever códigos Pỳthon de forma Pythônica. [1] - Utiliza Camel Case para nomes de Classes; class Calculadora: pass class CalculadoraCientifica: pass [2]...
false
0cb2ccd07dd0dbe94c7e1c3722d13817762e52a0
mattquint111/Learning-Python
/day3-assignment1.py
512
4.1875
4
# Assignment 1 - Factorial #number = int(input("Enter a non-negative number: ")) # def factorial(): # soln = 1 # for i in range(1, number+1): # soln *= i # return soln #print(factorial()) # Recursive factorial function def factorial2(n): # default solution for n == 0 (n! == 1) ...
false
14a4ed8730578aa3a1fcf7bf32b3096835ac221c
Clearymac/Integer-division-and-list
/task 2.py
864
4.28125
4
#LIST RETARRD list = ['Evi', 'Madeleine', 'Cool guy', 'Kelsey', 'Cayden', 'Hayley', 'Darian'] #sorts and prints the list list.sort() print('Sorted list:', list) #asks the user to input their name name = input("What is your name? ") name = name.title() #checks if name is in list and gives option to add to list if na...
true
a421d26ec9850e4430424be0c72e9109af4fb090
yfeng75/learntocode
/python/challenge_dict.py
1,043
4.125
4
locations={0: "You are sitting in front of a computer learning python", 1: "You are stadning at the endo f a road before a small brick building", 2: "You are at the top of a hill", 3: "You are inside a building, a well house for a small stream", 4: "You are in a valley b...
false
a752737c13ff711f56f779e51d8457a6a105d69b
vasyanch/edu
/Vasiliev_book/mult_matrix.py
1,917
4.46875
4
''' В данном коде реализованы три функции: rand_matrix(n,m) - инициализирует и возвращает матрицу n на m, представленную в виде вложенных списков. unit_matrix(n) - возвр. единичную матрицу размера n. mult_matrix(A1, A2) - возвр. произведение матриц A1 и A2. sho...
false
451af1ea328f3331078e6271fb0a7dcb24e8c2fd
mentalclear/autobots-fastapi-class
/typing_playground/funcs/random_stuff.py
485
4.1875
4
def greeting(name: str) -> str: """ This function expects to have argument name of type string""" return 'Hello ' + name print(greeting('Tester')) # A type alias is defined by assigning the type to the alias. In this example, # Vector and list[float] will be treated as interchangeable synonyms Vector = lis...
true
609b61bab4602df7434e12d207ae1ff5862534cb
ChristyLeung/Python_Green
/Green/5.3.1-2 voting.py
487
4.1875
4
# 5.3 # 5.3.1 if conditional_test: do something age = 19 if age >= 18: print("You are old enough to vote!") age = 19 if age >= 18: print("You are old enough to vote!") print("Have you registered to vote yet?") # 5.3.2 age = 17 if age >= 18: print("You are old enough to vote!"...
true
1f8acbbc0af62fdf18d8408eade076fce2d59931
KShaz/Machine-Learning-Basics
/python code/ANN 3-1 Supervised Simoid training.py
1,725
4.125
4
# https://iamtrask.github.io/2015/07/12/basic-python-network/ #X Input dataset matrix where each row is a training example #y Output dataset matrix where each row is a training example #l0 First Layer of the Network, specified by the input data #l1 Second Layer of the Network, otherwise known as the hidden layer #S...
true
4efffd09c623ecf7c64ef4c4e1bac18dc2ec8af5
harris44/PythonMaterial
/02_Advanced/algorithms_and_data_structures/01_Guessing_Game_with_Stupid_search.py
1,272
4.25
4
#!/usr/bin/python # -*- coding: utf-8 -*- from random import randrange """ Purpose: Stupid Search. In a list of numbers, user guesses a number. if it is correct, all is good. Else, next time, he/she will guess among the unguessed numbers. """ __author__ = "Udhay Prakash Pethakamsetty" list_of_numbers = range(10,...
true
741186406a63a689c06999e232429c1cd2a6eaf5
yavar29/python_programs
/declaring_and_printing_inbuilt_data_structures.py
664
4.125
4
# first method of declaring a list l=[] l.append("saim") l.append("yavar") l.append("sidra") l.append(101) l.append(101.99) l.append("adil") print(l) # second method of directly declaring a list l1=['saim', 'yavar', 'sidra1', 1013, 101.99, 'adil1'] print(l1) print(l1[0]+' '+str(l1[3])) print(type(l1)) # declaring a t...
false
854b44a67d155c0c901d010a3e7ed5fc3735761a
liboyue/BOOM
/examples/BioASQ/extra_modules/bioasq/Tiler.py
671
4.3125
4
import abc from abc import abstractmethod ''' @Author: Khyathi Raghavi Chandu @Date: October 17 2017 This code contains the abstract class for Tiler. ''' ''' This is an Abstract class that serves as a template for implementations for tiling sentences. Currently there is only one technique implemented which is simpl...
true
9c86c21e8546fd8bde9a8b41187fd54e6c25b538
BumShubham/assignments-AcadView
/assignment8.py
1,591
4.46875
4
#Q1 #What is time tuple ''' Many of Python's time functions handle time as a tuple of 9 numbers, as shown below − Index Field Domain of Values 0 Year (4 digits) Ex.- 1995 1 Month 1 to 12 2 Day 1 to 31 3 Hour 0 to 23 4 Minute 0 to 59 5 Second 0 to 61 (60/61 are leap seconds) 6 Day of Week 0 to 6 (Monday to Sunday) 7 Day...
true
8dfe63e954810cead138b81ef4c5fdf813cf224e
ShahrukhSharif/Applied_AI_Course
/Fundamental of Programming/python Intro/Prime_Number_Prg.py
364
4.125
4
# Wap to find Prime Number ''' num = 10 10/2,3,4,5 ---> Number is not pN OW PN ''' num = int(input("Input the Number")) is_devisible = False for i in range(2,num): if(num%i==0): is_devisible = True break if is_devisible is True: print("Number is Not Prime {}".format(num)) else: pri...
true
612ace04b4af232ecc5408a2c92f06620e75a17b
kitsuyui/dict_zip
/dict_zip/__init__.py
2,086
4.375
4
"""dict_zip This module provides a function that concatenates dictionaries. Like the zip function for lists, it concatenates dictionaries. Example: >>> from dict_zip import dict_zip >>> dict_zip({'a': 1, 'b': 2}, {'a': 3, 'b': 4}) {'a': (1, 3), 'b': (2, 4)} >>> from dict_zip import dict_zip_longest ...
true
5afd548624578e174b04bec5374c778e1bbed79f
dbwebb-se/python-slides
/oopython/example_code/vt23/kmom04/a_module.py
1,048
4.15625
4
""" How to mock function in a module. In a unit test we dont want to actually read a file so we will mock the read_file_content() function. But still test get_number_of_line_in_file(). """ def get_number_of_line_in_file(): """ Return how many lines exist in a file """ content = read_file_content() n...
true
7bc58f3621d6e04206543d4b556929e56b1c3b0f
dbwebb-se/python-slides
/oopython/example_code/vt23/kmom03/get_post_ok/src/guess_game.py
1,766
4.21875
4
#!/usr/bin/env python3 """ Main class for the guessing game """ import random from src.guess import Guess class GuessGame: """ Holds info for playing a guessing game """ def __init__(self, correct_value=None, guesses=None): if correct_value is not None: self._correct_value = correct...
true
9902a96d8649184b27bafe7835742d13bcec0f07
yyyuaaaan/python7th
/crk/8.4subsets.py
1,655
4.25
4
"""__author__ = 'anyu' 9.4 Write a method to return all subsets of a set. gives us 2" subsets.We will therefore not be able to do better than 0(2") in time or space complexity. The subsets of {a^ a2, ..., an} are also called the powerset, P({aj, a2, ..., an}),or just P(n). This solution will be 0(2n) in time and space,...
true
c2ffda55f905b9d0bc11dd1cff64761490722eb0
yyyuaaaan/python7th
/crk/4.4.py
1,547
4.125
4
"""__author__ = 'anyu' Implement a function to check if a tree is balanced. For the purposes of this question, a balanced tree is defined to be a tree such that the heights of the two subtrees of any # this is so called AVL-tree node never differ by more than one. """ class Node(object): def __init__(self): ...
true
b5e756f9eec761edbd58127e9ad66d9d0ec3dae5
tnguyenswe/CS20-Assignments
/Variables And Calculations (2)/Nguyen_Thomas_daylight.py
1,071
4.28125
4
''' Name: Thomas Nguyen Date: 1/6/20 Professor: Henry Estrada Assignment: Variables and Calculations (2) This program takes the latitude and day of the year and calculates the minutes of sunshine for the day. ''' #Import math module import math #Gets input from user latitude = float(input("Enter latitude in degrees: "...
true
722b1e1ca439affec2aed8d27f674f281ebc36bb
gg/integer_encoding
/src/integer_encoding.py
1,339
4.34375
4
#!/usr/bin/env python # coding: utf-8 from collections import deque def encoder(alphabet): """ Returns an encoder that encodes a positive integer into a base-`len(alphabet)` sequence of alphabet elements. `alphabet`: a list of hashable elements used to encode an integer; i.e. `'0123456789'` is an...
true
273d638b3c2b9ea9bc8e8b32e59f8c45e61e7ef5
sassy27/DAY1
/OOP/Class instance.py
781
4.125
4
class employees: raised_amount = 1.04 num_emp = 0 def __init__(self,first,last,pay): self.first = first self.last = last self.pay = pay employees.num_emp += 1 # prints number of employees by adding after each emp created def fullname(self): return "{} {}". form...
true
4589928fdb9ae81e9d9d23b509b30a61539ebd8e
rohitx/Zelle-Python-Solutions
/Chapter2/question1.py
289
4.125
4
print "This program takes Celsius temperature as user \ input and outputs temperature in Fahrenheit" def main(): celsius = input("What is the Celsius temperature?") fahrenheit = (9/5.) * celsius + 32 print "The temperature is", fahrenheit, "degrees Fahrenheit." main()
true
7bcdb4a3550071c4ff668aa0f7977a1aad65ad16
rohitx/Zelle-Python-Solutions
/Chapter3/question1.py
349
4.25
4
import math print "This program computes the Volume and Surface of a sphere\ for a user-specified radius." def main(): radius = float(raw_input("Please enter a radius: ")) volume = (4/3.) * (math.pi * radius**3) surface = 4 * math.pi * radius**2 print "The Volume is: ", volume print "The S...
true
ca20faf4e6b8365bcbffe5f3fe94ce0c1d07c239
PeterParkSW/User-Logins
/UserLogins.py
1,525
4.4375
4
#dictionary containing paired usernames and passwords that have been created #keys are usernames, values are passwords credentials = {} #asks user for a new username and password to sign up and put into credentials dictionary def signup(): new_user = input('Please enter a username you would like to use: ') whi...
true
d5441ca9d8a467482c1341852a04c893850c10b5
KhoobBabe/math-expression-calculator
/mathmatical expression calculator.py
1,629
4.1875
4
import warnings print('Enter a mathematical expression to view its result') #we put a while to cotinously prompt the yser to input expressions cond = True while cond is True: #this ignores other warnings warnings.simplefilter('ignore') #input is taken here a = input("\nEnter a mathematical...
true
f58fce209324c621cbeebac88493ef6a9589e448
MakarVS/GeekBrains_Algorithms_Python
/Lesson_7/les_7_task_2.py
1,695
4.28125
4
""" Задача № 2. Отсортируйте по возрастанию методом слияния одномерный вещественный массив, заданный случайными числами на промежутке [0; 50). Выведите на экран исходный и отсортированный массивы. """ from random import uniform n = 10 array = [uniform(0, 50) for _ in range(n)] print(f'Изначальный массив - {array}') ...
false
91c31541149c611200972360d1fe701328937e12
MakarVS/GeekBrains_Algorithms_Python
/Lesson_2/Check/Lesson2/Les2_Task3.py
436
4.125
4
#3. Сформировать из введенного числа обратное по порядку входящих в него цифр и вывести на экран. #Например, если введено число 3486, надо вывести 6843. num = int(input("Введите число: ")) num2 = 0 while True: num2 = num2 * 10 + num % 10 num //= 10 if num == 0: break print(f"{num2}")
false
0a0e377ff207f57bafb2cd622c772080d4559fe4
AvyanshKatiyar/megapython
/app4/app4_code/backend.py
2,190
4.3125
4
import sqlite3 def connect(): conn=sqlite3.connect("books.db") cur=conn.cursor() cur.execute("CREATE TABLE IF NOT EXISTS book (id INTEGER PRIMARY KEY, title text, author text, year integer, isbn integer)") conn.commit() conn.close() #id checks how many entries def insert(title, author, ye...
true
eb740ea5b08d9f8b1cec289512d993ec5093ea42
AvyanshKatiyar/megapython
/Not_app_code/the_basics/forloops.py
889
4.1875
4
monday_temperatures=[9.1, 9.7, 7.6] #rounding print(round(monday_temperatures[0])) for temperature in monday_temperatures: print(round(temperature)) #loop goes through all the variables #looping through a dictionary student_grades={"Marry": 9.1, "Sim": 8.8, "John": 7.5} #chose what you want to iterate o...
true
cecf188d0a3425dbc83dac4b9caf56f1f428b4d2
meetashwin/python-play
/basic/countsetbits.py
392
4.5
4
# Program to count the set bits in an integer # Examples: # n=6, binary=110 => Set bits = 2 (number of 1's) # n=12, binary=1100 => Set bits = 2 # n=7, binary=111 => Set bits = 3 def countsetbits(n): count = 0 while(n): count += n & 1 n >>= 1 return count print("Enter the number to find set bits for:") n = ...
true
5212f2d72f6162d1d169b7b583f4ff83fdf85781
dannko97/python_github
/Algorithmic illustration_算法图解/divide and conguer_sum.py
606
4.15625
4
# recursion def DaC_sum(list): """sum of the elements of a list""" if list == []: return 0 else: x = list[0] return x + DaC_sum(list[1:]) def DaC_len(list): """number of the elements of a list""" if list == []: return 0 else: return 1 + DaC_len(list[1:...
false
6b674887d7d590d12016e60aed03cce67d284b9d
remcous/Python-Crash-Course
/Ch04/squares.py
452
4.5625
5
#initialize an empty list to hold squared numbers squares = [] for value in range(1,11): # ** acts as exponent operator in python square = value**2 # appends the square into the list of squares squares.append(square) print(squares) # more concise approach squares = [] for value in range(1,11): squares.append(va...
true
b9854e8781e6261b6919999f85e782205aab07d1
BD20171998/holbertonschool-higher_level_programming
/0x0A-python-inheritance/2-is_same_class.py
686
4.46875
4
#!/usr/bin/python3 """ This is an example of the is_same_class function >>> a = 1 >>> if is_same_class(a, int): ... print("{} is an instance of the class {}".format(a, int.__name__)) >>> if is_same_class(a, float): ... print("{} is an instance of the class {}".format(a, float.__name__)) >>> if is_same_class(a, object...
true
36bcd1fc0ec00f9ca1da87c053a7813973b4d23d
BD20171998/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-append_write.py
624
4.25
4
#!/usr/bin/python3 """This is an example of the append_write function >>> append_write = __import__('4-append_write').append_write >>> nb_characters_added = append_write("file_append.txt", "Holberton School \ ... is so cool!\n") >>> print(nb_characters_added) 29 """ def append_write(filename="", text=""): """ ...
true
182439b2b6788b01a954ce47777231ae3a53a0f2
roshanpiu/PythonOOP
/12_Inheritance.py
658
4.28125
4
'''Inheritance example''' class Animal(object): '''Animal class''' def __init__(self, name): self.name = name def eat(self, food): '''eat method''' print '%s is eating %s.' % (self.name, food) class Dog(Animal): '''Dog class''' def fetch(self, thing): '''eat metho...
false
b024737c383e9990ea898a749ec09a2ef3a42320
samaroo/PythonForBeginners
/Ch7_Exercise.py
1,064
4.3125
4
# Notes # Functions in "Math" Library # use "import math" to import math library # abs(x) will return the absolutw calue of x # "math.ceil(x)" will round x up to the nearest integer greater than it # "math.floor(x)" will round x down to the nearest integer less than it # "pow(x, y)" will return x^y # # Functio...
true
47a9a81a19167702406cdc447d564bcfbf27c94c
Yaco-Lee/Python
/Calculator/src/yacoapp.py
1,602
4.1875
4
# ACA ES DONDE VAMOS A DEFINIR LAS COSAS def main(): operaciones = getOperaciones() print("tenemos por ahora") devuelveListaDeOperaciones(operaciones) print("que deseas?") accion = getAccion() # print("poné el primer numero wacheen") # primernumero = input() # print("ahora el segundo") # segundon...
false