blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
efa5b93f22db52d9dfe98f8a95f3c8da4866aa24
VictorSHJ/fundamentos-python
/palindroma.py
1,116
4.125
4
# GRUPO 2: # Crea una funcion que dado una palabra diga si es palindroma o no. def palindroma(palabra): print(f"Palabra Normal: {palabra}, Palabra Invertida: {palabra[::-1]}") if palabra == palabra[::-1]: print("Es palindroma") else: print("No es palindroma") print("Ingrese una palabra :"...
false
20bb2a14fbb695fa1d1868147e8e2afc147cecc3
fatychang/pyimageresearch_examples
/ch10 Neural Network Basics/perceptron_example.py
1,157
4.25
4
# -*- coding: utf-8 -*- """ Created on Mon Dec 9 12:56:47 2019 This is an example for runing percenptron structure to predict bitwise dataset You may use AND, OR and XOR in as the dataset. A preceptron class is called in this example. An example from book deep learning for computer vision with Python ch10 @author: ...
true
847ace6bebef81ef053d6a0268fa54e36072dd72
chenshaobin/python_100
/ex2.py
1,113
4.1875
4
#!/usr/bin/python # -*- coding: utf-8 -*- """ # Write a program which can compute the factorial of a given numbers. # The results should be printed in a comma-separated sequence on a single line.Suppose the following input is supplied to the program: 8 Then, the output should be:40320 """ # 使用while """ n = int...
true
baa5ff5f08103e624b90c7a754f0f5cc60429f0e
chenshaobin/python_100
/ex9.py
581
4.15625
4
#!/usr/bin/python # -*- coding: utf-8 -*- """ # Write a program that accepts sequence of lines as input # and prints the lines after making all characters in the sentence capitalized. """ # solution1 """ lst = [] while True: x = input("Please enter one word:") if len(x) == 0: break lst.appen...
true
eaeed21766f75657270303ddac34c8dcae8f4f01
Scientific-Computing-at-Temple-Physics/prime-number-finder-gt8mar
/Forst_prime.py
605
4.375
4
# Marcus Forst # Scientific Computing I # Prime Number Selector # This function prints all of the prime numbers between two entered values. import math as ma # These functions ask for the number range, and assign them to 'x1' and 'x2' x1 = int(input('smallest number to check: ')) x2 = int(input('largest number to ...
true
4845e44fa0afcea9f4293f45778f6b4ea0da52b0
jamiegowing/jamiesprojects
/character.py
402
4.28125
4
print("Create your character") name = input("what is your character's name") age = int(input("how old is your character")) strengths = input("what are your character's strengths") weaknesses = input("what are your character's weaknesses") print(f"""You'r charicters name is {name} Your charicter is {age} years old stren...
true
142ecec208f83818157ce4c8dff7495892e5d5d2
yagizhan/project-euler
/python/problem_9.py
450
4.15625
4
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # a2 + b2 = c2 # For example, 32 + 42 = 9 + 16 = 25 = 52. # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. def abc(): for c in range(1, 1000): for b in range(1, c): ...
true
7d45513f6cb612b73473be6dcefaf0d2646bc629
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/decorators.py
1,146
4.96875
5
# INTRODUCTION TO BASIC DECORATORS USING PYTHON 3 # Decorators provide a way to modify functions using other functions. # This is ideal when you need to extend the functionality of functions # that you don't want to modify. Let's take a look at this example: # Made with ❤️ in Python 3 by Alvison Hunter - June 15th, 202...
true
ef45a2be2134cdf0754d5f41a9245f4a242fdb0e
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/updating_dicts_lst.py
1,327
4.40625
4
# ------------------------------------------------------------------------- # Basic operations with colletion types | Python exercises | Beginner level # Generate list with random elements, find the first odd number and its index # Create empty dict, fill up an empty list with user input & update dictionary # Made wit...
false
a2a6348689cab9d87349099ae927cecad07ade1a
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/intro_to_classes_employee.py
1,839
4.65625
5
# -------------------------------------------------------------------------------- # Introduction to classes using getters & setters with an employee details example. # Made with ❤️ in Python 3 by Alvison Hunter - March 16th, 2021 # JavaScript, Python and Web Development tips at: https://bit.ly/3p9hpqj # --------------...
true
a1f5c161202227c1c43886a0efac0c18be4b2894
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/population_growth.py
1,199
4.375
4
# In a small town the population is p0 = 1000 at the beginning of a year. # The population regularly increases by 2 percent per year and moreover # 50 new inhabitants per year come to live in the town. How many years # does the town need to see its population greater or equal to p = 1200 inhabitants? # ---------------...
true
fd287a7a3dad56ef140e053eba439de50cdfd9b6
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/dice.py
983
4.40625
4
#First, you only need the random function to get the results you need :) import random #Let us start by getting the response from the user to begin repeat = input('Would you like to roll the dice [y/n]?\n') #As long as the user keeps saying yes, we will keep the loop while repeat != 'n': # How many dices does the use...
true
d94493c20365c14ac8393ed9384ec6013cf553d4
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/interest_calc.py
2,781
4.1875
4
# Ok, Let's Suppose you have $100, which you can invest with a 10% return each year. #After one year, it's 100×1.1=110 dollars, and after two years it's 100×1.1×1.1=121. #Add code to calculate how much money you end up with after 7 years, and print the result. # Made with ❤️ in Python 3 by Alvison Hunter - September 4t...
true
00575e9b32db9476ffc7078e85c58b06d4ed98f2
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/format_phone_number.py
1,248
4.1875
4
# -------------------------------------------------------------------------------- # A simple Phone Number formatter routine for nicaraguan area codes # Made with ❤️ in Python 3 by Alvison Hunter - April 4th, 2021 # JavaScript, Python and Web Development tips at: https://bit.ly/3p9hpqj # -------------------------------...
true
1c03ec92c1c0b26a9549bf8fd609a8637c1e0918
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/weird_not_weird_variation.py
960
4.34375
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 eve...
true
1e8270231129139869e687fbab776af985abdacb
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/guess_random_num.py
871
4.34375
4
# ------------------------------------------------------------------------- # Basic operations with Python 3 | Python exercises | Beginner level # Generate a random number, request user to guess the number # Made with ❤️ in Python 3 by Alvison Hunter Arnuero - June 4th, 2021 # JavaScript, Python and Web Development tip...
true
5c92d100afaeff3c941bb94bd906213b11cbd0bd
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/tower_builder.py
644
4.3125
4
# Build Tower by the following given argument: # number of floors (integer and always greater than 0). # Tower block is represented as * | Python: return a list; # Made with ❤️ in Python 3 by Alvison Hunter - Friday, October 16th, 2020 def tower_builder(n_floor): lst_tower = [] pattern = '*' width = (n_flo...
true
9030b8aa3ca6e00f598526efe02f28e3cc8c8fca
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/user_details_cls.py
2,565
4.28125
4
# -------------------------------------------------------------------------------- # Introduction to classes using a basic grading score for an student # Made with ❤️ in Python 3 by Alvison Hunter - March 16th, 2021 # JavaScript, Python and Web Development tips at: https://bit.ly/3p9hpqj # -----------------------------...
true
ea028ebf1fdb4f74028315e52ebf4e8658ceb927
AlvisonHunterArnuero/EinstiegPythonProgrammierung-
/people_in_your_life.py
655
4.4375
4
# -------------------------------------------------------------------------------- # Introduction to classes using a basic grading score for an student # Made with ❤️ in Python 3 by Alvison Hunter - March 6th, 2021 # JavaScript, Python and Web Development tips at: https://bit.ly/3p9hpqj # ------------------------------...
false
9a79519d12b3d7dbdbb68c14cc8f764b40db1511
ChristianECG/30-Days-of-Code_HackerRank
/09.py
1,451
4.40625
4
# ||-------------------------------------------------------|| # ||----------------- Day 9: Recursion 3 ------------------|| # ||-------------------------------------------------------|| # Objective # Today, we're learning and practicing an algorithmic concept # called Recursion. Check out the Tutorial tab for learning...
true
7405e9613731ccfdc5da27bf26cf12059e8b4899
ChristianECG/30-Days-of-Code_HackerRank
/11.py
1,745
4.28125
4
# ||-------------------------------------------------------|| # ||---------------- Day 11: 2D Arrays --------------------|| # ||-------------------------------------------------------|| # Objective # Today, we're building on our knowledge of Arrays by adding # another dimension. Check out the Tutorial tab for learning...
true
7af39c66eba7f0299a47f3674f199233923b4ba9
abasired/Data_struct_algos
/DSA_Project_2/file_recursion_problem2.py
1,545
4.15625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 28 19:21:50 2020 @author: ashishbasireddy """ import os def find_files(suffix, path): """ Find all files beneath path with file name suffix. Note that a path may contain further subdirectories and those subdirectories may also cont...
true
782b07d8fc6ca8ee98695353aa91f9d6794ea9ca
Delrorak/python_stack
/python/fundamentals/function_basic2.py
2,351
4.34375
4
#Countdown - Create a function that accepts a number as an input. Return a new list that counts down by one, from the number (as the 0th element) down to 0 (as the last element). #Example: countdown(5) should return [5,4,3,2,1,0] def add(i): my_list = [] for i in range(i, 0-1, -1): my_list.append(i) ...
true
886c8f7719475fdf6723610d3fb07b1a6566e825
Chahbouni-Chaimae/Atelier1-2
/python/invr_chaine.py
323
4.4375
4
def reverse_string(string): if len(string) == 0: return string else: return reverse_string(string[1:]) + string[0] string = "is reverse" print ("The original string is : ",end="") print (string) print ("The reversed string is : ",end="") print (reverse_string(string...
true
828b7b647572c21ef035b7fe77764ed99ca775a5
drbuche/HackerRank
/Python/03_Strings/005_String_Validators.py
1,313
4.1875
4
# Problem : https://www.hackerrank.com/challenges/string-validators/problem # Score : 10 points(MAX) # O método .isalnum() retorna True caso haja apenas caracteres alfabéticos e numéricos na string. # O método .isalpha() retorna True caso todos os caracteres sejam caracteres alfabéticos. # O método .isdigit() retorna...
false
207404ca1e3a25f6a9d008ddbed2c7ca827c789b
eigenric/euler
/euler004.py
763
4.125
4
# author: Ricardo Ruiz """ Project Euler Problem 4 ======================= A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99. Find the largest palindrome made from the product of two 3-digit numbers. """ import itertools def is_pal...
true
d4d673ef94eca4ddfd5b6713726e507dad1849d6
abhaj2/Phyton
/sample programs_cycle_1_phyton/13.py
285
4.28125
4
#To find factorial of the given digit factorial=1 n=int(input("Enter your digit")) if n>0: for i in range(1,n+1): factorial=factorial*i else: print(factorial) elif n==0: print("The factorial is 1") else: print("Factorial does not exits")
true
047d6aa0dd53e1adaf6989cd5a977f07d346c73c
abhaj2/Phyton
/sample programs_cycle_1_phyton/11.py
235
4.28125
4
#to check the entered number is +ve or -ve x=int(input("Enter your number")) if x>0: print("{0} is a positive number".format(x)) elif x==0: print("The entered number is zero") else: print("{0} is a negative number".format(x))
true
afad18bd31239b95dd4fd00ea0b8f66c668fd1a6
abhaj2/Phyton
/sample programs_cycle_1_phyton/12.py
374
4.1875
4
#To find the sum of n natural numbers n=int(input("Enter your limit\n")) y=0 for i in range (n): x=int(input("Enter the numbers to be added\n")) y=y+x else: print("The sum is",y) #To find the sum of fist n natural numbers n=int(input("Enter your limit\n")) m=0 for i in range (1,n): m=m+i else: ...
false
5bd43106071a675af17a6051c9de1f0cee0e0aec
abhaj2/Phyton
/cycle-2/3_c.py
244
4.125
4
wordlist=input("Enter your word\n") vowel=[] for x in wordlist: if('a' in x or 'e' in x or 'i' in x or 'o' in x or'u' in x or 'A' in x or 'E' in x or 'I' in x or 'O'in x or"U" in x): vowel.append(x) print(vowel)
true
a1a9fc369a0b994c99377dc6af16d00612a68f3b
juliaviolet/Python_For_Everybody
/Overtime_Pay_Error.py
405
4.15625
4
hours=input("Enter Hours:") rate=input("Enter Rate:") try: hours1=float(hours) rate1=float(rate) if hours1<=40: pay=hours1*rate1 pay1=str(pay) print('Pay:'+'$'+pay1) elif hours1>40: overtime=hours1-40.0 pay2=overtime*(rate1*1.5)+40.0*rate1 pay3=str(pay2) ...
true
6995eed67a401cd363dcfa60b2067ef13732becb
ha1fling/CryptographicAlgorithms
/3-RelativePrimes/Python-Original2017Code/Task 3.py
1,323
4.25
4
while True: #while loop for possibility of repeating program while True: #integer check for input a try: a= input ("Enter a:") a= int(a) break except ValueError: print ("Not valid, input integers only") while True: #integer check ...
true
aeb8f28c7c87fcf9df9f60e1a0b65786b9910beb
Crazyinfo/Python-learn
/basis/基础/偏函数.py
766
4.3125
4
print(int('12345')) print(int('12345',base = 8)) # int()中还有一个参数base,默认为10,可以做进制转换 def int2(x,base=2): return int(x,base) # 定义一个方便转化大量二进制的函数 print(int2('11011')) # functools.partial就是帮助我们创建一个偏函数的,不需要我们自己定义int2(),可以直接使用下面的代码创建一个新的函数int3: import functools int3 = functools.partial(int , base = 2) # 固定了int()函数的关键字参数...
false
9e0314bd94c25a0a1b012545cb2047d796a949b1
true-false-try/Python
/A_Byte_of_Python/lambda_/natural_number.py
1,551
4.21875
4
""" Дано натуральне число n та послідовність натуральних чисел a1, a2, …, an. Показати всі елементи послідовності, які є а) повними квадратами; б) степенями п’ятірки; в) простими числами. Визначити відповідні функції для перевірки, чи є число: повним квадратом, степенню п’ятірки, простим числом. """ import r...
false
64d01a920fcf73ad8e0e2f55d894029593dc559d
zitorelova/python-classes
/competition-questions/2012/J1-2012.py
971
4.34375
4
# Input Specification # The user will be prompted to enter two integers. First, the user will be prompted to enter the speed # limit. Second, the user will be prompted to enter the recorded speed of the car. # Output Specification # If the driver is not speeding, the output should be: # Congratulations, you are within...
true
693c554c403602ca49fb6a852648c4e9547723d7
Pasquale-Silv/Bit4id_course
/Course_Bit4id/ThirdDay/Loop_ex1.py
711
4.40625
4
items = ["Python", 23, "Napoli", "Pasquale"] for item in items: print(item) print() for item in items: print("Mi chiamo {}, vivo a {}, ho {} anni e sto imparando il linguaggio di programmazione '{}'.".format(items[-1], ...
false
56ce5b83d5ed2b0fb6807d22e52cc0dc9514a9d6
Pasquale-Silv/Bit4id_course
/Some_function/SF6_factorialWithoutRec.py
822
4.28125
4
def factorial_WithoutRec(numInt): """Ritorna il fattoriale del numero inserito come argomento.""" if (numInt <= 0): return 1 factorial = 1 while(numInt > 0): factorial *= numInt numInt -= 1 return factorial factorial5 = factorial_WithoutRec(5) print("5! =", factor...
false
c32334bce0e237b3ad2dac4de7efeb73cdbfb123
Pasquale-Silv/Bit4id_course
/Course_Bit4id/FourthDay/ex5_SortingIntList.py
808
4.5
4
nums = [100, -80, 3, 8, 0] print("Lista sulla quale effettueremo le operazioni:", nums) print("\nOriginal order:") for num in nums: print(num) print("\nIncreasing order::") for num in sorted(nums): print(num) print("\nOriginal order:") for num in nums: print(num) print("\nDecreasing ord...
false
6da48b1d055c81f33d761c13c3ceef41133231bb
a1ip/python-learning
/phyton3programming/1ex4.awfulpoetry2_ans.py
1,576
4.1875
4
#!/usr/bin/env python3 """ добавьте в нее программный код, дающий пользователю возможность определить количество выводимых строк (от 1 до 10 включительно), передавая число в виде аргумента командной строки. Если программа вызывается без аргумента, она должна по умолчанию выводить пять строк, как и раньше. """ import...
false
efba9a36610e4837f4723d08518a5255da5a881a
TonyZaitsev/Codewars
/8kyu/Remove First and Last Character/Remove First and Last Character.py
680
4.3125
4
/* https://www.codewars.com/kata/56bc28ad5bdaeb48760009b0/train/python Remove First and Last Character It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less ...
true
0c17db71399217a47698554852206d60743ef93e
TonyZaitsev/Codewars
/7kyu/Reverse Factorials/Reverse Factorials.py
968
4.375
4
""" https://www.codewars.com/kata/58067088c27998b119000451/train/python Reverse Factorials I'm sure you're familiar with factorials – that is, the product of an integer and all the integers below it. For example, 5! = 120, as 5 * 4 * 3 * 2 * 1 = 120 Your challenge is to create a function that takes any number and r...
true
3d35471031ccadd2fc2e526881b71a7c8b55ddc0
TonyZaitsev/Codewars
/8kyu/Is your period late?/Is your period late?.py
1,599
4.28125
4
""" https://www.codewars.com/kata/578a8a01e9fd1549e50001f1/train/python Is your period late? In this kata, we will make a function to test whether a period is late. Our function will take three parameters: last - The Date object with the date of the last period today - The Date object with the date of the check c...
true
019b5d23d15f4b1b28ee9d89112921f4d325375e
TonyZaitsev/Codewars
/7kyu/Sum Factorial/Sum Factorial.py
1,148
4.15625
4
""" https://www.codewars.com/kata/56b0f6243196b9d42d000034/train/python Sum Factorial Factorials are often used in probability and are used as an introductory problem for looping constructs. In this kata you will be summing together multiple factorials. Here are a few examples of factorials: 4 Factorial = 4! = 4 * ...
true
56be1dd38c46c57d5985d8c85b00895eeca5777d
TonyZaitsev/Codewars
/5kyu/The Hashtag Generator/The Hashtag Generator.py
2,177
4.3125
4
""" https://www.codewars.com/kata/52449b062fb80683ec000024/train/python The Hashtag Generator The marketing team is spending way too much time typing in hashtags. Let's help them with our own Hashtag Generator! Here's the deal: It must start with a hashtag (#). All words must have their first letter capitalized. If...
true
3afc1ab7a0de2bb6dc837084dd461865a2c34089
mirpulatov/racial_bias
/IMAN/utils.py
651
4.15625
4
def zip_longest(iterable1, iterable2): """ The .next() method continues until the longest iterable is exhausted. Till then the shorter iterable starts over. """ iter1, iter2 = iter(iterable1), iter(iterable2) iter1_exhausted = iter2_exhausted = False while not (iter1_exhausted and iter2_exhausted): ...
true
3a1566cb54285e6f282a6e871ec37ff22caba743
EkajaSowmya/SravanClass
/conditionalStatements/ifStatement.py
295
4.25
4
n1 = int(input("enter first number")) n2 = int(input("enter second number")) n3 = int(input("enter third number")) if n1 > n2 and n1 > n3: print("n1 is largest", n1) if n2 > n3 and n2 > n3: print("n2 is largest number", n2) if n3 > n1 and n3 > n2: print("n3 is largest number", n3)
false
ef92a4e1ebdf637dc387c96ba210fcaa95b7ffde
yuyaxiong/interveiw_algorithm
/剑指offer/二叉树的深度.py
1,525
4.15625
4
""" 输入一颗二叉树的根节点,求该树的深度。从根节点到叶节点一次经过的节点(含根,叶节点)形成树的一条路径, 最长路径的长度为树的深度。 5 3 7 2 8 1 """ class BinaryTree(object): def __init__(self): self.value = None self.left = None self.right = None class Solution(object): def tree_depth(self, pRoot): depth = 0 ...
false
77c9f7f18798917cbee5e7fc4044c3a70d73bb33
amitrajhello/PythonEmcTraining1
/psguessme.py
611
4.1875
4
"""The player will be given 10 chances to guess a number, and when player gives a input, then he should get a feedback that his number was lesser or greater than the random number """ import random key = random.randint(1, 1000) x = 1 while x <= 10: user_input = int(input('Give a random number to play the ...
true
67e83fd9552337c410780198f08039044c925965
Mickey248/ai-tensorflow-bootcamp
/pycharm/venv/list_cheat_sheet.py
1,062
4.3125
4
# Empty list list1 = [] list1 = ['mouse', [2, 4, 6], ['a']] print(list1) # How to access elements in list list2 = ['p','r','o','b','l','e','m'] print(list2[4]) print(list1[1][1]) # slicing in a list list2 = ['p','r','o','b','l','e','m'] print(list2[:-5]) #List id mutable !!!!! odd = [2, 4, 6, 8] odd[0] = 1 print(o...
true
c9f325732c1a2732646deadb25c9132f3dcae649
samir-0711/Area_of_a_circle
/Area.py
734
4.5625
5
import math import turtle # create screen screen = turtle.Screen() # take input from screen r = float(screen.textinput("Area of Circle", "Enter the radius of the circle in meter: ")) # draw circle of radius r t=turtle.Turtle() t.fillcolor('orange') t.begin_fill() t.circle(r) t.end_fill() turtle.penup() # calculate are...
true
c7ac2454578be3c3497759f156f7bb9f57415433
dawid86/PythonLearning
/Ex7/ex7.py
513
4.6875
5
# Use words.txt as the file name # Write a program that prompts for a file name, # then opens that file and reads through the file, # and print the contents of the file in upper case. # Use the file words.txt to produce the output below. fname = input("Enter file name: ") fhand = open(fname) # fread = fhand.read() # p...
true
acd10df184f13bb7c54a6f4a5abac553127b27af
chittoorking/Top_questions_in_data_structures_in_python
/python_program_to_create_grade_calculator.py
830
4.25
4
#Python code for the Grade #Calculate program in action #Creating a dictionary which #consists of the student name, #assignment result test results #And their respective lab results def grade(student_grade): name=student_grade['name'] assignment_marks=student_grade['assignment'] assignment_score=...
true
968829ff7ec07aabb3dedfb89e390334b9b9ee57
chittoorking/Top_questions_in_data_structures_in_python
/python_program_to_check_if_a_string_is_palindrome_or_not.py
450
4.3125
4
print("This is python program to check if a string is palindrome or not") string=input("Enter a string to check if it is palindrome or not") l=len(string) def isPalindrome(string): for i in range(0,int(len(string)/2)): if string[i]==string[l-i-1]: flag=0 continue else : ...
true
06132de9f0dd0dfbf3138ead23bd4a936ca4a70a
chittoorking/Top_questions_in_data_structures_in_python
/python_program_to_interchange_first_and_last_elements_in_a_list_using_pop.py
277
4.125
4
print("This is python program to swap first and last element using swap") def swapList(newList): first=newList.pop(0) last=newList.pop(-1) newList.insert(0,last) newList.append(first) return newList newList=[12,35,9,56,24] print(swapList(newList))
true
0901c75662df3c0330deb4d25087868ba0693e94
dipesh1011/NameAgeNumvalidation
/multiplicationtable.py
360
4.1875
4
num = input("Enter the number to calculate multiplication table:") while(num.isdigit() == False): print("Enter a integer number:") num = input("Enter the number to calculate multiplication table:") print("***************************") print("Multiplication table of",num,"is:") for i in range(1, 11): res = i...
true
8ed94e5a5bc207a34271e2bb52029d7b6b71870d
darlenew/california
/california.py
2,088
4.34375
4
#!/usr/bin/env python """Print out a text calendar for the given year""" import os import sys import calendar FIRSTWEEKDAY = 6 WEEKEND = (5, 6) # day-of-week indices for saturday and sunday def calabazas(year): """Print out a calendar, with one day per row""" BREAK_AFTER_WEEKDAY = 6 # add a newline after ...
true
d86ab402a950557261f140137b2771e84ceafbbe
priyankagarg112/LeetCode
/MayChallenge/MajorityElement.py
875
4.15625
4
''' Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element always exist in the array. Example 1: Input: [3,2,3] Output: 3 Example 2: Input: [2,2,1,1,1,2,2] Output: 2 ''' from t...
true
61329cb09135f5634b1c64baa1db566836929a26
shivamach/OldMine
/HelloWorld/python/strings.py
527
4.375
4
print("trying basic stuff out") m1 = "hello" m2 = "World" name = "shivam" univ = "universe" print(m1,", ",m2) print(m1.upper()) print(m2.lower()) message = '{}, {}. welcome !'.format(m1,m2.upper()) print(message) message = message.replace(m2.upper(),name.upper()) #replacing with methods should be precise print(messag...
false
433027b761e728e242c5b58c11866208fe39ca23
caesarbonicillo/ITC110
/quadraticEquation.py
870
4.15625
4
#quadratic quations must be a positive number import math def main(): print("this program finds real solutions to quadratic equations") a = float(input("enter a coefficient a:")) b = float(input("enter coefficient b:")) c = float(input("enter coefficient c:")) #run only if code is great...
true
12c96ea6817d91f8d488f13c119752f747971c94
caesarbonicillo/ITC110
/Temperature.py
496
4.125
4
#convert Celsius to Fehrenheit def main(): #this is a function #input celsius = eval (input ("Enter the temp in Celsius ")) #must convert to number call function EVAL #processing fahrenheit = round(9/5 * celsius + 32, 0) #output print (celsius, "The Fehrenheit temp is", fahrenheit) m...
true
d8325a2d9e1214a72880b37b023d4af1a8d88469
pandeesh/CodeFights
/Challenges/find_and_replace.py
556
4.28125
4
#!/usr/bin/env python """ ind all occurrences of the substring in the given string and replace them with another given string... just for fun :) Example: findAndReplace("I love Codefights", "I", "We") = "We love Codefights" [input] string originalString The original string. [input] string stringToFind A string to ...
true
5fa88d472f98e125a2dd79e2d6986630bbb28396
pandeesh/CodeFights
/Challenges/palindromic_no.py
393
4.125
4
#!/usr/bin/env python """ You're given a digit N. Your task is to return "1234...N...4321". Example: For N = 5, the output is "123454321". For N = 8, the output is "123456787654321". [input] integer N 0 < N < 10 [output] string """ def Palindromic_Number(N): s = '' for i in range(1,N): s = s + str...
true
a69789bfada6cdab50325c5d2c9ff3edf887aebe
dhasl002/Algorithms-DataStructures
/stack.py
1,562
4.3125
4
class Stack: def __init__(self): self.elements = [] def pop(self): if not self.is_empty(): top_element = self.elements[len(self.elements)-1] self.elements.pop(len(self.elements)-1) return top_element else: print("The stack is empty, you ca...
false
83a2fe0e985ffa4d33987b15e6b4ed8a6eb5703b
Nbouchek/python-tutorials
/0001_ifelse.py
836
4.375
4
#!/bin/python3 # Given an integer, , perform the following conditional actions: # # If is odd, print Weird # If is even and in the inclusive range of 2 to 5, print Not Weird # If is even and in the inclusive range of 6 to 20, print Weird # If is even and greater than 20, print Not Weird # Input Format # # A single...
true
a30b0e3f5120fc484cd712f932171bd322e757df
ByketPoe/gmitPandS
/week04-flow/lab4.1.3gradeMod2.py
1,152
4.25
4
# grade.py # The purpose of this program is to provide a grade based on the input percentage. # It allows for rounding up of grades if the student is 0.5% away from a higher grade bracket. # author: Emma Farrell # The percentage is requested from the user and converted to a float. # Float is appropriate in this occa...
true
6f16bc65643470b2bca5401667c9537d88187656
ByketPoe/gmitPandS
/week04-flow/lab4.1.1isEven.py
742
4.5
4
# isEven.py # The purpose of this program is to use modulus and if statements to determine if a number is odd or even. # author: Emma Farrell # I prefer to use phrases like "text" or "whole number" instead of "string" and "integer" as I beleive they are more user friendly. number = int(input("Enter a whole number: "))...
true
4dc6ecdfe3063f3015801cf13472f7f77d742f0a
Denton044/Machine-Learning
/PythonPractice/python-programming-beginner/Python Basics-1.py
2,217
4.5625
5
## 1. Programming And Data Science ## england = 135 india = 124 united_states = 134 china = 123 ## 2. Display Values Using The Print Function ## china = 123 india = 124 united_states = 134 print (china) print (united_states) print (india) ## 3. Data Types ## china_name = "China" china_rounded = 123 china_exact =...
false
6fa32bc3efeb0a908468e6f9cec210846cd69085
yoli202/cursopython
/ejerciciosBasicos/main3.py
396
4.40625
4
''' Escribir un programa que pregunte el nombre del usuario en la consola y después de que el usuario lo introduzca muestre por pantalla <NOMBRE> tiene <n> letras, donde <NOMBRE> es el nombre de usuario en mayúsculas y <n> es el número de letras que tienen el nombre. ''' name = input(" Introduce tu nombre: ") ...
false
5901b1fcabefe69b1ecc24f2e15ffe2d3daed18b
MaurizioAlt/ProgrammingLanguages
/Python/sample.py
454
4.125
4
#input name = input("What is your name? ") age = input("What is your age? ") city = input("What is your city ") enjoy = input("What do you enjoy? ") print("Hello " + name + ". Your age is " + age ) print("You live in " + city) print("And you enjoy " + enjoy) #string stuff text = "Who dis? " print(text*3) #or for lis...
true
a588eb9088de56096f90119b4193087ce7ee6a58
setsunaNANA/pythonhomework
/__init__.py
663
4.1875
4
import turtle def tree(n,degree): # 设置出递归条件 if n<=1and degree<=10: return #首先让画笔向当前指向方向画n的距离 turtle.forward(n) # 画笔向左转20度 turtle.right(degree) #进入递归 把画n的距离缩短一半 同时再缩小转向角度 tree(n/2, degree/1.3) # 出上层递归 转两倍角度把“头”转正 turtle.left(2*degree) # 对左边做相同操作 tree(n / 2, degree / ...
false
e91613869c1751c8bb3a0a0abaeb1dfb9cafa5c3
MingCai06/leetcode
/7-ReverseInterger.py
1,118
4.21875
4
""" Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the pu...
true
169aab304dfd600a169822c65e448b7e4a4abeb3
simgroenewald/Variables
/Details.py
341
4.21875
4
# Compulsory Task 2 name = input("Enter your name:") age = input ("Enter your age:") house_number = input ("Enter the number of your house:") street_name = input("Enter the name of the street:") print("This is " + name + " he/she is " + age + " years old and lives at house number " + house_number + " on " + stree...
true
4e8834fd82ae0c6b78a0d134058afbdb11d2da95
MaxiFrank/calculator-2
/new_arithmetic.py
1,560
4.28125
4
"""Functions for common math operations.""" def add(ls): sum = 0 for num in ls: sum = sum + num return sum def subtract(ls): diff = 0 for num in ls: diff = num - diff return diff # def multiply(num1, num2): def multiply(ls): """Multiply the two inputs together.""" res...
true
3264f6baf0939442a45689f1746d62d6be07eece
aacampb/inf1340_2015_asst2
/exercise2.py
2,014
4.5
4
#!/usr/bin/env python """ Assignment 2, Exercise 2, INF1340, Fall, 2015. DNA Sequencing This module converts performs substring matching for DNA sequencing """ __author__ = 'Aaron Campbell, Sebastien Dagenais-Maniatopoulos & Susan Sim' __email__ = "aaronl.campbell@mail.utoronto.ca, sebastien.maniatopoulos@mail.utoron...
true
bb81d71014e5d45c46c1c34f10ee857f5763c75a
sicou2-Archive/pcc
/python_work/part1/ch03/c3_4.py
1,813
4.125
4
#Guest list dinner_list = ['Sam Scott', 'Tyler Jame', 'Abadn Skrettn', 'Sbadut Reks'] def invites(): print(f'You want food {dinner_list[0]}? Come get food!') print(f'Please honor me {dinner_list[1]}. Dine and talk!') print(f'Hunger gnaws at you {dinner_list[2]}. Allow me to correct that.') print(f'Poi...
true
0a4cc84bd54d8e538b82324172d78b145d7df88e
abishamathi/python-program-
/largest.py
226
4.21875
4
num1=10 num2=14 num3=12 if (num1 >= num2) and (num1 >= num3): largest=num1 elif (num2 >= num1) and (num2 >=num3): largest=num2 else: largest=num3 print("the largest num between",num1,"num2,"num3,"is",largest)
false
bad58f360c606e5a92312ffd2115872b42fffd57
tenasimi/Python_thero
/Class_polymorphism.py
1,731
4.46875
4
# different object classes can share the same name class Dog(): def __init__(self, name): self.name = name def speak(self): # !! both Nico and Felix share the same method name called speak. return self.name + " says woof!" class Cat(): def __init__(self, name...
false
5cd6aae2bacc1b6626dafbc541c626c811e67aac
tenasimi/Python_thero
/Class_Inheritance.py
717
4.15625
4
class Animal(): def __init__(self): print("ANIMAL CREATED") def who_am_i(self): print("I am animal") def eat(self): print("I am eating") myanimal = Animal() #__init__ method gets automatically executed when you # create Anumal() myanimal.who_am_i() myanim...
false
434f69b6fd36753ac13589061bec3cd3da51124a
Alex0Blackwell/recursive-tree-gen
/makeTree.py
1,891
4.21875
4
import turtle as t import random class Tree(): """This is a class for generating recursive trees using turtle""" def __init__(self): """The constructor for Tree class""" self.leafColours = ["#91ff93", "#b3ffb4", "#d1ffb3", "#99ffb1", "#d5ffad"] t.bgcolor("#abd4ff") t....
true
002464d45f720f95b4af89bfa30875ae2ed46f70
spencerhcheng/algorithms
/codefights/arrayMaximalAdjacentDifference.py
714
4.15625
4
#!/usr/bin/python3 """ Given an array of integers, find the maximal absolute difference between any two of its adjacent elements. Example For inputArray = [2, 4, 1, 0], the output should be arrayMaximalAdjacentDifference(inputArray) = 3. Input/Output [execution time limit] 4 seconds (py3) [input] array.integer in...
true
ecaa063b18366d5248e01f5392fcb51e59612c1e
borisnorm/codeChallenge
/practiceSet/levelTreePrint.py
591
4.125
4
#Print a tree by levels #One way to approach this is to bfs the tree def tree_bfs(root): queOne = [root] queTwo = [] #i need some type of switching mechanism while (queOne or queTwo): print queOne while(queOne): item = queOne.pop() if (item.left is not None): queTwo.append(item.left...
true
582d85050e08a6b8982aae505cdc0acc273aec74
Kyle-Koivukangas/Python-Design-Patterns
/A.Creational Patterns/4.Prototype.py
1,661
4.1875
4
# A prototype pattern is meant to specify the kinds of objects to use a prototypical instance, # and create new objects by copying this prototype. # A prototype pattern is useful when the creation of an object is costly # EG: when it requires data or processes that is from a network and you don't want to # ...
true
1d55b37fbef0c7975527cd50a4b65f2839fd873a
Kyle-Koivukangas/Python-Design-Patterns
/A.Creational Patterns/2.Abstract_Factory.py
1,420
4.375
4
# An abstract factory provides an interface for creating families of related objects without specifying their concrete classes. # it's basically just another level of abstraction on top of a normal factory # === abstract shape classes === class Shape2DInterface: def draw(self): pass class Shape3DInterface: de...
true
1994561a1499d77769350b55a6f32cdd111f31fa
Ajat98/LC-2021
/easy/buy_and_sell_stock.py
1,330
4.21875
4
""" You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve...
true
3b76875ec54479b956a45331c3863f956a61df9a
mounui/python
/examples/use_super.py
643
4.125
4
# -*- coding: utf-8 -*- # super使用 避免基类多次调用 class Base(object): def __init__(self): print("enter Base") print("leave Base") class A(Base): def __init__(self): print("enter A") super(A, self).__init__() print("leave A") class B(Base): def __init__(self): prin...
false
8e0e070279b4e917758152ea6f833a26bc56bad7
chirag16/DeepLearningLibrary
/Activations.py
1,541
4.21875
4
from abc import ABC, abstractmethod import numpy as np """ class: Activation This is the base class for all activation functions. It has 2 methods - compute_output - this is used during forward propagation. Calculates A given Z copute_grad - this is used during back propagation. Calculates dZ given dA and A "...
true
f97b32658a54680d8cbfe95abbfd5612e6d22e4e
ssj9685/lecture_test
/assignment/week3.py
290
4.15625
4
num1=int(input("first num: ")) num2=int(input("second num: ")) print("num1 + num2 = ", num1 + num2) print("num1 + num2 = ", num1 - num2) print("num1 + num2 = ", num1 * num2) print("num1 + num2 = ", num1 / num2) print("num1 + num2 = ", num1 // num2) print("num1 + num2 = ", num1 % num2)
false
9c5afd492bc5f9a4131d440ce48636ca03fa721c
viharika-22/Python-Practice
/Problem-Set-2/prob1.py
332
4.34375
4
'''1.) Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged.''' n=input() s=n[len(n)-3:len(n)] if s=='ing': print(n[:len(n...
true
bd512cbe3014297b8a39ab952c143ec153973495
CarolinaPaulo/CodeWars
/Python/(8 kyu)_Generate_range_of_integers.py
765
4.28125
4
#Collect| #Implement a function named generateRange(min, max, step), which takes three arguments and generates a range of integers from min to max, with the step. The first integer is the minimum value, the second is the maximum of the range and the third is the step. (min < max) #Task #Implement a function named #ge...
true
adcad46d8b5e27a20b1660861e8316f9c7044eab
zingpython/Common_Sorting_Algorithms
/selection.py
594
4.125
4
def selectionSort(): for element in range(len(alist)-1): print("element", element) minimum = element print("minimum", minimum) for index in range(element+1,len(alist)): print("index",index) if alist[index] < alist[minimum]: print("alist[index]",alist[index]) print("alist[minimum]",alist[minimum])...
false
1395e5ded5679ceb8a5c607b36a04e647a407147
siddhantpushpraj/Python_Basics-
/class.py
2,929
4.1875
4
''' class xyz: var=10 obj1=xyz() print(obj1.var) ''' ''' class xyz: var=10 def display(self): print("hi") obj1=xyz() print(obj1.var) obj1.display() ''' ##constructor ''' class xyz: var=10 def __init__(self,val): print("hi") self.val=val print(val...
false
80643111235604455d6372e409fa248db684da97
s56roy/python_codes
/python_prac/calculator.py
1,136
4.125
4
a = input('Enter the First Number:') b = input('Enter the Second Number:') # The entered value 10 is a string, not a number. To convert this into a number we can use int() or float() functions. sum = float(a)+float(b) print(sum) print('The sum of {0} and {1} is {2}'.format(a, b, sum)) print('This is output to the ...
true
9060d68c59660d4ee334ee824eda15cc49519de9
ykcai/Python_ML
/homework/week5_homework_answers.py
2,683
4.34375
4
# Machine Learning Class Week 5 Homework Answers # 1. def count_primes(num): ''' COUNT PRIMES: Write a function that returns the number of prime numbers that exist up to and including a given number count_primes(100) --> 25 By convention, 0 and 1 are not prime. ''' # Write your code here #...
true
e25a8fc38ef3e98e5dc34aae30fbbea316e709c2
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/LoopsPractice/3.py
1,029
4.21875
4
# 3. Budget Analysis # Write a program that asks the user to enter the amount that he or she has budgeted for amonth. # A loop should then prompt the user to enter each of his or her expenses for the month, and keep a running total. # When the loop finishes, the program should display theamount that the user is ov...
true
2b1cf90a6ed89d0f5162114a103397c0f2a211e8
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/More advance things/iter.py
612
4.25
4
# Python iterators # mylist = [1, 2, 3, 4] # for item in mylist: # print(item) # def traverse(iterable): # it = iter(iterable) # while True: # try: # item = next(it) # print(item) # except: StopIteration: # break l1 = [1, 2, 3] it ...
true
b62ba48d92de96b49332b094f8b34a5f5af4a6cb
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Hard Stuff/More advance things/map.py
607
4.375
4
# The map() function # Takes in at least 2 args. Can apply a function to every item in a list/iterable quickly def square(x): return x*x numbers = [1, 2, 3, 4, 5] squarelist = map(square, numbers) print(next(squarelist)) print(next(squarelist)) print(next(squarelist)) print(next(squarelist)) print(nex...
true
8abfe167d6fa9e524df27f0adce9f777f4e2df58
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/LoopsPractice/5.py
1,278
4.5625
5
# 5. Average Rainfall # Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. # The program should first ask for the number of years. The outer loop will iterate once for each year. # The inner loop will iterate twelve times, once for each month. Each ite...
true
60f890e1dfb13d2bf8071374024ef673509c58b2
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Medium Stuff/Classes/Inheritance/Practice/Inheritance Exercises - 1.py
1,870
4.59375
5
""" 1. Employee and ProductionWorker Classes Write an Employee class that keeps data attributes for the following pieces of information: • Employee name • Employee number Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class sho...
true
d5b0d5d155c1733eb1a9fa27a7dbf11902673537
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/FunctionExercise/4.py
1,166
4.1875
4
# 4. Automobile Costs # Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: # loan payment, insurance, gas, oil, tires, andmaintenance. # The program should then display the total monthly cost of these expenses,and the total annual...
true
e51cbe700da1b5305ce7dfe9c1748ad3b2369690
Hackman9912/PythonCourse
/Curriculum/My Git Stuff/05PythonProgramming/Additional Stuff/Basic Stuff/Dictionaries and Sets/Sets/notes.py
2,742
4.59375
5
# Sets # A set contains a collection of unique values and works like a mathematical set # 1 All the elements in a set must be unique. No two elements can have the same value # 2 Sets are unordered, which means that the elements are not stored in any particular order # 3 The elements that are stored in a set can be ...
true