blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
ca82fd8d846dcc3e569e0440c21a3e49ff9b35e6
lgope/python-world
/crash-course-on-python/week-4/video_exercise_dictionary.py
1,474
4.375
4
# The "toc" dictionary represents the table of contents for a book. Fill in the blanks to do the following: 1) Add an entry for Epilogue on page 39. 2) Change the page number for Chapter 3 to 24. 3) Display the new dictionary contents. 4) Display True if there is Chapter 5, False if there isn't. toc = {"Introduction":...
true
0dcd9fb38728ea5f8cf73c0650a4a0090d364781
ardus-uk/consequences
/p2.py
2,029
4.4375
4
#!/usr/bin/python """ Some examples of using lists """ # Author: Peter Normington # Last revision: 2013-11-18 example_number = 0 # The following is used to divide the sections of output print "--------------------------------------------\n" with open('./datafiles/Consequences', 'r') as f: # f is a file handle. # ...
true
6b74455e85c5d3c0b9cd7fa3d32f9e52dbf3ed47
AlAaraaf/leetcodelog
/offer/offer24.py
863
4.1875
4
""" 定义一个函数,输入一个链表的头节点,反转该链表并输出反转后链表的头节点。 """ from util import createListNode, printListNodes # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseList(self, head: ListNode) -> ListNode: if head == None: ...
false
f0c79b529e1f66b89f5c55859926cb724d249871
tayyabmalik4/MatplotlibWithTayyab
/2_line_plot_matplotlib.py
663
4.5
4
# (2)*************line plot in matplotlib************* # ///////to show the graphical line plot than we use line plot function in matplotlib # ////import matplotlib import matplotlib.pyplot as plt days =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] tem=[36.6,37,37.7,39,40,36.8,43,44,45,45.5,40,44,34,47,46] # //////start t...
true
2234f9ba4e9cda121f2687d48597af84fc34a325
seshgirik/python-practice
/class_emp.py
811
4.125
4
class Employee(): raise1 = 10 def __init__(self, name, age): self.name = name self.age = age def increment(self): print(f'increment is percentage {self.raise1}') # to access class variable we should use either class name or class instance rama = Employee('rama', 10) rama.increme...
true
e7c0dd843e7796e421ea851be0f68da63ead1a7a
seshgirik/python-practice
/.ipynb_checkpoints/super2.py
833
4.15625
4
# # class A: # # classvar1 = 'class variable' # # def __init__(self): # # self.classvar1 = 'instance variable in class A' # pass # # class B(A): # classvar1 = 'instance variable in class B' # pass # # a= A() # b= B() # # print(b.classvar1) # class A: classvar1 = 'class variable' ...
false
d8c92b2103349901d28d57889043b362919ed592
dimashtasybekov/algorithms-and-data-structure
/Stack.py
582
4.125
4
class Stack: def __init__(self) : self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[self.size()-1] def size(self): retur...
false
b2d62e50e037afeab6ba538f8caad7bb209f2195
LeeRHuang/PythonSprider
/Baseic/Function.py
1,085
4.1875
4
def sayHello(): print 'It\'s a simple function!' def getMax(a,b): if a > b: print a,'is max value' else: print b,'is max value' getMax(10,20) x = 200 y = 280 getMax(x,y) # '''global''' # def func(): # global x # print x # x = 10 # print 'local x is changed to',x # # x = 2...
false
1d405709b22651faa97ed4089bd12053148fbe8e
nguyenmuoi157/VietSearchCodeChallenges
/Chanllenge_P3.py
1,001
4.1875
4
from Challenge_P1 import string_normalize def ngrams_genarate(input_string): word_normalize = string_normalize(input_string) word_array = word_normalize.split() unigrams = [] bigrams = [] trigrams = [] arr_length = len(word_array) for item in word_array: unigrams.append([item]) ...
false
062dff1462afeaa24db16aec458b7313f8d41a55
Zoxas/Test
/Leetcode/length Of Longest Substring.py
1,809
4.125
4
# -*- coding: utf-8 -*- """ Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1. """ class Solution(object): ...
false
4acf87250bceca5272504bf41db84899509f6a66
roblivesinottawa/object_oriented_code_python
/code/Person.py
1,489
4.25
4
class Person: def __init__(self, first_name, last_name, age, height, ehtnicity): self.first_name = first_name self.last_name = last_name self.age = age self.height = height self.ethnicity = ehtnicity def __str__(self): return f"{self.first_name} {self.last_name}...
false
be8eee178a6fc4354447d46ee616ab2716209ff6
rizkariz/dental_school
/sialolit, sialadeni, mukolel.py
853
4.125
4
# sialolithiasis, sialadenitis, or mukokel print("Answer the question with y/n") while True: num_1 = input("Does the swelling painful?") if num_1 == "y": num_1a = input("Is there any prodromal sympton?") if num_1a == "y": print("It might be Sialadenitis") break ...
true
2dcf55a666a4d134eba54a7c4b350e676270b91e
GabrielVSMachado/42AI_Learning
/00/text_analyzer/count.py
724
4.125
4
def text_analyzer(text=None, *args) -> str: """Return a string with the number of characters and other elements: number of upper_cases, lower_cases, punctuation_marks and spaces""" if len(args) != 0: return "ERROR" while text is None: text = input("What is the text to analyse?\n") pu...
true
99f465d787dc0d99c03575b767478dbe2aa0d17a
Pallavi2000/adobe-training
/day1/p1.py
263
4.15625
4
#Program to check if integer is a perfect square or not number = int(input("Enter a number ")) rootNum = int(number ** 0.5) if rootNum * rootNum == number: print(number,"is a perfect square number") else: print(number, " is not a perfect square number")
true
1a448b44238155775a082e047e89035bb645de6a
Pallavi2000/adobe-training
/day2/p3.py
259
4.15625
4
#Program to find series of n + n(2) + n(3) + ... n(m) m = int(input("Enter the value of m ")) number = int(input("Enter the number ")) sum_of_series = 0 for i in range(1, m + 1): sum_of_series += pow(number, i) print("Sum of Series is ",sum_of_series)
false
c1412481b55052471dc56ced35b17fb48f18c904
otaviocv/spin
/spin/distances/distances.py
1,987
4.25
4
"""Distances module with utilities to compute distances.""" import numpy as np def general_distance_matrix(X, dist_function): """General distance matrix with custom distance function. Parameters ---------- X : array, shape (n, k) The first set of column vectors. This is a set of k vectors wit...
true
95258c4e533cda362105cb844888cfa7f8aa8629
joycecodes/problems
/collatz.py
836
4.15625
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 at 1) c...
true
ed1ae18ed0aaa1b1ecfeac5a9357fe376ab69deb
almcd23/python-textbook
/ex4.py
960
4.1875
4
#tells number of cars cars = 100 #tells the amount of people a car can hold space_in_a_car = 4.0 #tells the number of people to drive the cars drivers = 30 #tells the number of passengers needing cars passengers = 90 #subtracts the number of cars from the number of drivers cars_not_driven = cars - drivers #there is one...
true
7d5ad77f9b30edfc698bed052baf7300cf668bc9
jorge-gx/dsi-minicourse
/004_ml_example.py
1,331
4.40625
4
""" Supervised learning example: An overview of the scikit-learn library for Machine Learning in Python """ import pandas as pd # importing model type and other useful techniques and eval metrics from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from skle...
true
e427debab3fb641525ed5c97a0f086ee194b60d3
AugPro/Daily-Coding-Problem
/Airbnb/e009.py
615
4.125
4
"""This problem was asked by Airbnb. Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. For example, [2, 4, 6, 2, 5] should return 13, since we pick 2, 6, and 5. [5, 1, 1, 5] should return 10, since we pick 5 and 5. Follow-up: Can you do thi...
true
7c906dd3ebe98d9a50c9130f238ffe76ed4289d7
Pravin2796/python-practice-
/chapter 3/assignmet 3/2.py
229
4.40625
4
letter = '''Dear <|name|> you are selected ! date : <|date|> ''' name = input("enter the name: \n") date = input("enter the date: \n") letter=letter.replace('<|name|>',name) letter=letter.replace('<|date|>',date) print(letter)
false
02b919b015d4c6dcb841f834707d0c89ab7daa80
Pravin2796/python-practice-
/chapter 2/operators.py
457
4.1875
4
a = 3 b = 4 # Arithematic operator print("value of 3+4 is", 3 + 4) print("value of 3+4 is", 3 - 4) print("value of 3+4 is", 3 * 4) print("value of 3+4 is", 3 / 4) # Assignment operators a= 20 a += 2 print (a) # comparison operator a = (4>5) print(a) #logical operator bool1= True bool2= False print("the value of bo...
true
ed233d7c5c7b0885f4fbeaabda7e9d957da30e10
surajbnaik90/devops-essentials
/PythonBasics/PythonBasics/Sets/set1.py
1,156
4.28125
4
#Creating sets companies = {"Microsoft", "Amazon", "Google"} print(companies) for company in companies: print(company) print("-" * 100) companies_set = set(["Microsoft", "Amazon", "Google"]) print(companies_set) for company in companies_set: print(company) #Add item to a set companies.add("VMWare") compani...
true
e1a6ae9518a2dbf164af4691fe0f5b1d7fee7838
surajbnaik90/devops-essentials
/PythonBasics/PythonBasics/Challenges/challenge2.py
450
4.1875
4
#Write a program to guess a number between 1 and 10. import random highest = 10 randomNumber = random.randint(1, highest) print("Please guess a number between 1 and {}: ".format(highest)) guess = 0 while guess!= randomNumber: guess = int(input()) if guess < randomNumber: print("Please guess higher")...
true
05368d6c238aced1d80909d6f546363caf05df48
riddhi-jain/DSAready
/Arrays/Reverse a List.py
714
4.15625
4
#Problem Statement : Reversing a List. #Approach : """ Step1 : Find the "mid" of the List. Step2 : Take two pointers. initial >> start pointer , last >> end pointer Step3 : Keep running the loop until initial < last or mid-1 does not equals to zero. Step4 : Swap the element at initial position with the element at the...
true
03f32157fc9a2383fd6d1e3f27db19134b1e6ab9
G00398347/programming2021
/week04/w3schoolsOperators.py
1,263
4.625
5
#This is for trying out python operators #assignment operator example x = 5 x += 3 print (x) #this prints x as 8 #in and not in- membership operators example x = "Just for fun" y = {1:"a", 2:"b"} print ("J"in x) print ("just" not in x) print (1 in y) print ("a" in y) #identity operators is and is not example 1 ...
true
9e20d191a2fbbfadc803c6e46a873f92add4dc8d
G00398347/programming2021
/week02/lab2.3.1testTypes.py
633
4.1875
4
#This programme uses type function in python to check variable types #Author: Ruth McQuillan #varialbes are assigned names i = 3 fl = 3.5 isa = True memo = "how now Brown Cow" lots = [] #command to output the variable name, type and value print ("variable {} is of type:{} and value:{}" .format ("i", type(i), i)) pri...
true
42fbfbc90c1385626001445374b671011d236107
G00398347/programming2021
/week03/lab3.3Strings/lab3.3.3normalise.py
1,200
4.6875
5
#This programme reads in a string, strips any leading or trailing spaces, #converts the string to lowercase #and outputs length for the input and output strings #Author: Ruth McQuillan #This question was also asked in lab2.3.5 string1 = input (str( " Please enter a string: " )) ...
true
1e917fbfdfa0fa76e94a7c509f3dd9126b24f110
sticktoFE/imooc
/apps/ml/DimensionalityReduction.py
1,521
4.1875
4
""" 9.降维算法(Dimensionality Reduction Algorithms) 在过去的4-5年里,可获取的数据几乎以指数形式增长。公司/政府机构/研究组织不仅有了更多的数据来源,也获得了更多维度的数据信息。 例如:电子商务公司有了顾客更多的细节信息,像个人信息,网络浏览历史,个人喜恶,购买记录,反馈信息等,他们关注你的私人特征, 比你天天去的超市里的店员更了解你。 作为一名数据科学家,我们手上的数据有非常多的特征。虽然这听起来有利于建立更强大精准的模型,但它们有时候反倒也是建模中的一大难题。 怎样才能从1000或2000个变量里找到最重要的变量呢?这种情况下降维算法及其他算法,如决策树,随机森林,PCA,因子分析,...
false
97bdeb85fdd83fda25b2d25151df7c7495d1e323
Sarath-Kumar-S/Zigzag-pattern
/Zigzag.py
1,243
4.21875
4
# Python3 program to prthe given # zigzag pattern # Function to prthe zigzag pattern def printPattern(n): var = 0 var = 1 for i in range(1, n + 1): # for odd rows if(i % 2 != 0): # calculate starting value var = var + i - 1 ...
false
be90a3c4fceba3d2dba6c93c898441ad503ca9de
ByeongGil-Jung/Python-OOP
/src/exercise_3/C_MagicMethod.py
1,445
4.125
4
# 매직 메소드 """ 매직 메소드 (Magic Method) -> __init__ 과 같이 오브젝트 안에서 실행되는 기본 클래스 메소드 -> 효율적인 코딩을 위해선 꼭 알아둬야 함! """ class Dog(object): def __init__(self, name, age): print('Name : {}, Age : {}'.format(name, age)) """ 일반적으로 사용하는 a + b 와 같은 오퍼레이터도 사실 내부적으로 a.__add__(b) 라는 매직 메소드가 동작하는 것이다. """ class MyInt(int):...
false
4275495d3b83a80169a04e060967a6fdca27bbad
DavidFliguer/devops_experts_course
/homework_3/exercise_7_8_9_10.py
731
4.125
4
import os def print_file_content(path_to_file, ec): # Read content with open(path_to_file, "r", encoding=ec) as file: content = file.read() # Print the content print(content) encoding = "utf-8" file_name = "words.txt" # If file exists delete it (So we can run same script multiple times) if...
true
2dc59d61d74d7cb8acefdb1114d91daefa139d2d
Moly-malibu/MIT_6.00SC_VPT_Learn_Together
/Problem_Set4_Caesar_Cipher/Problem_Set4_Caesar_Cipher_Encoder.py
2,721
4.125
4
import string def build_coder(shift): """ apply a Caesar cipher to a letter returns a dict shift: int -27-27 Example: >>> build_coder(3) {' ': 'c', 'A': 'D', 'C': 'F', 'B': 'E', 'E': 'H', 'D': 'G', 'G': 'J', 'F': 'I', 'I': 'L', 'H': 'K', 'K': 'N', 'J': 'M', 'M': 'P', 'L': 'O', 'O':...
false
8870d8bd5e38c5c28bf81fa4737e0582daa0bab3
aliu31/IntroToProgramming17
/Day26/textprocessing78b.py
830
4.1875
4
import string text = "I hope that in this year to come, you make mistakes. Because if you are making mistakes, then you are making new things, trying new things, learning, living, pushing yourself, changing yourself, changing your world. You're doing things you've never done before, and more importantly, you're doing ...
true
c1e9826eaa6eb14e1943fd42f94c923533e82752
Lava4creeper/RockPaperScissors
/User_Choice.py
760
4.1875
4
#Functions def choice_checker(question): valid = False error = 'Error. Please enter Paper, Scissors or Rock' while not valid: #Ask user for choice response = input(question).lower() if response == 'r' or response == 'rock': response = 'Rock' print('You selected {}'.format(response)) el...
true
18ea1470ebed93614532e2c8e55515dec1e31fef
Kasimir123/python-projects
/games/hangman.py
2,662
4.1875
4
import re print ("Welcome to Hangman, please enter a word which you would like to use for the game, and then enter how many failed guesses you wish to give to the players.") # Initializes constants for the program word = input("What is the word?") # Checks to see if the player actually put a word or phrase into the i...
true
45be00401b1fcf6095e7fb3a219ae39abb76f368
jpsalviano/ATBSWP_exercises
/chapter7/strongPasswordDetection.py
1,718
4.25
4
# Strong Password Detection ''' A strong password is defined as one that: -is at least 8 characters long -contains both uppercase and lowercase characters -has at least 1 digit You may need to test the string against multiple regex patterns to validade its strength. ''' import re passRegex1 = re.compile(r'[a-z]+[A-...
true
cfc0e00ea288974044d513f9fab21c417f1dcd71
azuluagavarios/Python
/palindromo.py
1,323
4.21875
4
def palindromo(palabra): # Tambien se puede utilizar la funcion strip, pero solo quita los del inicio o el final palabra = palabra.replace(" ", "") palabra = palabra.lower() print(palabra) # El uso de corchetes, tambien permite ubicar un caracter especial [0], trae el primer caracter # T...
false
cd7d01e883759a9234932a317d22838fc47c71e7
chutki-25/python_ws
/M1_Q/q6.py
261
4.1875
4
"""Write a program to accept a number from the user; then display the reverse of the entered number.""" num=int(input("Enter a number: ")) temp=num rem=0 rev=0 while num!=0: rem=num%10 rev=rev*10+rem num=num//10 print(f"Reverse of {temp} is {rev}")
true
41993386ffc1730a981a99d01f3c6830166c4f2e
dglo/dash
/IntervalTimer.py
1,275
4.375
4
#!/usr/bin/env python "Timer which triggers each time the specified number of seconds has passed" from datetime import datetime class IntervalTimer(object): """ Timer which triggers each time the specified number of seconds has passed. """ def __init__(self, name, interval, start_triggered=False): ...
true
10b6d0ecc6acc199ea3f15eff3b229bbb4f9d26e
jstev680/cps110
/examples/guess/guess_inclass.py
827
4.125
4
import random def generateSecretNumber(): """returns a random number from 1 to 10""" # generate secret number secretNum = random.randrange(1, 11) return secretNum def giveFeedback(guess, secretNum): """compares `guess` to `secretNum` and gives appropriate feedback""" # Give feedback on guess ...
true
0feeab54988a6274ba965f51c10d241086a1cd99
boragungoren-portakalteknoloji/METU-BUS232-Spring-2021
/Week 3 - More on Variables and Operations/Week 3 - Numerical Operations.py
2,040
4.28125
4
# License : Simplified 2-Clause BSD # Developer(s) : Bora Güngören # Let's begin with some basics a = 2 b = 3 c = a + b print("a:",a,"b:",b,"c:",c) # So how did this work? # operator+ (summation) works and its result is passed as RHS of operator= (assignment) # operator= assigns the results to variable c. # Val...
true
377b578cff00723a50624c78e010a659e6923acc
bjmarsh/insight-coding-practice
/daily_coding_problem/2020-08-22.py
1,130
4.28125
4
""" Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string "AAAABBBCCDAA" would be encoded as "4A3B2C1D2A". Implement run-length encoding and decoding. You can assume the string to be ...
true
5fe85104289ab957ad5e755eee09c056616aa398
bjmarsh/insight-coding-practice
/daily_coding_problem/2020-09-08.py
817
4.3125
4
""" Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one. For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "bananas" is "anana". """ def find_palindromic_substring(s): max...
true
7996c5bc03affa4cca148438229aaa9c592a3ac6
bjmarsh/insight-coding-practice
/daily_coding_problem/2020-08-03.py
668
4.28125
4
""" Implement a queue using two stacks. Recall that a queue is a FIFO (first-in, first-out) data structure with the following methods: enqueue, which inserts an element into the queue, and dequeue, which removes it. """ class Queue: def __init__(self): self.data = [] # a stack def enqueue(self, val)...
true
b05924b936ae42c05b7c36ffb9a0c9cde6cc261c
Marcus-Jon/common_algroithms_python
/prime_checker.py
601
4.125
4
# common prime checker # import in other programs to make use of this function # place in same directory as the file calling it def prime_check(): x = 2 is_prime = False prime = input('Enter a prime number: ') while is_prime != True and x < prime: print '\r', prime % x, x, i...
true
cf5767864913ce69d767036259df39dc3a7bc444
NataFediy/MyPythonProject
/codingbat/make_pi.py
306
4.125
4
#! Task from http://codingbat.com: # Return an int array length 3 containing the first 3 digits of pi, {3, 1, 4}. # # Example: # make_pi() → [3, 1, 4] def make_pi(): pi = {0:3, 1:1, 2:4} str_pi = [] for i in range(len(pi)): str_pi.append(pi[i]) return str_pi print(make_pi())
true
f49c940491bbb3361cfe5bb6bc109288086f29ef
NataFediy/MyPythonProject
/hackerrank/functions_filter.py
2,404
4.40625
4
#! You are given an integer N followed by N email addresses. # Your TASK is to print a list containing only valid email addresses # in lexicographical order. # # Valid email addresses must follow these rules: # It must have the username@websitename.extension format type. # The username can only contain letters, digits,...
true
3a9de00f8bf616d76899e1655611a9f24d37c320
yash1th/ds-and-algorithms-in-python
/string processing/is_palindrome_permutation.py
818
4.1875
4
def is_palindrome_permutation(s): ''' for strings of - * even length - all characters should be of even count * odd length - all characters should be of even count except one which have odd count ''' s = s.replace(' ', '').lower() ht = dict() for i in s: if ...
false
11d23110fd02fb40f1c5f652cbde07968864dfe1
pastqing/wangdao
/LearnPython/ex3.py
972
4.1875
4
# -- coding: utf-8 - # + plus # - minus # / slash # * asterisk # % percent # < less-than # > greater-than # <= less-than-equal # >= greater-than-equal print "I will now count my chickens:" # count The Hens nums print "Hens", 25 + 30.0 / 6 # count The Roosters nums print "Roosters", 100 - 25 *3 % 4 ...
false
e3f173cb7d8ae4c1dc91802446a426eb00c02a37
alex9985/python-and-lists
/find-smallest-item.py
252
4.1875
4
#find smalest number in a list # my_list = [] num = int(input("Enter number of elements to put into the list ")) for i in range(1, num + 1): elem = int(input("Enter elements: ")) my_list.append(elem) print("Smallest element is ", min(my_list))
true
36fe802656d0878d7af3dd94830128672790afb7
vasu19126/introduction
/samples/input.py
516
4.25
4
print("write your information") name = input("what is your name : ") age = input("how old are you: ") fname =input("ur father's name: ") mname =input("ur mother's name: ") hobby =input("urs hobby: ") phoneno = int(input("ur phone no.: ")) email =input("ur e-mail id: ") enter=input("type ok for regisetration: ") def ok(...
false
833df1679a2e17553a52eec241801873078d1e79
cychug/projekt3
/006_Operacje_arytmetyczne.py
721
4.15625
4
# 3. Arithmetic Operations # x = 3; y = 2 x, y = 3, 2 print(x + y) print(x - y) print("mnoenie x * y", x * y) print("dzielenie x / y", x / y) print("dzielenie w dół //", x // y) print("modulo %", x % y) # Przykład: 20 mod 3 = 2, ponieważ 20 / 3 = 6 z resztą 2. (6 * 3) + 2 = 18 + 2 = 20 print("wartość...
false
790786a09d8a57b423fb745270f23bd1e8e8c4ad
hmol/learn-python
/learn-python/dragon.py
1,545
4.125
4
import random import time # In this game, the player is in a land full of dragons. The dragons all live in caves with their large # piles of collected treasure. Some dragons are friendly and share their treasure with you. Other # dragons are hungry and eat anyone who enters their cave. The player is in front of two ca...
true
aedf715fa42a5e904b36cfbac5b33c54d6da583e
kartikmanaguli/sample
/1.py
327
4.15625
4
def computegrade(x): if x>=0.0 and x<=1.0: if x>=0.9: print('A') elif x>=0.8: print('B') elif x>=0.7: print('C') elif x>=0.6: print('D') else: print('F') else: print('Out of range!') x=float(input('Enter the grade:')) computegra...
false
66c321fdcf40d1145a14d1aac44186bbbd743873
Alex1992coyg/project4
/src/shape_calculator.py
1,177
4.125
4
#!/usr/bin/env python3 class Rectangle: def __init__ (self,width,height): self.width = width self.height = height def set_width(self,value): self.width =value def set_height(self,value): self.height =value def get_area (self): return(self.width * self.height)...
false
7aa018723ff8f18fd78e55eed042888448177111
shoaib-intro/algorithms
/primetest.py
511
4.15625
4
''' Prime Test ''' def is_prime(n): 'prime started 2,3,5 ....' if (n>=2): 'divides number by its whole range numbers' for i in range(2,n): 'if whole dividisible returns false=0' if not(n%i): return False else: return False return True ...
true
84b93b4f2ca4b9804d502a1557a51595cd49dd1c
tanni-Islam/test
/partial_func.py
349
4.15625
4
'''from functools import partial def multiply(x,y): return x * y dbl = partial(multiply,2) print dbl(4) ''' #Following is the exercise, function provided: from functools import partial def func(u,v,w,x): return u*4 + v*3 + w*2 + x #Enter your code here to create and print with your partial function dbl = part...
true
1994dd456f674002a0921d23f6212d6d92a68112
kamyanskiy/demo
/yield_from_two_gen.py
711
4.34375
4
# Python 3.3+ - yield from gen1 = (print(x) for x in range(0,5)) gen2 = (print(x) for x in range(5,10)) """ def gen3(): for i in gen1: yield i for j in gen1: yield j """ def gen3(): print("First generator starts") yield from gen1 print("Second generator starts") yield from ge...
false
a936801bafe2ad2bf0cac1ff53aec16feddd8be6
unsilence/Python-function
/数据结构与算法/线性表/single_link_list_recurrent.py
2,513
4.125
4
from 线性表.single_linked_list import Node class RecurrentLinkList: def __init__(self, node=None): self._head = node if node: node.next = node def add(self, item): node = Node(item) self._head = node node.next = node def append(self, item): if...
false
b43f3646d54bffa29d4640e018bf66f27764d8b8
Sangram19-dev/Python-GUI-Projects
/lived.py
2,522
4.40625
4
# Python Programming Course:GUI Applications sections # - Sangram Gupta # Source code for creating the age calculator from tkinter import * from datetime import datetime # Main Window & Configuration App = Tk() App.title("Age Calculator") App['background'] = 'white' A...
true
90714eeaf5e4fc0e98499de79496c93d12f78e16
clacap0/simple
/counting_vowel.py
351
4.25
4
""" Count the vowels in a string """ def count_vowels(phrase): vowels = 'aeiou' counter = 0 for letter in phrase: for vowel in vowels: if vowel==letter: counter += 1 return f'There are {counter} vowel(s) in your phrase.' print(count_vowels(input('What phrase would ...
true
4a96e3b5613b5b414e010c18a046113c54191ca2
TANADONsim/CP1404_Practicals
/prac_05/color_hex.py
615
4.21875
4
COLOR_NAMES = {"ALICEBLUE": "#f0f8ff", "ANTIQUEWHITE": "#faebd7", "BEIGE": "#f5f5dc", "BLACK": "#000000", "BLANCHEDALMOND": "#ffebcd", "BLUEVIOLET": "#8a2be2", "BURLYWOOD": "#deb887"} # print(STATE_NAMES) color = input("Enter color name: ") color = color.upper() while color != "": if color in COLOR_...
false
f42055a17f024c6985169a32686cfcec7fd8ad6d
akmishra30/python-projects
/python-basics/file-handling/file-reader.py
1,099
4.5
4
#!/usr/bin/python # This program is to show basic of python programming # I'm opening a file using python # import os import sys import time from datetime import datetime # This function is to open a file def open_file(fileName): print('Hello First Python program', fileName) _currDir = os.getcwd() + os....
true
03a0f66855fd2aeac2218d0cf662e0dd357e728b
LouStafford/My-Work
/RevisionLabsInputCommand.py
1,152
4.28125
4
# This is for my own practice only and revision by following Andrews lectures re input prompts # & to practice push/pull/commit on Github (also commands) without having to refer to notes from inital lessons # Here we will ~ Read in a Name/Age & print it out # Author Louise Stafford # input('Please enter your name: ')...
true
4e66d77b7aca629d9dd0fa24af512e17aa128225
agiri801/python_key_notes
/_05_Data_type_intro/_03_Different_nums_conv.py
800
4.1875
4
''' Default number system is decimal number system.So, it convert any number system to decimal. '0b' prefix numbers are 'Binary number' '0o' prefix numbers are 'Octal-decimal number' '0x' prefix numbers are 'Hexa-decimal number' ''' a=0b10101001 b=0x1589acf c=0O75642 x=int(a) y=int(b) z=int(c) print(a,type(a)) print(b...
false
b8db05cb708fcb42f0ef742779075f96ece1193d
Rosebotics/PythonGameDesign2018
/camp/SamuelR/Day 1 - The Game Loop, Colors, Drawing and Animation/01-HelloWorld.py
636
4.21875
4
# Authors: David Mutchler, Dave Fisher, and many others before them. print('Hello, World') print('Samuel Ray can make Python programs!!!!') print('one', 'two', 'through my shoe') print(3 + 9) print('3 + 9', 'versus', 3 + 9) # DONE: After we talk together about the above, add PRINT statements that print: # DONE: 1...
true
dcc7fc7191a34a963fd8ebf2a06dfd9f0e0d001f
edharcourt/CS140
/python/string_slices.py
273
4.1875
4
print("Enter three numbers separated by a comma") s = input("> ") comma1 = s.find(',') comma2 = s.find(',', comma1+1) num1 = int(s[:comma1]) num2 = int(s[comma1+1:comma2]) num3 = int(s[comma2+1:]) avg = (num1 + num2 + num3) / 3 print("Average:", round(avg,2))
false
655313660a5bc48feacc71232bf51942b0021bea
richardlam96/notepack2
/notepack/output.py
431
4.21875
4
""" Output functions Functions to aid in outputting messages to the console in specified format. Console logger with datetime and spacing. """ from datetime import datetime def print_welcome_message(): """Print a welcome message to the output.""" now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # Welc...
true
7ac0798213c0e010dc86ef10f746e7274a49340a
sauuyer/python-practice-projects
/day2.py
696
4.34375
4
# Ask the user for their name and age, assign theses values to two # variables, and then print them. name = input("Name, please: ") age = input("Now age: ") print("This is your name: ", name) print("This is your age: ", age) # Investigate what happens when you try to assign a value # to a variable that you’ve already ...
true
cd4c089f7bdd43d3bcea05709f0afc962715e005
mrdbourke/LearnPythonTheHardWay
/ex15.py
734
4.25
4
from sys import argv #This tells that the first word of argv is the script (ex15.py) #The second part of argv (argv[1]) is the filename script, filename = argv #This sets up the txt variable to open the previously entered filename txt = open(filename) #This prints the filename print "Here's your file %r:" % filename ...
true
238ee5e9a26c8ae49590894032cf49d02fa2a28d
ucsd-cse-spis-2019/spis19-lab04-Emily-Jennifer
/recursiveDrawings.py
2,337
4.375
4
#Turtle draws a spiral depending on initialLength, angle, and multiplier #Also draws a tree. A very nice tree #Emily and Jennifer import turtle def spiral(initialLength, angle, multiplier): '''draws a spiral using a turtle and recursion''' if initialLength < 1 and multiplier < 1: return if initial...
true
651059909198066b6791c7cc18be6a9e0ed96d7f
hayesmit/PDXCodeGuildBootCamp
/lab17-Palindrome_and_anagram.py
875
4.28125
4
#lab17-Palindrome_and_anagram.py import string alpha = string.ascii_lowercase def check_palindrome(word): word = list(word) forward = word word.reverse() palindrome = word if forward == palindrome: print("yes this is a palindrome") def check_anagram(arg1, arg2): arg1 = list(arg1) ...
false
acabf73ae50a5983b6be3dbf46b5bad20a911167
hayesmit/PDXCodeGuildBootCamp
/lab12-Guess_the_Number.py
1,099
4.1875
4
#lab12-Guess_the_Number.py import random #user guesses code lines 5-25 #computer = random.randint(1, 10) # #last_guess = 1000 #x = 1 #while x: # my_guess = int(input("guess number " + str(x) + " >> ")) # if last_guess < 100 and abs(my_guess-computer) > abs(last_guess-computer): # print("you are further f...
true
f7196ceae00207be96fa5fd58abe00e8bd9fec5b
sasca37/PythonPrac
/dfsbfs/ex1.py
762
4.15625
4
stack = [] stack.append(5) stack.append(4) stack.append(4) print(stack[::-1]) #큐를 쓰기위한 deque 라이브러리 사용 from collections import deque queue = deque() queue.append(5) queue.append(2) queue.append(3) queue.append(6) queue.popleft() print(queue) queue.reverse() print(queue) def recursive_function(i): if i == ...
false
9b87dce51612568e0b1b769f6ed776d77897d4b2
lentomurri/python
/pw.py
1,434
4.25
4
#! python3 # PASSWORD MANAGER PROJECT # command line arguments: takes what we insert in the command line and store them as arguments to be used in the program import sys, pyperclip, json with open("C:\\Users\\Lento\\personalBatches\\dict.json", "r") as read_file: data = json.load(read_file) read_file.close()...
true
1b6717f643047565037b73b36de95e78eba121d5
lentomurri/python
/searchRegex.py
1,554
4.5625
5
#! python3 # This program will ask for a folder where the files are stored. # It will find all .txt files and apply the regex search the user entered. # It will display the results in the terminal and even paste them automatically in the clipboard for storage purposes. import re, sys, os, pyperclip # write folder p...
true
cbedd5e4f8d5aa909b919665c1fd66257851c24b
Danyalah/Dana-Felixon-Portfolio
/portfolio/List_challenge.py
500
4.125
4
from random import * ###Create a Haiku generator #Create a list of three syllable lines first = ["I am cool", "Your are tall", "Ally is"] #Create a list of five syllable lines second = ["She is so pretty", "My mom is lovely", "I have a brother"] #Initialize Haiku Haiku = "" ### x = randint(0, len(fir...
false
8a5da6d101f861aa6f522ef789cd0d335f6a5e83
mira0993/algorithms_and_linux_overview
/Python/Graphs/floyd_warshall_algorithm.py
2,384
4.34375
4
''' The Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem. The problem is to find shortest distances between every pair of vertices in a given edge weighted directed Graph. Input: graph[][] = { {0, 5, INF, 10}, {INF, 0, 3, INF}, {INF, INF,...
true
4356f13dd09f59459789cee8dd71487597fb4a37
ArkaprabhaChakraborty/Datastructres-and-Algorithms
/Python/OptimalmergePattern.py
1,152
4.1875
4
class PriorityQueue(object): def __init__(self): self.queue = [] def __str__(self): return ' '.join([str(i) for i in self.queue]) # for checking if the queue is empty def isEmpty(self): return len(self.queue) == 0 # for inserting an element in the queue def inser...
true
0aa2272fd5db353f938d6604ba80388fa66cb042
walyncia/ConvertString
/StringConversion.py
1,234
4.15625
4
import time def StringToInt (): """ This program prompts the user for a string and converts it to a integer if applicable. """ string = input('Desired Number:') print('The current state:\nString:',string,' ->', type(string)) if string == '': #handle no input raise Exception ('In...
true
9d0c358d5e51ebd04f5e21d43f1a316d9243390b
yved/python_lesson2
/week3/week3-3.py
572
4.34375
4
#商管程式設計二第三周上課內容 #python 特別有的函數 # def f1(x): # return x**2 # print(f1(8)) # #用lambda 函數 # f2 = lambda x : x**2 # print(f2(8)) #zip 函數 a = [1,2,3] b = [4,5,6] zipped = zip(a,b) tuple_zip = tuple(zipped) print(type(tuple_zip[0][0])) # #搭配map函數 可以重複執行某個函數 # list1 = [3,5,2,4,9] # #要讓list裡面的每個東西都平方 # out1 = map(f1,list1) ...
false
d8a519673a68f8c8e09824826c1fc1d50eaa2c67
Elijah3502/CSE110
/Programming Building Blocks/Week 3/08Team.py
254
4.3125
4
num_of_col_row = int(input("How many columns and rows would you like? : ")) col = 1 row = 1 while(col <= num_of_col_row): print() while(row <= num_of_col_row): print(f"{(row) * col:3}", end=" ") row += 1 col += 1 row = 1
true
7f79b41806cc8bb4b3c2ff61230421cb33c411f3
Elijah3502/CSE110
/Programming Building Blocks/Week 4/07Checkpoint.py
345
4.28125
4
#Ask positive number user_num = int(input("Enter a number that is not negative : ")) while user_num < 0 : user_num = int(input("Try again!\nEnter a number that is not negative : ")) ask_candy = input("Can I have some candy? : ").upper() while ask_candy != "YES": ask_candy = input("Can I have some candy? : ")....
false
dae01c802a2d232d17e9194f2dd7dce4fcc5eb4d
Elijah3502/CSE110
/Programming Building Blocks/Week 2/04Teach.py
2,111
4.25
4
""" Team Activity Week 04 Purpose: Determine how fast an object will fall using the formula: v(t) = sqrt(mg/c) * (1 - exp((-sqrt(mgc)/m)*t)) """ import math print("To calculate how fast an object will fall, enter these informations:") #input mass (in kg) m = float(input("Mass (in kg): ")) #input acceleration due to gra...
true
bf9e9ea38ce0b81cedef651ba98c0b4499a8a9b8
francisamani/RockPaperScissors
/automated_rps.py
1,631
4.1875
4
# Name: Francis Oludhe # Homework on coding Rock, Paper, Scissors import random print "Welcome to a game of Rock, Paper, Scissors\nMake your choice?\n" """ Placing suitable inputs for both players """ right = ["rock", "paper", "scissors"] one = raw_input("Your choice? \n") comp = random.choice(right) ...
true
104680466515101a786087ce40a0e3de562a9c2f
ULYSSIS-KUL/ulyssisctf-writeups
/2018/reverse/one-step-beyond/final.py
651
4.28125
4
#!/usr/bin/env python3 def fibonacci(i: int, previous: int = 1, past_previous: int = 0) -> int: for _ in range(i): previous, past_previous = previous + past_previous, previous return previous + past_previous def rotate(character: str, n: int) -> str: return chr((ord(character) - 32 + n) % 95 + 32...
false
19de4e48ed2c15fa5f713b5292f34cccc9de4199
chengxxi/dailyBOJ
/2021. 2./4714.py
1,523
4.15625
4
# 4714: Lunacy while True: weight = float(input()) if weight < 0: break print(f'Objects weighing {weight:.2f} on Earth will weigh {(weight * 0.167):.2f} on the moon.') # Objects weighing 100.00 on Earth will weigh 16.70 on the moon. """ # ㅠ제컴에선 # ㅠ되는데요 nums = list(map(float...
true
56249a0afb87df8d6603ef943e52466e80773279
Kushagar-Mahajan/Python-Codes
/slicer.py
840
4.28125
4
#slice is to take out particular text from a string using their indexes word = "Encyclopedia" a = word[0] #will print out word written at index 0 print(a) #here [a:b:c] is the format a = word[0:3:1] #where a is starting index, b is ending index and c is step print(a) a = word[0:3:2] print(a) #it can be matched with pr...
true
214ccd8211e8e78fd1c3ddc237c4a7b6969edb37
Kushagar-Mahajan/Python-Codes
/variables.py
356
4.28125
4
#Variables are used to store stuff #It has name and value and used to store value for later in easy and convenient way. number = 1 print("Number is",number) #prints the variable print("Type of the number is",type(number)) #tells the type of variable number= "hello" # will overwrite the previous variable print("Overwri...
true
858e3823bf27b0060d1cccde85b0623f44c2ab78
forabetterjob/learning-python
/01-data-types-and-structures/numbers.py
949
4.1875
4
import math import random # integer will convert up to float result = 1 + 3.14 print "1 + 3.14 is " + str(result) # 4.14 # order of operations result = 1 + 2 * 3 print "1 + 2 * 3 is " + str(result) # 7 # order of operations result = (1 + 2) * 3 print "(1 + 2) * 3 is " + str(result) # 9 # exponential result = 10 ** ...
true
a823de068433836d63fc055ed5f465958c92b819
doper0/firstcode
/ff2.py
345
4.15625
4
num=int(raw_input("write number between 50 to 100 ")) if 50>num : #The program shows all the numbers that divide by three with no remainder print ('you cant enter that number') elif num>100 : print ('you cant enter that number') else : i=-1 for i in xrange(50,num+1) : if ...
true
fe7af938d21a96ebdc8e36709688891eb24a1622
ariamgomez/8-14-2015
/bisection.py
856
4.28125
4
## This square root calculator will depict the 'Bisection Method' ## to calculate the root and will compare to 'Exhaustive Enumeration' (Brute Force approach) ## Python 2.7.9 # Error epsilon = 0.01 # Counters ans = 0.0 count = 0.0 # My algorithmic boundaries low = 0.0 high = 0.0 x = raw_input ("Please enter a numbe...
true
ed86be3cda08c69bd5d8e455fc8db610d7d0b777
liurong92/python-exercise
/exercises/number/one.py
711
4.21875
4
''' Let's assume you are planning to use your Python skills to build a social networking service. You decide to host your application on servers running in the cloud. You pick a hosting provider that charges $0.51 per hour. You will launch your service using one server and want to know how much it will cost to operate ...
true
b32016104985b870b9ca81114f17fefacfc47ea1
liurong92/python-exercise
/exercises/files/one.py
431
4.5
4
''' Create a program that opens file.txt. Read each line of the file and prepend it with a line number. The contents of files.txt: This is line one. This is line two. Finally, we are on the third and last line of the file. Sample output: 1: This is line one. 2: This is line two. 3: Finally, we are on the third and last...
true
c10ae30c238bf9e6398c771aadd511a28c0d2228
paddumelanahalli/agile-programming
/factorial.py
685
4.28125
4
factorial=1 #To store the factorial of a no. num=int(input("Enter a no. whose factorial is needed: ")) #Accepting a no. from user if(num<0): print("Its an negative integer so factorial is not possible") #Checking for a negative integer entered from user elif(num==0): print("Factorial of 0 i...
true
9da5403525bbd225046b635766faf107353b1d28
susyhaga/Challanges-Python
/Udemy python/control_structure/Intersection_SET_10.py
692
4.1875
4
#Create a constant with a set of forbidden words. #Then create a list with some phrases. #Check if these prohibited words are inside the sentences and point out those words, #Otherwise the text will be authorized. #Intersection set FORBIDDEN_WORDS = {'asshole', 'bastard', 'Bolsonaro', 'hate', 'garlic'} phrases = [ ...
true
5e81439854d2f4fa8a4996e3cda2b10f37852e4b
TomScavo/python
/student2.py
313
4.21875
4
import csv from student import Student students=[] for i in range(3): name=input("name: ") dorm=input("dorm: ") students.append(Student(name,dorm)) file=open("student.csv","w") writer=csv.writer(file) for student in students: writer.writerow((student.name,student.dorm)) file.close
true
76d1f9a00c06094d82ce75ddbc3b9982e5582e76
TomScavo/python
/calculation.py
447
4.15625
4
# prompt user int x x=int(input("please enter int x: ")) # prompt user int y y=int(input("please enter int y: ")) # a list of calculations print("{} plus {} is {} ".format(x,y,x+y)) print("{} minus {} is {} ".format(x,y,x-y)) print("{} times {} is {} ".format(x,y,x*y)) print("{} divided by {} is {:.55f} ".format(...
true
47318c5a413efdba95e40927e1159e30af82eae7
striveman1379/Algorithm_Python
/little_examples/python实现斐波那契数列.py
1,246
4.28125
4
# 程序分析:斐波那契数列(Fibonacci sequence),又称黄金分割数列,指的是这样一个数列:0、1、1、2、3、5、8、13、21、34、…… ''' 在数学上,费波那契数列是以递归的方法来定义: F0 = 0 (n=0) F1 = 1 (n=1) Fn = F[n-1]+ F[n-2](n=>2) ''' #方法一: #!/usr/bin/python # -*- coding: UTF-8 -*- # 斐波那契数列 def fib(n): a, b = 1, 1 for i in range(n-1): a, b = b, a+b return a ...
false