blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
eee3e14ebd6c8df03effc41e02b8abb0784b5f05
musflood/code-katas
/direction-reduction/dir_reduct.py
1,666
4.25
4
"""Kata: Directions Reduction. #1 Best Practices Solution by Unnamed and others opposite = {'NORTH': 'SOUTH', 'EAST': 'WEST', 'SOUTH': 'NORTH', 'WEST': 'EAST'} def dir_reduct(plan): new_plan = [] for d in plan: if new_plan and new_plan[-1] == opposite[d]: new_plan.pop() else: ...
true
ebb7e4b3143c89f27a322cd6adaf718a37115d7c
musflood/code-katas
/string-pyramid/string_pyramid.py
2,807
4.25
4
"""Kata: String Pyramid. #1 Best Practices Solution by zebulan def watch_pyramid_from_the_side(characters): if not characters: return characters width = 2 * len(characters) - 1 output = '{{:^{}}}'.format(width).format return '\n'.join(output(char * dex) for char, dex in zip...
true
f3b7fb3044363da065c2e7e85fc0efeb46eaf89e
Ifeoluwakolopin/ECX-30daysofcode-2020
/code files/Ifeoluwa_Are_day23.py
897
4.34375
4
# -*- coding: utf-8 -*- """ Created on Fri Apr 17 17:14:20 2020 @author: TheAre """ def find_Armstrong(start, end): '''This function takes in two integers indicating the start and end of an interval it returns the armstrong numbers within that interval. Note: An armstrong number is a number that is...
true
73ecc8d7a746aa750721f0fc79e3d80ea5db1098
Ifeoluwakolopin/ECX-30daysofcode-2020
/code files/Ifeoluwa_Are_day6.py
411
4.3125
4
# -*- coding: utf-8 -*- """ Created on Tue Mar 31 18:07:11 2020 @author: TheAre """ import itertools def power_list(list1: list): ''' Takes in a list and returns the corresponding power list of the list''' pow_list = [] for i in range(len(list1)+1): for j in itertools.combinations(list1...
true
55c3a23948c26489410b73cb44ee07a42a249c67
UchechiUcheAjike/programming_with_functions
/checkpoint_02_boxes.py
922
4.4375
4
#A manufacturing company needs a program that will help its employees # pack manufactured items into boxes for shipping. Write a Python # program named boxes.py that asks the user for two integers: 1) # the number of manufactured items and 2) the number of items that # the user will pack per box. Your program must...
true
67610b84cdcde5d34e0a974c544262fb7871922a
FrenchBear/Python
/Pandas/base2.py
531
4.71875
5
# Learning Pandas # 2021-03-01 PV # https://www.learndatasci.com/tutorials/python-pandas-tutorial-complete-introduction-for-beginners/ import pandas as pd data = { 'apples': [3, 2, 0, 1, 4, 3], 'oranges': [0, 3, 7, 2, 5, 0] } # Create from scratch # Each (key, value) item in data corresponds to a column ...
true
65f6092cc51de46f8dd6cabbba3594df83c11ec2
FrenchBear/Python
/Learning/107_Multiple_Constructors/a_newinit.py
680
4.375
4
# Play with Python contructors # 01 Refresher about __new__ and __init__ # # 2022-03-19 PV # A base class is object, identical to class A(object): class A: def __new__(cls): print("Creating instance of A") return super(A, cls).__new__(cls) # Should return None def __init__(self): ...
true
c40ebfa80afc506486e4818d013a524c499f7d37
FrenchBear/Python
/Learning/013_Arrays/13_Arrays.py
1,664
4.4375
4
# Arrays # Learning Python # 2015-05-03 PV # Simple array myList = [] for i in range(10): # mylist[i]=1 # IndexError: list assignment index out of range myList.append(1) myList = [i*i for i in range(10)] # Array of squares [0, ..., 81] # Creates a list containing 5 lists initialized to 0 using ...
true
fe32573df0314ce6dc03a27a607ce75fa63ca174
Som94/Python-repo
/display no of 2nd n 4th saturday in given range of date.py
908
4.125
4
""" Given two dates d1 to d2 ( both inclusive) Print all the 2nd and 4th Saturdays Count how many are there? """ import datetime print("Enter dates input format example: 8 Feb 2021") date_start_str = '20 Feb 2010' #input("Enter start date: ") date_end_str = '12 Dec 2011' # input("Enter end date: ") # convert string...
true
7ce7a8f93858d069aec1cb98d795f07c9c506a88
Som94/Python-repo
/21st july/Assignment 2.txt
506
4.25
4
''' Take several input from user as string , check wether it is palindrome or not store into a dictionary as if it is palindrome assign the value as true else assign false {'liril': True, 'abc' : False} And so on ''' def palindrome(n): for i in range(n): str1=input("Enter any String :") if st...
true
50063f065de4c19c68024ee8410f49a68456dd80
polinaya777/goit-python
/python_1/lesson_02/hw_03.py
1,089
4.34375
4
flag = True while (flag): num_1 = input('Enter number 1: ') try: num_1 = int(num_1) except ValueError: print(f"Number {num_1} is not a number") else: flag = False flag = True while (flag): num_2 = input('Enter number 2: ') try: num_2 = int(num_2) except Value...
true
45e96a7a37eb0e6c7ecf0c6779426d83266b2c00
pkoarmy/Learning-Python
/sorting/sorting.py
684
4.40625
4
# Sort in Python def sort(array): # run loops two times: one for walking through the array # and the other for comparison for i in range(len(array)): for j in range(0, len(array) - i - 1): # To sort in descending order, change > to < in this line. if array[j] > array[j + 1]: ...
true
a7bb9bd5fa9535112126b900f360f4cd1978b685
Monsteryogi/Python
/string_methods.py
308
4.4375
4
#string methods used for manuputlating the Strings word=input("Enter the string:") lenght_word=len(word) upper_case=word.upper() lower_case=word.lower() print ("Lenth of String: %s" %(lenght_word)) print ("Upper case of String: %s" %(upper_case)) print ("Lower case of String: %s" %(lower_case))
true
fc38561aab9f7a41243707c4942025990318dc08
jean957/eulerproblems
/prob12b.py
1,554
4.25
4
from math import sqrt print(''' The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triangle numbers: 1: 1 ...
true
dfe728d7e38f68704ff6a353776e948ce0802ce2
ew67/CSE
/notes/List Notes.py
2,489
4.46875
4
# Lists shopping_list = ["whole milk", "PC", "Eggs", "Trash (Xbox One)", "Other Trash (PS4)", "Batteries"] print(shopping_list) print(shopping_list[0]) print("The second thing in the list is %s" % shopping_list[1]) print("The length of the list is %d" % len(shopping_list)) # Changing Elements in a list shopping_list[0...
true
9740ad504a07c6140578cd5f74b7a71ec6c1de94
13jacole/Portfolio
/Project Euler/Problem 4/BruteForce.py
1,455
4.15625
4
# Brute Force Method #Largest possible product of two 3-digit numbers = 999*999 = 998001 --> largest palindrome beneath this is 997799 #Lowest possible product of two 3-digit numbers = 100*100 = 10000 --> smallest palindrome above this is 10001 ###METHODOLOGY### # 1) Starting at 997799, decrement until palindrome. # ...
true
84e84f247770cd75bc88abc1f0056f5e141d6607
brn016/cogs18
/18 Projects/Project_yax048_attempt_2018-12-12-10-21-46_COGS 18 Final Project/COGS 18 Final Project/my_module/while_loop.py
1,263
4.21875
4
def while_loop_answer(): """Keep reporting error if the answer is not valid""" msg = input('INPUT :\t') # Check if user's answer is valid(Yes or No) if msg == 'No': print('Thank you and have a great day!') chat = False elif msg == 'Yes': print('Okay, give me a second...'...
true
80a093d763ff33c3f45228d0db2e4ccec1c87344
xXYeetMasterXx/Py_Assignments-1
/A23.py
240
4.15625
4
def sum_three(): print ("This finds the sum of three numbers") a = int(input("Enter your first number:")) b = int(input("Enter your second number:")) c = int(input("Enter your third number:")) return (a+b+c) print(sum_three())
true
c7ba44d412a32d4e129b52794b42a32e1b4e55ea
pallavidesai/PythonDeepLearningICP
/Source/CountSentence.py
368
4.1875
4
#accepts a sentence and prints the number of letters anddigits in Sentence. string = input("Please Enter Your String") digit=0 letter=0 for count in string: if count.isdigit(): digit=digit+1 elif count.isalpha(): letter=letter+1 else: pass print("Number of Letters in Sentence", lett...
true
6715d0bcff9aa51db2facf3f40be8f562180070d
venuxvg/coding_stuff
/sortarray.py
213
4.40625
4
# python program to print the array elements in ascending order inp = int(input('How many elements you want to enter:')) arr = [] for i in range(inp): n = input() arr.append(int(n)) arr.sort() print(arr)
true
7961d302423591ffd311f55ba3c6e5bbcbeed4d1
jlunder00/blocks-world
/location.py
1,323
4.1875
4
''' Programmer: Jason Lunder Class: CPSC 323-01, Fall 2021 Project #4 - Block world 9/30/2021 Description: This is a class representing a location in the block world. It has a list of the blocks it contains, keeps track of which block is on top, and has the ability to place a given block on its stack and remove on...
true
c41ccd9bcf54dfd30c84f10fd2dea166a61c6903
digitalight/Python_Crash_Course
/042-classes2.py
2,770
4.53125
5
# Starting classes and OOP # Sun 19th April 2020 # Mike Glover class Car: """A simple attempt to represent a car.""" def __init__(self, make, model, year): """Initialize attributes to describe a car.""" self.make = make self.model = model self.year = year self.odometer_r...
true
0879773c17e20ab21a9290d05e4e3ee98cb49251
digitalight/Python_Crash_Course
/031-loadsofcats.py
202
4.15625
4
pets = ['dog', 'fish', 'cat', 'cat', 'rabbit', 'cat'] print(pets) # Use while loop and not a for loop as they can't track lists or dictionaries. while 'cat' in pets: pets.remove('cat') print(pets)
true
ff8230980f768c8291ea8f3da8306dd486bf6dfd
koichi21/lintCode
/linkedList/reverse.py
1,611
4.28125
4
#!/usr/bin/python """ Reverse a linked list. """ def main(): # create a linked list a = [1,2,3] head1 = getLinkedList(a) head2 = getLinkedList(a) # check print toList(head1) # reverse test = Solution() head1 = test.reverse(head1) print toList(head1) head2 = test.revers...
true
8c698e39fad48cc366ca6390012a9f3074858796
koichi21/lintCode
/binarySearch_sortedArray/mergeSortedArray.py
905
4.28125
4
#!/usr/bin/python """ Given two sorted integer arrays A and B, merge B into A as one sorted array. """ class Solution: """ @param A: sorted integer array A which has m elements, but size of A is m+n @param B: sorted integer array B which has n elements @return: void """ def merge...
true
0296328b041b70f1ea09cf2e72c5ec51355ae4c2
redyelruc/BoringStuff
/asterisk printer.py
983
4.4375
4
# module to validate input import pyinputplus as pyip # Dictionary containing value for each row ascending through the digits (0-2) # ( with spaces after digits so they are not all clumped together led = {'row1' : ['### ', '# ', '### '], 'row2' : ['# # ', '# ', ' # '], 'row3' : ['# # ', '# ', '...
true
757cf6122e08f1e5ca2f320d607638dd328b64ed
redyelruc/BoringStuff
/CaeserCypher.py
2,120
4.4375
4
import pyinputplus as pyip # CaeserCypher - a programme of simple encrpytion and decryption of text '''asks the user for one line of text to encrypt; asks the user for a shift value (an integer number from the range 1..25 prints out the encoded text.''' # Get the message and the code shift and validate them before ...
true
b7174c39bb28f021b0177a71b9e579ad01a37bb1
carl-parrish/codeEval
/findWriter.py2
783
4.15625
4
#!/usr/bin/python """ Find a Writer You have a set of rows with names of famous writers encoded inside. Each row is divided into 2 parts by pipe char (|). The first part has a writer's name. The second part is a "key" to generate a name. Your goal is to go through each number in the key (numbers are separated by spa...
true
c92f1554c408d57233767610ee681d65811c8596
sritasngh/programming
/HackerRank/practice_python/find_a_string.py
442
4.15625
4
##https://www.hackerrank.com/challenges/find-a-string/problem def count_substring(string, sub_string): counter=0 n=len(string)-len(sub_string) for i in range (n+1): if string.find(sub_string,i,i+len(sub_string))>=0: counter+=1 return counter if __name__ == '__main__': strin...
true
466f2eb29300c9e545ab454252f10743eddd53f9
parxhall/com404
/1-basics/4-repetition/3-nested-loop/1-nested/bot.py
254
4.1875
4
#input row = int(input("how many rows should i have?\n")) column = int(input("how many coulmns should i have?\n")) #for for count in range(0,row,1): for count in range(0,column,1): print(":-)", end="") print("") #finish print("Done!")
true
87dcb8b247d209eb1054917bf5cf7c9ddfcd083e
parxhall/com404
/1-basics/3-decision/03-if-elif-else/bot.py
523
4.1875
4
#ask for input paint = input("Towards which direction should I paint (up, down, left or right)?\n") #if statement if paint == "up": print("I am painting in the upward direction!\n") #else if statements elif paint == ("down"): print("I am painting in the downward direction!\n") elif paint == ("left"): print(...
true
591f0a9cd226ff94e4feea95dec3e2768abe7b8e
AshayFernandes/PythonPrograms
/Assignment/assignment1.py
1,645
4.15625
4
# -*- coding: utf-8 -*- """ Created on Thu Sep 5 17:56:53 2019 @author: Ashay Fernandes """ """<q> Create a list and do the following manipulation 1> Find the length of the list 2>Create a new list as an element of an existing list 3>use the slice Operator 4>Replace the second element of the list with a...
true
57d8912687ccae9e6b73cc49b95dba48a718620d
morris-necc/assignments
/Week7/JCassignment.py
2,370
4.34375
4
from __future__ import annotations #for the :Car typing, this apparently won't be necessary in Python 3.10 class Company: def __init__(self, name: str, cars: list): """ name: prints the name of the company cars: a list of 'Car' objects that this company manufactures """ self...
true
5dbd45475c7408103adef7870d7f840525d4ecd8
MilapPrajapati70/AkashTechnolabs-Internship
/day 4/task 1 (4).py
593
4.28125
4
# 1. Create a class cal1 that will calculate sum of three numbers. # Create setdata() method which has three parameters that contain numbers. # Create display() method that will calculate sum and display sum. class myclass: def setdata(self,n1,n2,n3): self.n1=n1 self.n2=n2 ...
true
ca594a7d1aecdcfe3f0abd307879e51a760c4f6e
Aniketthani/Python-Tkinter-Tutorial-With-Begginer-Level-Projects
/3grid.py
244
4.3125
4
from tkinter import * root=Tk() #Creating a Label Widget mylabel1=Label(root,text="Hello World") mylabel2=Label(root,text="Hi This is Tkinter") #showing it on screen mylabel1.grid(row=0,column=0) mylabel2.grid(row=3,column=3) root.mainloop()
true
e13507bd91d0478fa5170214daef004e7d567d2c
GarethAn/LeetCode
/No575_Distribute Candies/Python_Solution.py
1,340
4.1875
4
# -*- coding: utf-8 -*- # Renyi Hou. 23/6/2017 题目: Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute these candies equally in number to brother and sister. Return the maxi...
true
76813266c3c4b73bd2f167b312a0c46bd7f11a28
omaskery/yellow-lama
/material/conceptual/exercises/comparison.py
1,275
4.1875
4
#!/usr/bin/python import unittest # # This example involves writing a simple 'comparison' function # # The input will be two integers, a and b # If a is greater than b, the output should be "greater" # If a is less than b, the output should be "lesser" # If a is equal to b, the output should be "equal" # def compare...
true
3d52ecf60924f61ebc963ca04aa462b8345e8c9e
YellowDust/Projects
/Solutions/prime_factor.py
609
4.3125
4
"""Prime Factorization - Have the user enter a number and find all Prime Factors (if there are any) and display them.""" #Check if the number is prime. def is_prime(n): if n % 2 == 0: return False for i in range(3, int(n**0.5) + 1, 2): if n % i == 0: return False return True input = int(raw_input("Enter a ...
true
113783d42b3836722d6d49d4ea7be02140abf0a4
fengxia41103/myblog
/content/downloads/euler/p4.py
762
4.25
4
# -*- coding: utf-8 -*- """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_palindromic(n): """Test n to be palindromic numb...
true
881657859f1ba39f3ead2a37ff25d54ccf6792ef
DarrenVictoriano/Python-Mastery
/Data_Structures/Singly_LinkedList/simple_singly_list.py
1,429
4.25
4
""" This is a simple singly linked list implementation from the book Elements of Programming Interview in Python. """ class ListNode: """ simple singly list self.data = data self.next = ListNode() """ def __init__(self, data=0, next_node=None): self.data = data self.next = nex...
true
fc859aa037ccb3206f4ced07d6397179899a68eb
sangeetameena580/Algo-DS
/Python/Misc/reverse_integer.py
822
4.3125
4
# Python Program to Reverse a Number using Functions def Reverse_Integer(num): rev = 0 sign = 1 if num < 0: num = -num sign = -1 while(num > 0): rem = num %10 rev = (rev *10) + rem num = num //10 return rev*sign num = int(input("Please Enter any Number: ")) ...
true
b4d65cdefd0cf5eabd1a7446bcab010029a97227
kaistreet/python-text-manipulation
/palindrome_checker.py
784
4.53125
5
""" This script checks if a string is a palindrome. Author: Kai Street Date: 22 September 2019 """ def reverse(palindrome_checker): """ This function reverses a string and returns reversed string Author: Kai Street Date: 22 September 2019 Parameter palindrome_checker: a string to reverse Precondition: palind...
true
2a9655b037f4221066dc559bb2258e53f82deaf6
lfamarantine/Baruch-CIS-2300
/assignments/homework_4.py
2,436
4.34375
4
""" Write a program that asks the user to enter the number of hours they worked for in a given week. Number of hours entered should be in the range of 0 to 60. Also ask user to enter their pay rate. It should be a positive value above minimum wage (Assume minimum wage of $15). Your program should ask user to re-enter t...
true
606347a6cd7bb473379ed8e400c51c7c9eebdf4a
AndrewMatos/Random-Python-code
/car_class.py
1,389
4.3125
4
class Car: """A simple attempt to represent a car.""" def __init__(self, maker, model, year): """ Initialize attributes that describe a car """ self.maker= maker self.model= model self.year= year self.odometer_reading = 0 def get_descriptive_name(self): """ return a neatly formate descriptive name. """...
true
f713cd35248786f079e472e1c8115b363ed27a20
RohanPatil1/Programming_Problems_Solutions
/Basic Recursion/x_to_the_power_ n.py
238
4.1875
4
""" Write a program to find x to the power n (i.e. x^n). Take x and n from the user. You need to return the answer. Do this recursively. """ def power(x,n): if (n==1): return 1 return x*power(x,n-1) print power(2,5)
true
ffc466ff535b629ec05cf28615818378d0a9e8fb
BilalAhmedim/learn-python
/list/list_and_method.py
793
4.21875
4
# Declare Empty List list = ['0','1', '35', '449', '0'] # insert Method list.insert(0,'2') # insert 2 at location of 0 in the list # Modify list list[0] = '1' # insert item using append method at the last of the list # apppend metho use to add item at end of the list list.append('2') # delete item usin...
true
9db683d8b067434b88efd33b4bffcc4dda485d6e
JasonPBurke/Intro-to-Python-class
/Lab_7/Jason_Burke_Lab7b.py
1,929
4.375
4
# This program allows you to input and save student # names to a file #set a constant for the number of students student_no = 12 def main(): #create an empty list students = [] #create an accumulator and prime the while loop count = 0 #get the user to add students to the list if they ...
true
4480a541fb8e77509eb16de5983cda2b8a17bb6d
JasonPBurke/Intro-to-Python-class
/Lab_8/Jason_Burke_Lab8b.py
2,217
4.6875
5
# This program will allow a user to enter a date in # numeric format. It will test the month, day, and # year and have the user correct if errors are found. # It will then output the date in long date format. # Import the calander module to assist with renaming # months entered by the user. import calendar def main(...
true
43f62555fd78c01351a434309368a3a6121509a4
sindredl/temp
/temp/mystuff/33-sim.py
769
4.1875
4
# -*- coding: utf-8 -*- numbers = [] def looping(number, increment): i = 0 while i < number: print "At the top i is %d" % i numbers.append(i) i = i + increment print "Numbers now: ", numbers print "At the bottom i...
true
671d3ba572e8b16bb873239f61c61f556171342f
Ilya-Merkulov/ProjectEuler
/problem_1.py
647
4.28125
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. """ # my first result def multiples(a, b): sum = 0 for i in range(1, 1000): if i % a == 0 or i % b == 0: ...
true
cfc3af19e0fcb8f3da09e352057c238ee26d48bc
jc451073/workshops
/Prac02/ASCII.py
241
4.15625
4
lower = 10 upper = 100 print("Enter a number (" + str(lower) + "-" + str(upper) + "):") str = "Enter a number {} - {}:".format(lower, upper) print(str) for i in range(lower, upper): print("ASCII code for {} char is {}".format(i, chr(i)))
true
24e0e3d6cc783635f5b265966406441feec11d15
kburchfiel/cdfcurve
/cdfplot.py
1,674
4.1875
4
#Program for plotting both the normal distribution and its corresponding cumulative density function #Helpful references included: #http://home.ustc.edu.cn/~lipai/auto_examples/plot_exp.html #https://courses.csail.mit.edu/6.867/wiki/images/3/3f/Plot-python.pdf #https://matplotlib.org/tutorials/introductory/pyplot.html...
true
246b8c45ddb3440c4ca86e91939a391aaa41bf47
WhosGotFrost/ATOM_DEV
/python/calulator.py
687
4.4375
4
#A simple calulator #try catch will catch an error if number or number2 is not a number try: number = int(input('Enter first number: ')); number2 = int(input('Enter second number: ')); operator = input("Enter a operator: "); #checks if the users added a valid operator. if(operator == "+"): pri...
true
8fa937db9b2277aadfa63d09681d282c28022248
bryandngo/PFB2017_problemsets
/elifpython.py
365
4.15625
4
#!/usr/bin/env python3 count = 20 if count < 0: message = "is less than 0" print(count, message) elif count < 20: message = "is less than 20" print(count, message) elif count > 20: message = "is greater than 20" print(count, message) elif count != 20: message = "NOT TRUE" print(count, message) else: ...
true
6b78dd87374d09e7f8639111d2581ee826f81582
Evilzlegend/Structured-Programming-Logic
/Chapter 07 - File Handling and Applications/Coding Snippets/Python/Reading Text with the read Method.py
1,417
4.6875
5
# TOPIC SUMMARY: # Once a file is opened for reading, we can get all the text from it in one # step using the file object's "read" method. This method reads the whole # file in one step. Once the text is read from a file, it is just a long string, # and Python's string manipulation tools may be applied to it. # ...
true
a24f595dbf3e0afdcae9891cad266e7747116ed7
Evilzlegend/Structured-Programming-Logic
/Chapter 07 - File Handling and Applications/Instructor Demos/read_emp_records.py
833
4.15625
4
# This program displays the records that are # in the employees.txt file. # Open the employees.txt file. empFile = open("employees.txt", 'r') # Read the first line from the file, which is # the name field of the first record. name = empFile.readline() # If a field was read, continue processing. while name...
true
deb9147894d3e9e261076ed1d30e973e0d7f5de7
Evilzlegend/Structured-Programming-Logic
/Chapter 02 - Elements of High Quality Programs/Coding Snippets/Python Codes/Strings in Python.py
1,526
4.5
4
# Topic Summary: # A string is a piece of text that is data in a program. In Python, # you can use single quotes or double quotes to mark the boundaries # of a string, so long as you use the same symbol at start and end: # 'a simple string', "another string" # TOPIC EXPLANATION: # Inside a string you can put an...
true
1dcdfba0c9fea904e2fba364e7e25f72b35e4d3f
Evilzlegend/Structured-Programming-Logic
/Chapter 06 - Arrays/Mindtap Assignments/List Basics in Python.py
2,368
4.53125
5
# SUMMARY # In this lab, you complete a partially prewritten Python program that uses a list. # The program prompts the user to interactively enter eight batting averages, which the pgoram # stores in an array. It should then find the minimum and maximum batting averages stored in the # array, as well as the aver...
true
c5d7058c8a4059ea04286c2f81112c868a1e5f89
Evilzlegend/Structured-Programming-Logic
/Chapter 10 - Object-Oriented Programming/D2L Assignments/joshua_tiemens_CH10PE1.py
2,657
4.3125
4
# importing the class wages to import wages # defining the main function here. def main(): # Disclaimer of what the program does. print("The program will create a class storing an employees name and calculates weekly pay for the employee.") print() # Initializer to start the class engagement...
true
e95249b190c21316fb2fbc093819c26174ae73eb
Evilzlegend/Structured-Programming-Logic
/Chapter 06 - Arrays/D2L Assignments/joshua_tiemens_CH6PE2.py
1,937
4.3125
4
# Explain what the program does. print("") # Break to display a clean presentation. print("This program will take a user supplied series of numbers and provide the Low, High, Total, and Average of the numbers input.") print("") # Break to display a clean presentation. # Declarations notQuit = "Y" numCount = [] ...
true
acf6eb3f92acad7428210099fc4921fd898aed27
Evilzlegend/Structured-Programming-Logic
/Chapter 09 - Advanced Modularization Techniques/MindTap Assignments/Passing Lists to Functions.py
1,348
4.6875
5
""" Passing Lists to Functions Summary In this lab, you complete a partially written Python program that reverses the order of five numbers stored in a list. The program should first print the five numbers stored in the array. Next, the program passes the array to a function where the numbers are reversed. Fina...
true
e5635433b38bc930e7d170d1e4ed483d19e7fedd
Evilzlegend/Structured-Programming-Logic
/Chapter 09 - Advanced Modularization Techniques/MindTap Assignments/Writing Functions that Return a Value.py
1,675
4.375
4
""" Writing Functions that Return a Value Summary In this lab, you complete a partially written Python program that includes a function that returns a value. The program is a simple calculator that prompts the user for two numbers and an operator ( +, -, *, or / ). The two numbers and the operator are passed to...
true
29f514a870e85f54f02384c1eaf6b4dfc607ef8c
Evilzlegend/Structured-Programming-Logic
/Chapter 02 - Elements of High Quality Programs/Coding Snippets/Python Codes/Arithmetic Shortcuts for Updating Variables.py
1,264
4.59375
5
# TOPIC SUMMARY: # We often update the value of a variable by applying some arithmetic operation to its old value. The # simplest case of this is incrementing or decrementing the value of a variable. Python provides a special # assignment operation to make incrementing and shorter to write. Instead of writing x = x ...
true
6d39b9d412c6ac361b84e688ba939735502d7f66
Ayesha116/official.assigment
/ques42.py
259
4.1875
4
n = int(input("enter no of rows: ")) for rows in range(1, n+1): for columns in range (1 , rows+1): print(columns, end = "") print() for rows in range(n, 0, 1): for columns in range (rows-1,0,1): print(columns, end = "") print()
true
c7e63f0779360106e8178017dee9bc97b270477c
mikeplimo/finalproject17
/day32rocket.py
953
4.375
4
from math import sqrt class Rocket(): # Rocket simulates a rocket ship for a game, # or a physics simulation. def __init__(self, x=0, y=0): # Each rocket has an (x,y) position. self.x = x self.y = y def move_rocket(self, x_increment=0, y_increment=1): # Move the rocke...
true
f8028a5f18f1fc7b3cf4e6bff38b1a4a90e29226
VaibhavEng/PYTHON-CODES
/curd using list project +++++++++++++++++++++++++++++++.py
2,337
4.15625
4
student_name=[] while True: print("""select a option form the below menu: 1.Inserting one name 2.Inserting multiple names 3.Updating an exisiting name 4.deleting a name 5.view all the names 6.quit the program""") ch = int(input("enter your choice:")) if ch==1: #pass means nothing / there ...
true
73a3555b40047afa7c831d08259ae7da918c81b7
190599/ITP
/Chocolate machine.py
1,233
4.15625
4
#Enter the Price of the Chocolate bar) vPrice=float(input("Please enter the price of the chocolate you want:")) print(vPrice) #Enter the Cash to pay for hte chocolate vCash=float(input("Please enter the cash of the chocolate you want:")) print(vCash) ##Calculat the Change DUe vChangeDue=vPrice-vCash vChangeGiven=roun...
true
826b097b15c73e156b264044e395178e1ec38d39
nmazzilli3/Intro_to_Self_Driving_Cars_Nanodegree
/Vehicle_Motion_Control/lesson2/int_acc_data.py
2,115
4.125
4
''' What to Remember Once again, don't try to memorize this code! The key thing to remember is this: An integral accumulates change by calculating the area of lots of little rectangles and summing them up. ''' from helpers import process_data, get_derivative_from_data from matplotlib import pyplot as plt PARALLEL_PA...
true
9e025c24d6aa536a3aaa130cc8b47cfbfc41929e
chihyuchin/SC-projects
/SC-projects/weather_master/weather_master.py
1,472
4.375
4
""" File: weather_master.py ----------------------- This program should implement a console program that asks weather data from user to compute the average, highest, lowest, cold days among the inputs. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ # Type this number to st...
true
f2f959acff77d888078a28b430b00dde9b58697a
alwinmreji/ROS-and-ML
/Assingment_#1/#8_largest_among_three.py
343
4.375
4
###################################################### #Find largest among three print("Largest value ",max(int(input("Enter the first number: ")),int(input("Enter the second number: ")),int(input("Enter the third number: ")))) # OUPUT: # Enter the first number: 1 # Enter the second number: 6 # Enter the third number...
true
345d8324e1fa0d1541e86f27ae92275d2aaf79c3
alwinmreji/ROS-and-ML
/Assingment_#2/#1_max_outof_two.py
270
4.125
4
def maximum(x,y): if x>y: return x else: return y x = float(input("Enter first variable:\t")) y = float(input("Enter second variable:\t")) print("Greatest is ",maximum(x,y)) # OUTPUT # Enter first variable: 4 # Enter second variable: 5 # Greatest is 5.0
true
fdc907963bb826fdcdbd01693ec53ba97fe8b65c
alwinmreji/ROS-and-ML
/Assingment_#1/#9_smallest_in_list.py
302
4.15625
4
##################################################### #Find the smallest in the list a = int(input("Enter the number of terms:\t")) lst = [] while(a): lst.append(int(input())) a-=1 print("Minimum value",min(lst)) # OUTPUT: # Enter the number of terms: 5 # 3 # 2 # 8 # 6 # 1 # Minimum value 1
true
394d7439a3f6e992d32cf5f16bf65899bfbee3d1
udayreddy026/pdemo_Python
/logical_aptitude/08-04-2021/Palindrome.py
430
4.15625
4
num = int(input("Enter a number:::")) temp = num res = 0 while num > 0: l_num = num % 10 # Getting Last number from user entered number its remainder num = num // 10 # Getting coefficient of number will become it means except last number remaining number will # stored in num res = (res*10)+l_num #print(r...
true
853d13a6160712656d249958dc1d8e9b82d9dce5
duncanmichel/Programming-Problem-Solutions
/LeetCode/NumberOneBits.py
1,684
4.40625
4
""" Write a function that takes an unsigned integer and return the number of '1' bits it has (also known as the Hamming weight). Example 1: Input: 00000000000000000000000000001011 Output: 3 Explanation: The input binary string 00000000000000000000000000001011 has a total of three '1' bits. Example 2: Input: 00000000000...
true
65612bb67a0b106453dc7b4d4a9a9593426f70d4
pritamksahoo/III-IV-YEAR-Assignments
/BIO/triplets.py
1,143
4.125
4
no_char, pair = 4, 3 dict_char = {'a':0, 'c':1, 'g':2, 't':3} class Triplet(object): ''' Trie data structure to store triplets and their frequencies ''' def __init__(self): super(Triplet, self).__init__() self.freq = 0 self.children = [None for i in range(no_char)] def add_to_suffix_tree(triplet, part):...
true
9ec46eed13310d3a71be627e182d7d526313d2fa
em55/Python-exercises
/eight12.py
501
4.53125
5
"""This program takes a word and encrypts it usgin the ROTn method rotating the letters of the word n times""" #must be modified to rotate only alphabets, now it rotates among all ascii characters def rotate_word(s, n): char = "abcdefghijklmnopqrstuvwxyz" a = '' for c in s: a += char[(char.index(c)+n) % 26 ] ret...
true
75ead60db9b7143f0a933fd20babeeca554cf1f4
em55/Python-exercises
/six2.py
290
4.15625
4
import math def hypo(a,b): c = math.sqrt(a**2+b**2) return c side_a = int(raw_input("Enter the length of side a of the triangle: ")) side_b = int(raw_input("Enter the length of side b of the triangle: ")) print "The hypotenuse of the right triangle is of length:", hypo(side_a, side_b)
true
fa860381fccfa267ece78f4fc2ec7edc8ca79be8
godinenbicicleta/IntroComputation
/SimpleAlgorithms/exhaustiveEnumeration.py
1,102
4.125
4
# -*- coding: utf-8 -*- # find the cube root of a perfect cube x = int(input('Enter an integer: ')) ans = 0 while ans**3 - abs(x) < 0: #this is de decrementing function ans = ans + 1 if ans**3 != abs(x): print( x, 'is not a perfect cube') else: if x < 0: ans *=-1 print( f'Cube root of {x} ...
true
da8c9fd68bc9ff81d934c94b63aaa31665b64674
jan-wo/data-cheatsheet
/pandas_missing_data.py
896
4.1875
4
""" This is small tutorial about what to do with the missing data. """ import pandas as pd import numpy as np # Fake data with missing values data = {'a': [1, 2, np.nan], 'b': [4, np.nan, np.nan], 'c': [3, 2, 1]} # Data frame: df = pd.DataFrame(data) # ------------------------ Dropping rows/columns -----------...
true
d53e50a5abb31e42a4ec079f82399f68028a3862
purvesh-patel/HackerRank
/printString.py
344
4.34375
4
# The included code stub will read an integer,n from STDIN. # # Without using any string methods, try to print the following: # 1234...n # Note that "..." represents the consecutive values in between. # # Example n = 5 # Print the string 12345. n = 5 string ="" for i in range(1,n+1): #print(i) string = string...
true
33403bd7ba0a7203ced5d88e8c660a91d5971e12
league-python-student/level1-module4-ezgi-b
/_01_dictionaries/_a_dictionaries_demo.py
2,696
4.625
5
""" Demonstration of dictionaries """ # Dictionaries are data structures that hold pairs of items. For example: # p_table = {1 : 'Hydrogen', 2 : 'Helium', 3 : 'Lithium', 4 : 'Beryllium'} # # The dictionary p_table contains 4 pairs of items, separated by commas, with # the first one being 1 : 'Hydrogen'. # The first ...
true
571844d871608fee02b41c6ab3a6fe5451b50554
shanjidakamal/csci127-assignments
/hw_05/hw_05.py
1,416
4.25
4
'''Write a function filterodd(l) that takes in a list and returns a new list that consists of only the odd numbers from the original list. That is the list [1,2,3,4,5,6,7,8] would return a new list [1,3,5,7]. The lists don't have to be in order.''' l=[1,2,3,4,5,6,7,8,9,10,11,12] def filterodd(l): newlist=[] f...
true
cb86e69bca028a95afc36491a1d75aaf522639e3
nicolecpeoples/python-basics
/assignments/grades.py
459
4.125
4
count=10 while count > 0: print "What is your grade?" grade = raw_input() if grade >= "90": print "Score: " , grade, "; Your grade is a A" elif grade >= "80": print "Score: " , grade, "; Your grade is a B" elif grade >= "70": print "Score: " , grade, "; Your grade is a C" elif grade >= "60": print "...
true
eb63bba945e75b3d1d897fb37b9ecc3b705b7829
claraj/web-autograder
/grading_module/example_assignments/example_python_assignment/lab_questions/q3_which_number_is_larger.py
787
4.40625
4
# Question 1: if-else in a function. Which number is larger? def main(): # You don't need to modify this function. a = input('Enter one number: ') b = input('Enter another number: ') compare = which_number_is_larger(a, b) if compare == 'same': print('The two numbers are the same') ...
true
c30dfd8de5ecd8153fdbcca2ec7183e74c92a1ab
claraj/web-autograder
/grading_module/example_assignments/example_python_assignment/lab_questions/Loop2fun.py
2,015
4.21875
4
""" NOTE Chapter 3 lab (Lab 6) & Homework assignments are redesigns of previous programs, to follow the new IPO structure.​ Use the code from the Loop-2 program from last time You will create functions called main(), inputNumbers(), processing(), and outputAnswer(). The old program and new program will have a simila...
true
630afbcab875ba20023877706a42d4e70fd09315
nileshhadalgi016/python3
/For loop in python.py
834
4.25
4
""" Python For Loops - Techie Programmer A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string). """ # Looping Through a String for x in "banana": print(x) # The break Statement fruits = ["apple", "banana", "cherry"] for x...
true
25b76979d4c22ea67555610bb4f64dc8f713d8f8
Sevansu/Python-Tasks-Basic-to-Advance
/Task 2/task_2_01_A.py
1,151
4.15625
4
#1. Create two python files. say 'task_2_01_A.py' and 'task_2_01_B.py'. Create a class in the 'task_2_01_A.py' having some attributes and functions and constructor defined in the class. Create a method outside that class in the file 'task_2_01_A.py'. Use that class and its attributes and mehtods and the method that is ...
true
6d3bbf1614e30f76dcbe63a9091b78e635e6fbc3
AlexPolGit/Python-Projects
/strings_test.py
623
4.5625
5
#strings_test.py #Testing out string functions Python string = "python is a programming language" print "\nOriginal string:" print string print "\nAs a sentence:" print string.capitalize() + "!" print "\nLength of string:" print len(string) print "\nNumber of g's: " print string.count("g") print "\nIs alphabetic?...
true
015964ff2101192be30278b7e38b9e8e6254c937
kulvirvirk/Python_Number
/main.py
770
4.125
4
#declare some math variables x = 6 y = 2.2 print('x = 6 \ny = 2.2\n') #perform some math functions sum = x + y; print('sum is: ' + str(sum)) substraciton = x - y print('difference is: ' + str(substraciton)) multiplication = x * y print('multiplication is: {:0.2f}'.format( multiplication)) # output is formated #...
true
cfa75fa7477dcd832853b4a34a13d889c8f708ce
QLGQ/learning-python
/prime.py
1,139
4.21875
4
#-*-coding:utf-8-*- #Set a condition for exiting the loop def main(maximum=1000): pr = primes(maximum) for n in pr: if n < maximum: print(n) else: break #Construct a sequence of odd numbers starting from 3 def _odd_iter(maximum): n = 1 while n < maximum: ...
true
9f580eff78dd811bae154193b94535881327d541
PunjabiTadka/FIT1008_Assignment1
/29202515_Assessment1/Task4_A.py
2,469
4.375
4
""" @author: Amrita Kaur @since: 16/3/2018 @modified: 17/3/2018 """ def populateList(size): """ This function takes in the size as an argument, and accepts 'size' number of inputs from the user, stores them in a list and returns it @:param size: The number of inputs to accept fro...
true
d629ec1ddb5e77cb43a491ab39e285928d659a23
taarunsinggh/class-work
/33.py
682
4.34375
4
#3-3. Your Own List: Think of your favorite mode of transportation, such as a #motorcycle or a car, and make a list that stores several examples. Use your list #to print a series of statements about these items, such as “I would like to own a #Honda motorcycle.” transport=['bus','motorcycle','scooter','train','flight...
true
7f579387832a0fe9dc55fdfa1e0651560d3710d7
taarunsinggh/class-work
/31.py
289
4.34375
4
#Names: Store the names of a few of your friends in a list called names. Print #each person’s name by accessing each element in the list, one at a time. names=['Vibhor','Deven','Mohit','Rajbeer','Swapnil'] print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4])
true
c7a2dd3611c38269715fd6fce7459bb2e6b46e5b
daniloiiveroy/MyPythonTraining
/02-list_tuple_set/app.py
2,989
4.125
4
# from typing_extensions import TypeVarTuple courses = ["History", "Math", "Physics", "CompSci"] print(courses) # List print(courses[2]) # Specific course via index print(courses[-1]) # Last item print(courses[0:2]) # List of items print(courses[2:]) # List of items # Append function courses.append("Art I") pr...
true
7d31ad86b378446d2397312cfec27c90e9aebf9f
fadikoubaa19/holbertonschool-higher_level_programming
/0x0B-python-input_output/4-append_write.py
235
4.15625
4
#!/usr/bin/python3 """ module that contains the append write""" def append_write(filename="", text=""): """ appends a string to end of txt file""" with open(filename, 'a', encoding='utf-8') as f: return f.write(text)
true
bdc0c9be95f2bc224281624a42fa6347abf4c7ff
MapleDa/Python
/topic13_files_io.py
1,241
4.15625
4
#T13Q1 #The open method returns a file object. Syntax: open(name[, mode]). where mode #can be 'r' (read), 'w'(write) or 'a'(append). The default mode is 'r'.The #close method closes an opened file object. filename = 'tmp.txt' mode = 'w' f = open(filename, mode) # open a file f.write('hello') # write t...
true
95c8cd2f0e63aab72f9862fc611ca54ed30970ce
dansmyers/IntroToCS
/Examples/2-Conditional_Execution/is_positive.py
222
4.28125
4
""" Test if an input number is positive, negative, or zero """ value = int(input('Type a number.')) if value > 0: print('Positive.') elif value < 0: print('Negative.' else: print('Zero.') print('Done.')
true
c61c8f95784a8ac91a1a85f0e6b12b8552d2cc03
alosoft/bank_app
/bank_class.py
2,453
4.3125
4
"""Contains all Class methods and functions and their implementation""" import random def account_number(): """generates account number""" num = '300126' for _ in range(7): num += str(random.randint(0, 9)) return int(num) def make_dict(string, integer): """makes a dictionary of Account N...
true
c333d408b37574b13a5f92fb68825e4725ac223e
samdish7/COSC420
/Notes/Py/pyfuncs.py
1,104
4.25
4
# Python functions are defined with the # "def" keyword, then the name, list of # parameters, then a colon. # note that functions do not have # return types, and parameters do not # have types (but you can provide them # anyway) # scopes in python are delineated not by # curly braces (as in c/c++) but by tabs # you ca...
true
6fd3b644ed043a8b288065be615f638f9436e8b0
awlange/project_euler
/python/p72.py
1,834
4.1875
4
import time from p27 import get_primes_up_to def farey(n): """ Thanks for the help Wikipedia! Python function to print the nth Farey sequence, either ascending or descending. """ a, b, c, d = 0, 1, 1, n print "%d/%d" % (a,b) while c <= n: k = int((n + b)/d) a, b, c, d = c,...
true