blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
7c84e6e89a805b58125905b65148432c6e189677
kagomesakura/numBob
/numBob.py
280
4.15625
4
#print how many times the word bob occurs in string s = 'azcbobobegghakl' numBob = 0 for i in range(len(s)): if s[i:i+3] == "bob": # [i:i+3] checks the current char + the next three chars. numBob += 1 print ('Number of times bob occurs is: ' + str(numBob))
true
d3e9ca28d8c7bfb6c93c3580ed3dffd5f0f6cabd
edubs/lpthw
/ex03.py
1,216
4.65625
5
# Study drills # 1 above each line, user the # to write a comment to yourself explaining what the line does # 2 remember in exercise 0 when you started python3.6? start python3.6 this way again and using the math operators, use python as a calculator # 3 find something you need to calculate and write a new .py file ...
true
6c99118054f5d24b3d145b5902fb77c66802a8b2
Renjihub/code_training
/Python/Duplicates.py
446
4.34375
4
# Print duplicate characters from string # Take sample string and print all duplicate characters. sample_str = "Helloo" print("Sample String :",sample_str) duplicate = set() for char in sample_str: count = 0 for char_s in sample_str: if char.lower()==char_s.lower(): count = count+1 if count>1: d...
true
2d3c303813ec11805c04eaa1618963857e88ee64
mygerges/100-Days-of-Code
/Nested Condition.py
347
4.15625
4
height = float(input("Please enter your height: ")) age = int(input("Enter your age: ")) if height > 120: if age < 12 : print("You can Play, and payment $5") elif age <= 18: print("You can Play, and payment $7") else: print("You can Play, and payment $12") else: print("Sorry can'...
true
a6d8d8d27cdc5053037f52ce897fb6c6844277e3
naumanasrari/NK_PyGamesBook
/1-chap1-get-started.py
355
4.34375
4
x=3 y=2 mul = x * y add1 = x + y sub1 = x - y dev1 = x / y expon1 = x ** y print("multiplication of x and y: ",mul) print("Addition of x and y: ",add1) print("Substraction of x and y: ",sub1) print(" Divsion of x and y in Integer: ",int(dev1)) print(" Divsion of x and y in Float: ",float(dev1)) print("Exponent of x an...
true
9d93d0a24c3c8072c13e033f9ad8a6e1a3858eed
rbabaci1/CS-Module-Recursive_Sorting
/src/searching/searching.py
2,178
4.28125
4
# TO-DO: Implement a recursive implementation of binary search def binary_search(arr, target, start, end): midpoint = (start + end) // 2 if start > end: return -1 if arr[midpoint] == target: return midpoint if arr[midpoint] > target: return binary_search(arr, target, start, midp...
true
2fff7530868944972faeaee929f3a617c6693bfd
sagsam/learn-python
/string-manipulation.py
1,718
4.125
4
print('C:\some\name') # here \n means newline! # o/p : ########### # C:\some # # ame # ########### # If you don’t want characters prefaced by \ to be interpreted as special characters, # you can use raw strings by adding an r before the first quote: print(r'C:\some\name') # note the r before the quote # o/p : #...
true
f4d7d0ab00cc1438d2e66ba11b405006e1842922
mohitgauniyal/Python-Learning
/list.py
672
4.34375
4
shopping_list = ["Apple","Banana"] #to create items list print(shopping_list) print(shopping_list[0:1]) #to print first two items from the list. shopping_list.append("Mango") #to add items in the current list. print(shopping_list) del shopping_list[0] #to delete items from the list. print(shopping_list) shopping_list[1...
true
ef371444b4406e23c1be33ee8dce8449656f098d
MichealGarcia/code
/py3hardway/ex44f.py
2,026
4.46875
4
# Composition # Inheritance is useful, but another way to do it # is just to use other classes and modules # rather than rely on implicit inhereitance. # Two of three ways of inheritance involve writing new code # to replace or alter funcitonality. # This can be replicated by calling functions in a module. #EXAMPLE...
true
451431f093e7960dfa025130bb0b5a0d7f57794c
MichealGarcia/code
/py3hardway/ex9.py
683
4.3125
4
# variable containing a string of each day # of the week separated by a space days = "Mon Tue Wed Thu Fri Sat Sun" # using a back-slash n will print the following text in a new line. months = "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug" print("Here are the days: ", days) print("Here are the months: ", months) # This is...
true
62d63d655efd9c5fdd3dbfd1a18dd33b6e085fdf
MichalKala/Python_Guess_the_Number_game
/Python_Guess_the_Number_game/Python_Guess_the_Number_game.py
1,004
4.3125
4
import random #generate computer's number Computer_number = random.randint(0, 20) print("Your opponent has secretly selected number between 0-20\nYour goal is to guess the number!") print("") #Set loop to let user repeat the choice until they win Outcome = 0 while Outcome < 6: #Let user to choose a number ...
true
44b959d49f4f7c6ed97bbcb02cb11b7e3815c575
sriley86/Python-4th
/Python Chapter 5 Maximum of Two Values.py
567
4.53125
5
# Chapter 4 Exercise 12 Maximum of Two Values # Write a function named max that accepts two integer values as arguments # and returns the value that is the greater of the two. Use the function in a # program that prompts the user to enter two integer values. The program should # display the value that is the greate...
true
00899bc6681527a2f79b03a8fea5727a613d199a
sriley86/Python-4th
/Python Chapter 2 Sales Tax.py
1,939
4.21875
4
# Chapter2 Exercise 6 Sales Tax # This program displays the Sales tax on purchased amount # Definition of the main function def main(): # Get the purchase amount purchaseAmount = getinput() print("The amount of the purchase:", purchaseAmount) statesalestax = calstatesalestax(purchaseAmount) print(...
true
4b86009c40bf7db7bab264dda8e59da68ba1640b
Magictotal10/FMF-homework-2020spring
/homework6/pandas_exercise.py
1,264
4.25
4
import pandas as pd # Here you have to do some exercises to familiarize yourself with pandas. # Especially some basic operations based on pd.Series and pd.DataFrame # TODO: Create a Series called `ser`: # x1 1.0 # x2 -1.0 # x3 2.0 # Your code here ser = pd.Series([1.0, -1.0, 2.0],index=['x1','x2','x3']) # T...
true
5acffb9fb1eae601653914242f88d2ed5fac2fa3
lightjameslyy/python-full-stack
/basics/02-python-basics/01_python_basics/lt_08_buy_apple_2.py
205
4.21875
4
# 1. input price of apple price = float(input("price of apple per Kg: ")) # 2. input weight of apples weight = float(input("weight of apples: ")) # 3. calculate money money = weight * price print(money)
true
3e91a965e8381d5742cff08340f6a369a137ba91
AswiniSankar/OB-Python-Training
/Assignments/Day-1/p9.py
372
4.4375
4
# program to find the given two string is equal or else which is smaller and bigger string1 = input("enter the string1") string2 = input("enter the string2") if string1 == string2: print("both strings are equal") elif string1 > string2: print(string1 + " is greater " + string2 + " is smaller") else: print(...
true
f36d87c95330bca12b4d2caab7acd19336466d1e
AswiniSankar/OB-Python-Training
/Assignments/Day-5/p1.py
334
4.15625
4
# python program to calculate BMI of Argo def BMIOfArgo(weight, height): return (weight / (height * height)) age = int(input("Hai Arge, what is your Age?")) weight = float(input("What is your weight in kg ?")) height = float(input("What is your Height in meters")) print("The MBI is {:.1f}".format(BMIOfArgo(weig...
true
6a229363003fbc4d6a16a91fb9d82140c5e4c030
AswiniSankar/OB-Python-Training
/Assignments/Day-5/p2.py
806
4.28125
4
# program to find BMI status def toFindBMI(weight, height): return round(weight / (height * height), 1) def BMIstatus(BMIvalue): if BMIvalue < 18.5: print("your BMI is " + str(BMIvalue) + " which means you are underweight") elif 18.5 <= BMIvalue and BMIvalue <= 24.9: print("your BMI is " ...
true
718fab3a92812374785b62fee3e140082e83626e
vikasbaghel1001/Hactoberfest2021_projects
/CDMA-Python/gen_file.py
760
4.40625
4
'''File Generator Module''' # modify PATH variable according to the filepath you want generate files in PATH = "./textfiles/input/input" file_no = int(input('Enter Number of Files : ')) msg = input('Enter text : ') print('Length of text is {}'.format(len(msg))) def generate_files(num): '''Function fo...
true
41dd03437d4a4bddca4781687897f8fc5a4a1abf
vikasbaghel1001/Hactoberfest2021_projects
/Weight conversion using Python Tkinter.py
1,689
4.25
4
# -*- coding: utf-8 -*- """ Created on Fri Oct 8 12:27:42 2021 @author: DHIRAJ """ # Python program to create a simple GUI # weight converter using Tkinter from tkinter import * # Create a GUI window window = Tk() # Function to convert weight # given in kg to grams, pounds # and ounces de...
true
f5f565eacee20a64965707cef7501f4265c34b1d
ncaleanu/allthingspython
/advanced_func/collections.py
1,727
4.125
4
''' counter, defaultdict, ordereddict (not in this file), namedtuple, deque ''' # counter - keeps track of how many times an element appears from collections import Counter ''' device_temp = [14.0, 14.5, 15.0, 14.0, 15.0, 15.0, 15.5] temp_count = Counter(device_temp) print(temp_count) print(temp_count[...
true
3da236e3ada6bafbcef1cfe174dc337ee879fbd4
ncaleanu/allthingspython
/advanced_func/collections-exercises.py
2,617
4.5
4
from collections import defaultdict, OrderedDict, namedtuple, deque # PRACTISING WITH SOME DATA STRUCTURES FROM COLLECTIONS def task1() -> defaultdict: """ - create a `defaultdict` object, and its default value would be set to the string `Unknown`. - Add an entry with key name `Alan` and its value ...
true
768599312e43354921ef68be9e2ac25d98f03b69
MaxOvcharov/stepic_courses
/parser_csv_rss/login_validator.py
1,045
4.21875
4
""" Login validator """ import re def check_login(login): """ This function checks an login on the following conditions: 1) Check login using a regular expression; 2) Check len of login < 1 and login < 21; 3) Check the prohibited symbol in login; 4) Check login ends on latin letter...
true
5cb487213c686fb99dafa28ba059dfa438b79183
MohammedAbuMeizer/DI_Bootcamp
/Week_7/Day_2/Exercises XP #1/Exercise 2 What’s Your Favorite Book/Exercise 2 What’s Your Favorite Book .py
284
4.125
4
title = input("Enter a title of your favorite Book : ") def favorite_book(title="Alice in Wonderland"): print(f"One of my favorite books is {title}") while title == "" or title ==" ": print("You didnt type any title we will put our default") title = "Alice in Wonderland" favorite_book(title)
true
1c4d365c66a38cb35a2fee5fe6656d829888bc03
mwilso17/python_work
/files and exceptions/reading_file.py
508
4.34375
4
# Mike Wilson 22 June 2021 # This program reads the file learning_python.txt contained in this folder. filename = 'txt_files\learning_python.txt' print("--- Reading in the entire file:") with open(filename) as f: contents = f.read() print(contents) print("\n--- Looping over the lines in the file.") with open(fil...
true
77c0c93b87eacd40750c50ff1b4044ed9db38b6d
mwilso17/python_work
/OOP and classes/dice.py
1,093
4.46875
4
# Mike Wilson 22 June 2021 # This program simulates dice rolls and usues classes and methods from the # Python standard library from random import randint class Die: """Represents a die that can be rolled.""" def __init__(self, sides=6): """Initialize the die. 6 by default.""" self.sides = sides def ...
true
3bd1bc2752c36de661bea0628e1e544fa030d403
mwilso17/python_work
/functions/cars.py
412
4.25
4
# Mike Wilson 20 June 2021 # This program stores info about a car in a dictionary. def make_car(make, model, **other): """makes a dictionary for a car""" car_dictionary = { 'make': make.title(), 'model': model.title(), } for other, value in other.items(): car_dictionary[other] = value return ...
true
0e0f98ebf7b50fa048c7d6f384cf7a297ac897a9
mwilso17/python_work
/lists/lists_loops/slices/our_pizzas.py
871
4.46875
4
# Mike Wilson 8 June 2021 # This program slices from one list and adds it to another, while keeping # two seperate lists that operate independantly of one another. my_favorite_pizzas = ['pepperoni', 'deep dish', 'mushroom'] your_favorite_pizzas = my_favorite_pizzas[:] print("My favorite pizzas are: ") print(my_favori...
true
2d452ea8ecfeedd2a5c64bf6c75ffc230358f58b
mwilso17/python_work
/user input and while loops/movie_tickets.py
590
4.15625
4
# Mike Wilson 15 June 2021 # This program takes user input for age then returns the price of their movie # ticket to them. prompt = "\nWhat is your age? " prompt += "\nEnter 'quit' when you are finished." while True: age = input(prompt) if age == 'quit': break age = int(age) if age < 3: print("Your ...
true
142c6b7728d282d6d2e1e60eddb6d50cb4193f12
mwilso17/python_work
/functions/messages.py
648
4.28125
4
# Mike Wilson 20 June 2021 # This program has a list of short messages and displays them. def show_messages(messages): """print messages in list""" for message in messages: print(message) def send_messages(messages, sent_messages): """print each message and move it to sent messages""" print("\nSending al...
true
a558286ad23fad033b1a2d61fd7d3e959723c13f
mwilso17/python_work
/user input and while loops/deli.py
841
4.5
4
# Mike Wilson 17 June 2021 # This program simulates a sandwich shop that takes sandwich orders # and moves them to a list of finished sandwiches. # list for sandwich orders sandwich_orders = ['club', 'ham and swiss', 'pastrami', 'turkey', 'veggie'] # empty list for finished sandwiches finished_sandwiches = [] # the ...
true
5fdff9be03e18e4ff1c7cc64cd210e32a82e3acf
mwilso17/python_work
/user input and while loops/dream_vacation.py
674
4.34375
4
# Mike Wilson 17 June 2021 # The following program polls users about their dream vacations. # 3 prompts to be used name_prompt = "\nWhat is your name? " vacation_prompt = "If you could vacation anywhere in the world, where would you go? " next_prompt = "\nWould someone else like to take the poll? (yes/no): " # empty ...
true
17537c25a434845c6e187f034b266b03648dacc4
Trice254/alx-higher_level_programming
/0x06-python-classes/5-square.py
1,413
4.53125
5
#!/usr/bin/python3 """ Module 5-square Defines class Square with private size and public area Can access and update size Can print to stdout the square using #'s """ class Square: """ class Square definition Args: size (int): size of a side in square Functions: __init__(self, size) ...
true
429d7655eb45e48f079bdbda71dc8226a0dba108
Trice254/alx-higher_level_programming
/0x07-python-test_driven_development/5-text_indentation.py
555
4.21875
4
#!/usr/bin/python3 """ Text Indention module """ def text_indentation(text): """ print text 2 new lines after each of these characters: ., ? and : Args: text (str): text Raise TypeError: when text is not str """ if type(text) is not str: raise TypeError("tex...
true
495df61d0c1e33a0a9f167d501c471fdad9e8a83
Trice254/alx-higher_level_programming
/0x06-python-classes/4-square.py
1,192
4.625
5
#!/usr/bin/python3 """ Module 4-square Defines class Square with private size and public area Can access and update size """ class Square: """ class Square definition Args: size (int): size of a side in square Functions: __init__(self, size) size(self) size(self, value)...
true
12852a2bc16c9fc29f21c49f2fee14258cd2dcc2
Trice254/alx-higher_level_programming
/0x07-python-test_driven_development/4-print_square.py
654
4.5
4
#!/usr/bin/python3 """ Square Printer Module """ def print_square(size): """ Print square using # Args: size (int) : Size of Square Raise TypeError: if size is not int ValueError: if size is less than 0 TypeError: if size is float and less than 0 Return:...
true
9ec77aa854fa81a09b3007e3c8662f8c22c72cbe
ajjaysingh/Projects
/mybin/pre_versions/addword_v1.0.py
2,663
4.46875
4
#!/Library/Frameworks/Python.framework/Versions/3.4/bin/python3 # File Name : addword.py # Description : It adds the provided word to my custom dictionary. The new words that I learn. # Author : Ajay # Date : 2016-05-03 # Python Version : 3 #================================================== import os import s...
true
caec37b13d91ee25e2a4c8322d1d1f9035277521
Morgenrode/MIT_OCW
/ex3.py
213
4.125
4
'''Given a string containing comma-separated decimal numbers, print the sum of the numbers contained in the string.''' s = input('Enter numbers, separated by commas: ') print(sum(float(x) for x in s.split(',')))
true
fbbb1c4ec214fb01e299d4bbd3f44de9100966d6
oswalgarima/leetcode-daily
/arrays/max_prod_two_elements.py
1,334
4.21875
4
""" 1464. Maximum Product of Two Elements in an Array https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/ Given the array of integers nums, you will choose two different indices i and j of that array. Return the maximum value of (nums[i]-1)*(nums[j]-1). Example: Input: nums = [3,4,5,2] Output: ...
true
f0d0be61871f9357033bc8148e11e83edcfc28d0
oswalgarima/leetcode-daily
/arrays/max_prod_three_nums.py
681
4.125
4
""" 628. Maximum Product of Three Numbers https://leetcode.com/problems/maximum-product-of-three-numbers/ Given an integer array nums, find three numbers whose product is maximum and return the maximum product. Example: Input: nums = [1,2,3] Output: 6 Input: nums = [1,2,3,4] Output: 24 """ # Runtime: 252ms (73.64%)...
true
914f699c06f95507eba2da62deaa44aaf25519ef
limbryan/sudoku_solver
/solver.py
2,292
4.1875
4
import numpy as np import matplotlib.pyplot as plt # Takes in a position in the board and outputs if it is possible or not to put the number n inside def possible(board,x,y,n): # checks the row for i in range(len(board[0])): # exits the function straightaway if the number n already exists in the row...
true
e2c613f1f0b1a69a554fb52d7f63b7a36a395439
DavidErroll/Euler-Problems
/Problem_14.py
1,570
4.1875
4
# The following iterative sequence is defined for the set of positive integers: # n → n/2 (n is even) # n → 3n + 1 (n is odd) # Using the rule above and starting with 13, we generate the following sequence: # 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 # It can be seen that this sequence (starting at 13 and finishing...
true
de6fa700d107e662dc8fcf8b99e11cd94df60e80
CODEVELOPER1/PYTHON-FOLDER
/SECRECT_WORD_GAME.py
566
4.28125
4
#Secert Word Game with loops secert_word = "giraffe" #secert word guess = "" #stores user response guess_count = 0 guess_limit = 3 out_of_guesses = False while guess != secert_word and not(out_of_guesses): if guess_count < guess_limit: guess = input("Enter Secert Word Guess. You Only have 3 tries, Choose ...
true
4ed6dd63fd3eccf0ffebcc101885dce17354a61c
mmrubayet/python_scripts
/codecademy_problems/Wilderness_Escape.py
2,805
4.3125
4
print("Once upon a time . . .") ###### # TREENODE CLASS ###### class TreeNode: def __init__(self, story_piece): self.story_piece = story_piece self.choices = [] def add_child(self, node): self.choices.append(node) def traverse(self): story_node = self # assign story_node to self print(sto...
true
9417c401c7b1c7d47b79b381d0aaf82162266b18
mmrubayet/python_scripts
/codecademy_problems/Sorting Algorithms with python/bubble_sort.py
310
4.15625
4
from swap import * def bubble_sort(arr): for el in arr: for index in range(len(arr)-1): if arr[index] > arr[index + 1]: swap(arr, index, index + 1) ##### test statements nums = [5, 2, 9, 1, 5, 6] print("Pre-Sort: {0}".format(nums)) bubble_sort(nums) print("Post-Sort: {0}".format(nums))
true
45905e00ddeb09731899b3fb4482103e66e695d4
blakeskrable/First-Project
/First.Project.py
248
4.21875
4
number=int(input("Guess a number between 1-10: ")) while number != 10: print("Wrong! Guess Again!") number=int(input("Enter a new number: ")) if number == 10: print("Congratulations! Good Guess! You Have Completed The Program!")
true
0102e2f8ebaab1d92f6a5fa7c2ffc2d134fd96f1
ashilp/Pleth_Test
/pleth_2.py
1,082
4.125
4
import os def read_path(path): ''' Function to list out directories, subdirectories, files with proper indentation ''' #indent according to the level of the directory level = path.count("\\") print("\n************Output************\n") if not os.path.exists(path): print("...
true
75cb6dc8589bfb41f161f89bbd4d3849d2ecdc3d
jcohenp/DI_Exercises
/W4/D2/normal/ex_6.py
1,739
4.5625
5
# A movie theater charges different ticket prices depending on a person’s age. # if a person is under the age of 3, the ticket is free # if they are between 3 and 12, the ticket is $10 # and if they are over age 12, the ticket is $15 . # Apply it to a family, ask every member of the famil...
true
69a0eadad9f12debc8722949571a4ec9adca922f
jcohenp/DI_Exercises
/W4/D2/normal/ex_3 2.py
695
4.40625
4
# Recap – What is a float? What is the difference between an integer and a float? # Earlier, we tried to create a sequence of floats. Did it work? # Can you think of another way of generating a sequence of floats? # Create a list containing the sequence 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5 without hard-coding the sequence. ...
true
4d7f787e45e409ae15a01e88740f8acba4d43c45
jcohenp/DI_Exercises
/W4/D1/ninja/ex_1/ex_2.py
205
4.25
4
# Given two variables a and b that you need to define, make a program that print Hello World only if a is greater than b. a = 4 b = 6 if a > b: print("Hello World") else: print("a is too small")
true
a44bfcc01ea351adf209f4642c6dd8510410f435
ramyasinduri5110/Python
/strings.py
942
4.34375
4
#Strings in python #how we can write strings in python str1_singlequote='Hello World!' str2_doublequotes="The string declaration in double quotes" str_block=''' this is the biggest block of code with multiple lines of text ''' #type gives you the information about the data type print(type(" Hey! there I am using ...
true
562b8a5b2b3d0b2dfedc2ba890c3adbd22a57bf1
neelpopat242/audio_and_image_compression
/app/utils/images/linalg/utils.py
2,937
4.375
4
import math def print_matrix(matrix): """ Function to print a matrix """ for row in matrix: for col in row: print("%.3f" % col, end=" ") print() def rows(matrix): """ Returns the no. of rows of a matrix """ if type(matrix) != list: return 1 r...
true
b6667c81ac17100692ae20ee76abe20ac9bc9d29
NaveenLDeevi/Coursera-Python-Data-Structures
/Week#3_ProgrammingAssg_part#1.py
463
4.71875
5
# Coursera- Data structures course - Week#3. #7.1 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.You can download the sample data at #http://www.pythonlearn.com/code/...
true
d4eb39c121483d83e135c3469c31c57ce457a239
tanmay2298/The-Python-Mega-Course-Udemy
/Tkinter GUI/script1.py
746
4.4375
4
from tkinter import * # Imports everything fromt the tkinter library # Tkinter program is mainly made of two things -- Window and Widgets window = Tk() # Creates an empty window def km_to_miles(): print(e1_value.get()) miles = float(e1_value.get())*1.6 t1.insert(END, miles) b1 = Button(window, text = "Ex...
true
4b62175aefa73723e3b4a17ec1783c938df829fd
mishuvalova/Paradigm-homework
/string_task.py
1,450
4.375
4
# Given a string, if its length is at least 3, # add 'ing' to its end. # Unless it already ends in 'ing', in which case # add 'ly' instead. # If the string length is less than 3, leave it unchanged. # Return the resulting string. # # Example input: 'read' # Example output: 'reading' def verbing(s): length = len(s) ...
true
df9a29f6a9e12dffe386f1bd306fd0a23aad1e56
elentz/1st-Semester-AP
/dictproblems1.py
1,074
4.5625
5
1. Write a Python script to add key to a dictionary. Sample Dictionary : {0: 10, 1: 20} Expected Result : {0: 10, 1: 20, 2: 30} 2. Write a Python script to concatenate following dictionaries to create a new one. Sample Dictionary : dic1={1:10, 2:20} dic2={3:30, 4:40} dic3={5:50,6:60} Expected Result : {1: 10...
true
305e920c490417d773339b1f73aae7f640d31d07
SiegfredLorelle/pld-assignment2
/Assignment2_Program1.py
402
4.46875
4
"""Create a program that will ask for name, age and address. Display those details in the following format. Hi, my name is _____. I am ____ years old and I live in _____ . """ name = input("Please enter your name: ") age = int(input("Please enter your age: ")) address = input("Please enter you address: ") ...
true
cd773903e3d604d872f5b50d0bbbbe0c6e273a43
MuddCreates/FlexTracker
/flexBackend.py
488
4.125
4
import math def getPriceD(fileName): """ The function reads a text file of the price and name of each possible thing to buy. It stores each thing as in a dictionary win form {price:name of thing} It then returns the dictionary """ priceD = {} file = open(fileName,"r") ...
true
e7f3cb0d77610d3e477e83080408db869b6769e6
jannekai/project-euler
/037.py
1,750
4.125
4
import time import math start = time.time() def primes(): primes = [] n = 2 yield n n = 3 while True: # Return the found prime and append it to the primes list primes.append(n) yield n # Find the next natural number which is not divisible b...
true
9218ed1c4e3314d3838e36f5516e5880d3e81b5b
vernikagupta/Opencv-code
/Rotation.py
1,023
4.28125
4
'''Rotation of an image means rotating through an angle and we normally rotate the image by keeping the center. so, first we will calculate center of an image and then we will rotate through given angle. We can rotate by taking any point on image, more preferably center''' from __future__ import print_function ...
true
ec98c1efd4562a910b4b98129e5cf9aad5b8d7d6
ksharma377/machine-learning
/univariate-linear-regression/src/main.py
1,714
4.15625
4
""" This is the main file which builds the univariate linear regression model. Data filename: "data.csv" Data path: "../data/" The model trains on the above data and outputs the parameters and the accuracy. The number of training cycles is controlled by the variable "epochs". Input: x Parameters: w0, w1 Output: y He...
true
e293adefe3f2b90d6e447422070832b53d34685d
nishapagare97/pythone-ideal-programs
/temperature program.py
653
4.28125
4
# question no 2 # author - nisha pagare #date - 10-0-2021 # program should convert the temperature to the other unit. The conversions are # f= (9/5c+32) # c= (5/9f-32) temp = input("Input the temperature you like to convert? (e.g., 45F, 102C etc.) : ") degree = int(temp[:-1]) i_convention = temp[-1] if ...
true
19da3645aa84ba2c7cd66dda81d5dad120253115
stanmark2088/allmypythonfiles
/fahrenheit_to_c.py
954
4.59375
5
# Write a Python program to convert a temperature given in degrees Fahrenheit # to its equivalent in degrees Celsius. You can assume that T_c = (5/9) x (T_f - 32), # where T_c is the temperature in °C and T_f is the temperature in °F. Your program # should ask the user for an input value, and print the output. The inp...
true
932d7741c60da5351cdb12f7ac0ce554232d9490
CptnReef/Frequency-Counting-with-a-Hash-Table
/HashTable.py
2,690
4.375
4
from LinkedList import LinkedList class HashTable: def __init__(self, size): self.size = size self.arr = self.create_arr(size) # 1️⃣ TODO: Complete the create_arr method. # Each element of the hash table (arr) is a linked list. # This method creates an array (list) of a given size and populates eac...
true
97c0335ee71a8d46a3dbbb5ddbd2e3b36bbada6b
colingillette/number-string-puzzles
/interface.py
2,960
4.15625
4
# List Reader # Input: List # Output: none, but will print list to console one line at a time def list_reader(x): for i in range(len(x)): print(x[i]) # Fibonacci Sequence # Input: Number in return series # Output: List in series def fib(x): if x < 1: return False elif x == 1: return...
true
e29ef9d89303a36e43c0853591d8e596a1321984
rcadia/notesPython
/More Fuctions.py
457
4.21875
4
# # Tutorial - 15 # More Functions # # Ross Alejandro A. Bendal # Tuesday June 18 2013 - 5:18PM # # say = ['hey','now','brown'] print say.index('brown') # Search for index that will match in the text parameter say.insert(2,'show') # Inserts a new value. (Index.'string') print say say.pop(2) # Removes a value in inde...
true
ab4b30dcc2f00fdd64e320336bf731680fc8a646
Kenn3Th/DATA3750
/Kinematics/test.py
1,251
4.25
4
""" Handles user input from the terminal and test if it can connect with the Kinematics_class.py Also tests for forward and inverse kinematics """ import numpy as np import Kinematics_class as Kc inner_length = float(input("Length of the inner arm?\n")) outer_length = float(input("Length of the outer arm?\n")) answ...
true
2a1d0766db2123cb8120b5eb9ce958c168340edc
frizzby/coyote-leg
/week2/ex4_done.py
1,470
4.25
4
# 4. Implement a class User with attributes name, age. The instances of this class should be sortable by age by default. So sorted([User(name='Eric', age=34), User(name='Alice', age=22)]) will return a list of sorted users by their age (ASC). How would you sort those objects by name? Don't forget to Implement __str__ m...
true
55bd778ebeb9465d1be9d73d3fe65b6250125ad9
mm1618bu/Assignment1
/HW1_2.6.py
216
4.1875
4
# Ask user for a number enterNumber = input("Enter a number: ") # set inital variable to zero totalnum = 0 # for each integer, add 1 for integer in str(enterNumber): totalnum += int(integer) print(totalnum)
true
e1063970a9018300bc0d195b71ee5ae8e33b0fd5
MiguelFirmino/Login-System
/Login System.py
2,245
4.125
4
data_text = [] first_names = [] last_names = [] emails = [] passwords = [] def user_choice(): print('Hello user, create an account or login to an existing one.') choice = input('Insert "1" if you wish to create an account or "2" if you wish to login: ') print('\r') if choice == '1': ...
true
b26949e87237076f51997342f975fb3ba56ee4d6
mfahn/Python
/primeFinder.py
721
4.28125
4
#get starting value user_start = input("Enter a starting value ") #get ending value user_end = input("Enter an ending value ") increment = user_start count = 2 prime = 1 #find if each value in the range is prime or not #increment is every number between the user_start and user_end for increment in range(user_end): ...
true
4b7a16a68dcf73d62cda7e6e8b46b5c0516eef98
amariwan/csv-to-db
/csv2sql.py
1,558
4.28125
4
# Import required modules import csv import sqlite3 # Connecting to the geeks database connection = sqlite3.connect('user.db') # Creating a cursor object to execute # SQL queries on a database table cursor = connection.cursor() # Table Definition create_table = '''CREATE TABLE IF NOT EXISTS user( id ...
true
dd0337366b869db97bb9dbedfcd41a2ecb606028
SahilTara/ITI1120
/LABS/lab8-students/NyBestSellers.py
1,403
4.34375
4
def create_books_2Dlist(file_name): """(str) -> list of list of str Returns a 2D list containing books and their information from a file. The list will contain the information in the format: Publication date(YYYY-MM-DD), Title, Author, Publisher, Genre. Preconditions: each line in the file specified...
true
33d62035bdab6e284039773e0707cc017ed3b12a
Dmitry-White/CodeWars
/Python/6kyu/even_odd.py
251
4.1875
4
""" Created on Wed Aug 23 2e:28:33 2017 @author: Dmitry White """ # TODO: Create a function that takes an integer as an argument and # returns "Even" for even numbers or "Odd" for odd numbers. def even_or_odd(n): return "Even" if n%2 == 0 else "Odd"
true
bcd5e6cb8f0a48c7f61a2d4ddfddba5bf5579a03
Dmitry-White/CodeWars
/Python/6kyu/expanded_form.py
551
4.125
4
""" Created on Wed Aug 30 23:34:23 2017 @author: Dmitry White """ # TODO: You will be given a number and you will need to return it as a string in Expanded Form. # For example: # expanded_form(42), should return '40 + 2' # expanded_form(70304), should return '70000 + 300 + 4' def expanded_form(num): l = len(str...
true
3ab257aa3e0c99c106f8ae516675cd74f5253c1b
MoAbd/codedoor3.0
/templating_engine.py
1,615
4.4375
4
''' It's required to make a templating engine that takes a template and substitute the variables in it. The variables are present in the templates in the form {{some_variable}}. The variables can be nested, so for {{some_{{second_variable}}}} second_variable will be evaluated first and then the other one will be evalua...
true
ef53c04c4f7085a85906fd95c862136f40f3e1e4
dzvigelsky/Anti_Mode
/AntiMode.py
2,203
4.25
4
import time start_time = time.clock() # The clock function def main(): frequencies = {} text_file = input("What is the name of the text file you want to read? ") File_object = open(text_file, 'r') # You can put in the name of the file here lines = (File_object).readlines() # Read the file and sort...
true
b80f78ad9e4e5771e748dbe9b4dac54e39f1f044
fanj1/RobotTeamProject
/sandbox_motors_new/person3_motors.py
2,677
4.625
5
""" Functions for TURNING the robot LEFT and RIGHT. Authors: David Fisher, David Mutchler and Jun Fan. """ # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE. # DONE: 2. Implment turn_left_seconds, then the relevant part of the test function. # Test and correct as needed. # Then repeat for turn_left_by_time. # T...
true
c7ea01d08f8b054e1570ca82272c5731780fe9f9
NV230/Stock-Market
/search.py
1,012
4.125
4
# Stock Market """ @authors: Keenan, Nibodh, Shahil @Date: Feb 2021 @Version: 2.2 This program is designed to return the prices of stocks Allows the user to input the number stocks they want to compare and asks for the ticker for each stock. """ # Calculate daily change from close - previous close # yahoo finance ...
true
447f2807b9e1fe0fb10f29ace5f2957080cf6f47
chao-ji/LeetCode
/python/array/use_input_array_as_auxiliary_memory/lc27.py
2,362
4.15625
4
"""27. Remove Element Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn't matter what ...
true
3d057680982ace7ea0ab217be3c8667484f1d1f8
SACHSTech/ics2o1-livehack-2-DanDoesMusic
/problem1.py
678
4.34375
4
###this takes the 2 speeds the limit and the users speed### speed = int(input("how fast was the diver: ")) limit = int(input("what is the speed limit: ")) ###this chacks if they are above the speed limit it took me a bit but i got it working### if (speed - limit) >= 1 : print("your fine is 100$") elif (speed - lim...
true
fcbf5247a1961337748b5181a30e1d55a451e201
zar777/exercises
/chapter_one/unique_characters.py
934
4.125
4
"""Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? Exercises 1.1 """ class UniqueCharacters(object): """this class represents an empty dictionary dictionary""" def __init__(self): self.dictionary = {} def unique(self, st...
true
5fdc21c50426bbeffd1fab5e53df23c7fe218cd3
zar777/exercises
/Chapter_three/three_stacks.py
2,384
4.21875
4
"""Describe how you could use a single array to implement three stacks. Exercises 3.1 I WRONG BECAUSE I USE A LIST AND NOT AN ARRAY""" class ThreeStacks(object): """this class is created to represent an empty array which there are only two divisors used by delimited the three stacks""" def __init__(sel...
true
7f26fdf3884a01b784ac349de84b950039741d55
thedrkpenguin/CPT1110
/Week 4/list_modification4.py
248
4.21875
4
FOOD = ["Pizza", "Burgers", "Fries", "Burgers","Ribs"] print("Here is the current food menu: ") print(FOOD) FOOD_ITEM = str(input("Which item would you like to remove? ")) FOOD.remove(FOOD_ITEM) print("Here is the new food menu: ") print(FOOD)
true
727d74cf441d3d1aa62a98c6b4a2b933b9ccaee0
thedrkpenguin/CPT1110
/Week 2/largestnumberCheckFOR.py
202
4.21875
4
num = 0 max_num = 0 for i in range(4): num = int(input("Enter a value for number: ")) if num > max_num: max_num = num print("The largest number entered is ", max_num)
true
83b0b2e4b0eb8ae1db2074ee4d953198ae0eafb0
learning-dev/46-Python-Exercises-
/ex19b.py
516
4.3125
4
""" The python way of checking for a string is pangram or not """ import string def is_pangram(in_string, alphabet=string.ascii_lowercase): # function for checking pangram or not alphaset = set(alphabet) # creating a set of all lower case return alphaset <= set(in_string.lower()) # checking while True: ...
true
dd16f246a0197d5e21e965bc0e8c3e1f4b4bc158
dmoses12/python-intro
/pattern.py
929
4.25
4
def pattern(number): """Function to generate a pattern syntax: pattern(number) input: number output: symmetrical pattern of _ and * according to number provided return: 0 when complete """ print "Pattern for number: %s" % number # complete this function max_stars = 2 * number - 1 # ...
true
efce03538801ff68cee65346772dff3dd078f35f
harshalkondke/cryptography-algorithm
/Multi.py
533
4.125
4
def encrypt(text, key): result = "" for i in range(len(text)): char = text[i] if char.isupper(): mychar = ord(char) - 65 ans = (mychar * key) % 26 result += chr(ans + 65) else: mychar = ord(char) - 97 ans = (mychar * key) % 26 ...
true
7a74c15d52ff4840ea630060d12fde662cf476fc
Abraham-Lincoln-High-School-MESA/2020-2021-Python
/1.- Print statements, Variables, and Operators/2_Operators.py
2,520
4.1875
4
# 11/08/2020 @author: Giovanni B """ Operators are symbols that tell the compiler to perform certain mathematical or logical manipulations. For instance, arithmetic, comparison, boolean, etc. There are several operators, and they obviously have a precedence order, this is, the order of "importance" to decid...
true
e645d502352b2169a169e6b07b08d143ba88e794
Abraham-Lincoln-High-School-MESA/2020-2021-Python
/4.- Lists/z_Practice Problems from HW 3/0- Coffee_Machine.py
1,463
4.5
4
# Initializing variables waterPerCup = 0 milkPerCup = 0 beansPerCup = 0 costPerCup = 0 # Inputting the resources print("Enter the machine's resources") water = int(input("ml of water: ")) milk = int(input("ml of milk: ")) beans = int(input("gr of coffee beans: ")) cups = int(input("cups: ")) money = int(input("How mu...
true
e408ea0cafaad6313366c9fce5c523fbe758479c
max-zia/nand2tetris
/assembly language/multiply.py
619
4.125
4
# multiply integers a and b without multiplication def multiply(a, b): # for all n, n*0 = 0 if a == 0 or b == 0: return 0 # operate on absolute values product = abs(a) # add a to itself b times and store in product for i in range(1, abs(b)): product += abs(a) # if a or b < 0, product must be negative # if ...
true
e358a76b696ef686576b746673732144d79d23d3
sanashahin2225/ProjectEuler
/projectEuler1.py
365
4.25
4
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000. def multipleOfThreeandFive(num): sum = 0 for i in range(1,num): if i%3 == 0 or i%5 == 0: sum += i re...
true
9a7f00adcc48b8f31f768f495178aac5819f3b32
mmlakin/morsels
/count_words/count.py
483
4.28125
4
#!/usr/bin/env python3 """count.py - Take a string and return a dict of each word in the string and the number of times it appears in the string""" from string import punctuation as punctuationmarks import re def count_words(line: str) -> dict: """ Use re.findall to return a list of words with apostrophes include...
true
fedb1fb0c6cd6ec4bb814ae119317c47dae223ad
ZergOfSwarm/test
/otslegivaet_knopki_mishi22.py
1,186
4.4375
4
from tkinter import * #initialize the root window root = Tk() ############################# # 7. Click action ############################# # 1 def printHello(): print("Hello !") # Once the button is clicked, the function will be executed button_1 = Button(root, text="Click me !", command = printHello) button_...
true
8957d8156bc7f65ea0df95bab71c205aa3978262
OscarH00182/Python
/Stack.py
1,067
4.34375
4
""" Stack: This is how we create a stack, we create a simple class for it and create its functions to handle values being pass to it """ class Stack: def __init__(self):#constructor self.stack = [] #we create an array named stack to handle the stack self.size = -1 def Push(self,datavalue):#This...
true
b6fadc89174f195651271f86522c39c9d0ec444b
OscarH00182/Python
/ChapterTwo.py
2,094
4.5625
5
name = "Oscar Hernandez" print(name.title()) print("Upper Function: ",name.upper()) print("Lower Function: ",name.lower()) firstName = "Oscar" lastName = "Hernandez" fullName = firstName + " " +lastName print("Combinding Strings: ",fullName) #rstrip Function languagee = "Python " language = "Python "#Notice: "Python "...
true
9a5dd11136eb707a020db2e3dc97f0b03e91c891
jpbayonap/programs
/py_prog/decimals1.py
2,195
4.21875
4
#the objective of this programm is to compkute the division of one by a random integer given by the user #for repeated decimals the programm will print the repeated digits after reaching the first repetition from time import sleep # used for defining the intervals of time between each operation d= int(input("Input a ...
true
b0679af54f904e6f16b72b0dbe786875b55c9778
martinvedia/app-docs
/codedex/enter_pin.py
243
4.21875
4
# This program accept a correct Bank pink value 1234 print("BANK OF CODÉDEX") pin = int(input("Enter your PIN: ")) while pin != 1234: pin = int(input("Incorrect PIN. Enter your PIN again: ")) if pin == 1234: print("PIN accepted!")
true
ee31c03c140160d5ec47e21eccfa56388aa93343
Nduwal3/Python-Basics-II
/soln10.py
926
4.34375
4
# Write a function that takes camel-cased strings (i.e. ThisIsCamelCased), and converts them to snake case (i.e. this_is_camel_cased). # Modify the function by adding an argument, separator, so it will also convert to the kebab case (i.e.this-is-camel-case) as well. def snake_case_to_camel_case(camel_cased_string): ...
true
2dd2cffad194197ca43e70ed7ea2bd26a802ddf3
Nduwal3/Python-Basics-II
/soln14.py
719
4.40625
4
# Write a function that reads a CSV file. It should return a list of dictionaries, using the first row as key names, and each subsequent row as values for those keys. # For the data in the previous example it would # return: [{'name': 'George', 'address': '4312 Abbey Road', 'age': 22}, {'name': 'John', 'address': '54...
true