blob_id stringlengths 40 40 | repo_name stringlengths 5 119 | path stringlengths 2 424 | length_bytes int64 36 888k | score float64 3.5 5.22 | int_score int64 4 5 | text stringlengths 27 888k |
|---|---|---|---|---|---|---|
42d6366386cfec19adf050d68996644bd76c8eab | arjun-tarakesh/RockPaperScissors | /Rock_paper_scissor.py | 3,290 | 4.0625 | 4 | import random
import time
import sys
## time module is used for dramatic pause
title = '''
โโโโ โโโโ โโโ โโโ ใ โโโโ โโโโ โโโโ โโโ โโโโ ใ โโโ โโโ โโโ โโโ โโโ โโโโ โโโโ โโโ
โโโโ โโโโ โโโ โโโ ใ โโโโ โโโโ โโโโ โโโ โโโโ ใ โโโ โโโ โโโ โโโ โโโ โโโโ โโโโ โโโ
โโโโ โโโโ โโโ โโโ ใ โโโโ โโโโ โโโโ โโโ โโโโ ใ โโโ โโโ โโโ โโโ โโโ ... |
cf7cda3cafc1774e6193283d437c71224ec41fd3 | Daneidy1807/CreditosIII | /Fun-Lis-Dic-ManError/Listas_3.py | 203 | 3.734375 | 4 | cantantes =['2pac', 'Drake', 'Daio Gomez', 'Julio Iglesias']
numeros = [1,2,3,5,8,4]
#numeros.sort()#sort ordena
#print(numeros)
#numeros.reverse()#los muestra al reves
#print(numeros)
print('Drake' in cantantes) |
3b6c9d17ec271fed81ff056fbbc8114a74260c21 | ambros-gleixner/rubberband | /rubberband/utils/typer.py | 938 | 4.125 | 4 | """Methods to convert or estimate types."""
def boolify(value):
"""
Convert a string to a bool, if not possible, raise a ValueError.
Parameters
----------
value : str
value to convert.
"""
if value.lower() == "true":
return True
elif value.lower() == "false":
r... |
be81ea029cebbf93ef224063ac08ab2f1150a9aa | FelixOnduru1/100-Days-of-Code | /Day26/Day26-challenge.py | 180 | 3.984375 | 4 | numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
squared_numbers = [n**2 for n in numbers]
print(squared_numbers)
even_numbers = [n for n in numbers if n % 2 == 0]
print(even_numbers)
|
55cf3c49541aa9bdd35a872f86dabbd97796b456 | giorgiosst92/ZeroSearch_3 | /zero_binary_search.py | 710 | 3.6875 | 4 | from configparser import ConfigParser
config = ConfigParser()
config.read('config.ini')
# read the base params from the config file
input = int(config.get('processing', 'input'))
def zeroes(input):
# convert number into it's binary
input = bin(input)
# remove first two characters of output string
i... |
ffa19ca9876af927de187682171c4344d2d5ad41 | YJL33/LeetCode | /old_session/session_1/_442/_442_find_all_duplicates_in_an_array.py | 915 | 4.03125 | 4 | """
442. Find All Duplicates in an Array
Total Accepted: 6444
Total Submissions: 14237
Difficulty: Medium
Contributors: shen5630
Given an array of integers, 1 โฆ a[i] โฆ n (n = size of array),
some elements appear twice and others appear once.
Find all the elements that appear twice in this array.
Co... |
a67c5b028d7029e810685072c85006b089e2955b | batatay/dio-desafio-github | /desafios/aula07___5-15/desafio006.py | 257 | 3.921875 | 4 | #Crie um algoritmo que leia um nรบmero e mostre o seu dobro, triplo e raiz quadrada.
n1 = int(input('Digite um nรบmero: '))
d = n1 * 2
t = n1 * 3
r = n1 ** (1/2)
print('O dobro de {} รฉ: {} \nO triplo รฉ: {} \nE a raiz quadrada รฉ: {}:'.format(n1, d, t, r)) |
18ff1a18dc3249fdb568f8c17805f9affe17413a | iCalculated/CMIMC2021AI | /AI1/bet_starter.py | 5,979 | 3.90625 | 4 | # Bet Starter File
# NOTE: You can run this file locally to test if your program is working.
#=============================================================================
# INPUT FORMAT: hand, others, card, scores
# hand: Your current hand (a list of integers 2 to 14)
# others: All other players' hands, i... |
e0e7c1dc4baed1ff72cad896085c0324de121d24 | morningfine/Lem_ck | /py_04day/ไฝไธ.py | 750 | 4.125 | 4 | """
nums = [1,22,33,4,7,-1] ==> [22,33,7]
ๆๅคงไบ5็ๆฐ่ฟๆปคๅบๆฅ๏ผๆพๅฐไธไธชๆฐๅ่กจไธญ
"""
# ไฝฟ็จๅฐฝๅฏ่ฝๅฅฝ็ๆนๆณ๏ผไปๅคไธชๆดๆฐ็ปๆ็ๅ่กจไธญ่ฟๆปคๅบๅคงไบ5็ๆฐใ๏ผๅฏไปฅ่ฏ็ๅคๅๅ ็งๆนๆณ๏ผ
"""
nums = [1,22,33,4,7,-1] ==> [22,33,7]
ๆๅคงไบ5็ๆฐ่ฟๆปคๅบๆฅ๏ผๆพๅฐไธไธชๆฐๅ่กจไธญ
"""
def filter1(li: list):
li1 = []
for i in li:
if i > 5:
li1.append(i)
return li1
def filter2(li: list... |
8e2c23b15bfebbb3a9ab18bd3187c93a503a760d | sanshitsharma/pySamples | /matrix/set_rc_zeros.py | 2,275 | 3.96875 | 4 | #!/usr/bin/python
'''
Given a matrix, if an element a[i][j] is 0, set all other elements in row i and col j to 0
'''
class Solution(object):
def setZeroesInPlace(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
""... |
c017305d17afc778acfdf346082ecd6dbb18c65a | voidfemme/pcc_cis-122 | /lab4.py | 4,933 | 3.5625 | 4 | __author__ = "Rose S Proctor"
# This program is a story about an AI.
# Checklist
# At least one input AND one output
# Validate user input
# Two loops, in meaningful ways
# Separate modules
# Use parameters, not global values
# Full Pseudocode
########################################################################... |
404ef01dc559c7243855f1c53ca5d0d5fcf6ab99 | sinantasli/pythonExamples | /faktoriyel.py | 465 | 3.75 | 4 | import time
def faktoriyell(a):
a=int(a)
count =1
for i in range(1,a+1):
count *=i
return count
while True:
sayฤฑ=input("lรผtfen bir sayฤฑ giriniz .")
if(sayฤฑ=='q'):
print("Programdan รงฤฑkฤฑlฤฑyor ...")
time.sleep(1)
print("Program sonlandฤฑ.")
break
else:
... |
8ee2d1558c31aec7a913597f7da7588b088374a7 | Programmer-Admin/binarysearch-editorials | /Linked List Union.py | 386 | 3.59375 | 4 | """
Linked List Union
The lazy way is the best way, don't let anyone tell you otherwise.
"""
class Solution:
def solve(self, ll0, ll1):
s=set(it(ll0))|set(it(ll1))
head=prev=LLNode(None)
for x in sorted(s):
prev.next=LLNode(x)
prev=prev.next
return head.next
... |
f90cb8fe0787d784a8beba8c26c074d1f0bf84b9 | lydxlx1/LeetCode | /src/_1027.py | 541 | 3.65625 | 4 | """
LeetCode 1027 - Longest Arithmetic Sequence
O(n^2)-time DP
"""
from typing import *
class Solution:
def longestArithSeqLength(self, A: List[int]) -> int:
ans = 2
f = {}
for i in range(1, len(A)):
for j in range(0, i):
diff = A[i] - A[j]
len... |
14334b306ef0cdb9a157dba4f7322cb816ec9296 | jeettrivedi/vaccination-rates-datajam-team4 | /scripts/rename_socio_df_columns.py | 411 | 3.5625 | 4 | import pandas as pd
# read csv file with old column names and new column names
dict_from_csv = pd.read_csv('data/map_col_names.csv', header=None, index_col=0, squeeze=True).to_dict()
# read in .csv with socioeconomic data
data_df = pd.read_csv('data/..')
# rename columns
data_df = data_df.rename(dict_from_csv, axis =... |
1c6ad70e606ffcc4c56cf3020c04de3b0780a303 | iammoda/coding_problems | /flatten binary tree/flatten_BT.py | 559 | 3.53125 | 4 | class BinaryTree:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def flattenBinaryTree(root):
inOrderNodes = getInOrder(root, [])
for i in range(0, len(inOrderNodes) -1):
leftNode = inOrderNodes[i]
rightNode = inOrderNodes[... |
7b6b01898c86cda1e93cc7db5d932e9a6f4f8f39 | jam941/hw | /college.py | 3,556 | 4.53125 | 5 | """
CSCI-141 Computer Science 1 Recitation Exercise
11 - Stacks and Queues
Queue Exercise - College Things
Given a dictionary of things that are associated with different
colleges, create a queue and display the elements from the
dictionary that match the college, in the order they appear
in the dictionary.
For examp... |
f3ca49ac484809d68e5782a2ee5bf47220fd1a3f | maryguada/Algorithm_Practice- | /anagram_palindrome.py | 1,032 | 4.21875 | 4 | # given a string, return True or False if the word consist of an anagram in a palindrome
# hint : use dictionary to keep track of key and value pairs
def anagram_of_palindrome(word):
a = {}
for letter in word:
# this is how we keep track of key & value pairs
# take note of .get!! "a.get" the ... |
8c6576c41174c9dbbcd64f88b98882c4aca35040 | scnsh/CompetitiveProgramming | /AtCoder/BeginnerContest126/myans/b.py | 269 | 3.875 | 4 | s = input()
a = int(s[:2])
b = int(s[2:])
is_MMxx = is_xxMM = False
if 13 > a > 0:
is_MMxx = True
if 13 > b > 0:
is_xxMM = True
if is_MMxx and is_xxMM:
print("AMBIGUOUS")
elif is_MMxx:
print("MMYY")
elif is_xxMM:
print("YYMM")
else:
print("NA")
|
274e6c6266d21caf02fe3ecda6c0bd188b256b21 | apoorvasharma007/networks | /server_invert_image.py | 2,000 | 3.953125 | 4 | #Apoorva Sharma 510817044
#The intuition for the program is fairly simple. An image is a 2 dimensional matrix and we can invert it by inverting the intensity of each pixel of the image. For this program I have used a library openCV which makes the task of reading and writing images as a 2D matrix in a program simple... |
4b31df75cadd2ed00ad135705349ee5b270ec737 | DilanRanawaka/hacktoberfest2021-2 | /Simple Python Programs/leapyear.py | 231 | 4.1875 | 4 | #To see if a year is leap year or not.
print("Enter the Year: ")
y = int(input())
if y%4==0 and y%100!=0:
print("\nIt is a Leap Year")
elif y%400==0:
print("\nIt is a Leap Year")
else:
print("\nIt is not a Leap Year")
|
b0c3e3e2cfc948fce954d75c854363cab33fca31 | eronekogin/leetcode | /2020/generate_random_point_in_a_circle.py | 778 | 3.96875 | 4 | """
https://leetcode.com/problems/generate-random-point-in-a-circle/
"""
from typing import List
from random import uniform
class Solution:
def __init__(self, radius: float, x_center: float, y_center: float):
self.xMin, self.xMax = x_center - radius, x_center + radius
self.yMin, self.yMax = y_c... |
47c1ccbe9172b24ebeaa58a23e891a6eae0a848f | HannaKulba/python_homeworks | /homework_1/4_words_in_text.py | 395 | 4.03125 | 4 | text_array = input().split()
popular_word = ""
count_popular_word = 0
long_word = ""
length_long_word = 0
for word in text_array:
if text_array.count(word) > count_popular_word:
count_popular_word = text_array.count(word)
popular_word = word
if len(word) > length_long_word:
length_long... |
bd489567b0a9be16e276a3f395c54b31a8d11403 | 77dx/flins_thyroid_H5 | /study/cookbook/demo2.py | 4,193 | 4.15625 | 4 | # -*- coding:utf-8 -*-
'''
ๅฆๆไธไธชๅฏ่ฟญไปฃๅฏน่ฑก็ๅ
็ด ไธชๆฐ่ถ
่ฟๅ้ไธชๆฐๆถ๏ผไผๆๅบไธไธช ValueError ใ
้ฃไนๆๆ ทๆ่ฝไป่ฟไธชๅฏ่ฟญไปฃๅฏน่ฑกไธญ่งฃๅๅบ N ไธชๅ
็ด ๅบๆฅ๏ผ
Python ็ๆๅท่กจ่พพๅผๅฏไปฅ็จๆฅ่งฃๅณ่ฟไธช้ฎ้ขใๆฏๅฆ๏ผไฝ ๅจๅญฆไน ไธ้จ่ฏพ็จ๏ผๅจๅญฆๆๆซ็ๆถๅ๏ผ
ไฝ ๆณ็ป่ฎกไธๅฎถๅบญไฝไธ็ๅนณๅๆ็ปฉ๏ผไฝๆฏๆ้คๆ็ฌฌไธไธชๅๆๅไธไธชๅๆฐใๅฆๆๅชๆๅไธชๅๆฐ๏ผ
ไฝ ๅฏ่ฝๅฐฑ็ดๆฅๅป็ฎๅ็ๆๅจ่ตๅผ๏ผ ไฝๅฆๆๆ 24 ไธชๅข๏ผ่ฟๆถๅๆๅท่กจ่พพๅผๅฐฑๆดพไธ็จๅบไบ๏ผ
'''
def drop_first_last(grades):
first,*middle,last = grades
return avg(middle)
#็ฌฌ... |
8e86168151d284c59f9a9e62c6e1f9b2ece58375 | MarshalLeeeeee/myLeetCodes | /228-summaryRanges.py | 1,501 | 3.5625 | 4 | '''
228. Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.
Example 1:
Input: [0,1,2,4,5,7]
Output: ["0->2","4->5","7"]
Explanation: 0,1,2 form a continuous range; 4,5 form a continuous range.
Example 2:
Input: [0,2,3,4,6,8,9]
Output: ["0","2->4","6","8->9"]
Explanati... |
eb2e48318e7a29aeba7e99cdaf9fc1e53662f1d7 | zcfnc/Spider | /Library/test.py | 465 | 3.5625 | 4 | import os
def file_name(file_dir):
bookname = []
n=0
for root, dirs, files in os.walk(file_dir):
# print(root) # ๅฝๅ็ฎๅฝ่ทฏๅพ
# print(dirs) # ๅฝๅ่ทฏๅพไธๆๆๅญ็ฎๅฝ
# print(files) # ๅฝๅ่ทฏๅพไธๆๆ้็ฎๅฝๅญๆไปถ
n+=1
if(n==1):
bookname = dirs
print(bookname)
fo... |
38f0b075b0f4cb3ffb2f0037c0d0a9d0e81b7e1c | legoktm/pythonwikibot | /wiki/timedate.py | 2,171 | 4.1875 | 4 | #!usr/bin/python
import time, datetime
"""
Not to be run as a file
Contains lists and dictionaries to help with dates
Only for English Language, however translations are welcome.
"""
MonthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'... |
1255a363358e1938fc7cbf91a4fe25f5e662e7bc | jourdanbua7275/Rock-paper-scissors | /game.py | 2,041 | 3.8125 | 4 |
# game.py
import random
import os
import dotenv
dotenv.load_dotenv()
PLAYER_NAME = os.getenv("PLAYER_NAME")
#introduction
print("Rock, Paper, Scissors, Shoot!")
print("-------------------------------------------------------")
print("Welcome " + PLAYER_NAME + " to my Rocks, Paper, Scissors game." )
print("-... |
fb2cd8147a484c08fcc1f1d399aa1dac9d0f0b4d | dingchen2020/python_unit | /unit3/u04_ex_06.py | 965 | 3.6875 | 4 | from u03_ex_03 import encrypt,่งฃๅฏ
def removeChar(str: object, index: object):
s1 =str[:index]
s2 =str[index+1:]
# print(s1)
# print(s2)
return s1 +s2
def removeDupChar(str):
newStr =""
for ch in str:
if newStr.find(ch ) <0:
newStr+=ch
return newStr
def ็ๆๅฏ็ (n):
... |
4e04bf58680aec2cab7f753677088e864e23d943 | lafleur82/python | /Final/solve_triangle.py | 552 | 4.28125 | 4 | from math import sqrt
def solve_triangle(side_a, side_b):
"""The Pythagorean equation for a right triangle is a^2 + b^2 = c^2 , where c is the hypotenuse while a and b
are the remaining sides. Calculate all values for right triangles when the sides are no greater than 20."""
if side_a < 20 and side_b < ... |
d66d8e75cba1a275911899132b11b2e593f8b469 | murali-kotakonda/PythonProgs | /PythonBasics1/oopsinstance/Ex0.py | 291 | 3.71875 | 4 | def Display():
print("hello im in global function")
class Data:
def show(self):
print("hello im a instance function")
# how to call global function
Display()
# how to call instance function
#1.create the object
d = Data()
#2.call the method using the object
d.show() |
e3b4388ea509878598ce1b450d98d57a74e9542d | mnur53/code_jam | /2018/Qualification/1_saving_the_universe/save_universe.py | 1,481 | 3.828125 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def build_hack_tree(program):
current_dmg = 0
power = 1
command_potential = []
hack_efficiencies = []
for command in program:
if command == "C":
command_potential.append(power)
power = power * 2
else:
... |
797d6e79bc4e4caf9ced05358cad5d26c73fc96f | Aayush360/Shamshad_Ansari_CV_ANN | /list_3_8.py | 1,263 | 3.875 | 4 | """Bitwise operations:
# for grayscale binary image, the pixel value 0 means off and all value greater than 0 means on
# bitwise AND operations of two image array calculates element-wise conjunction or array and scalar
# bitwise OR operation perform element-wise disjunction of two array or between array and scalar
... |
35f56004ee8493d4506cda0ec74a3acd5ac65729 | baiyecha404/coding-week | /func.py | 1,771 | 3.5625 | 4 | import re
from TruthTable import Truths
OPERATORS = {'/\\': "โง", "\/": "โจ", "->": "โ", "equal": "โ", "not": "~"}
def sanatizeInput(expression):
for operator in OPERATORS:
expression = expression.replace(operator, OPERATORS[operator])
return expression
def getVariables(expression):
"""
regex... |
3e0ba7c00b3094dcedaeff848ecc095a9a40caf9 | mccclxxvii/python | /Infopulse/task_int_08.py | 281 | 3.765625 | 4 | import re
a = input("ะฒะฒะตะดะธัะต ะดะฒัั
ะทะฝะฐัะฝะพะต ัะธัะปะพ: ")
if re.search('^[1-9][0-9]$',a):
a = int(a)
b1 = a % 10
b2 = a // 10
b = b1*10+b2
print ('ะัั
ะพะดะฝะพะต =',a,'; ะะฐะพะฑะพัะพั =',b)
else:
print(a,'- ััะพ ะฝะต ะดะฒัั
ะทะฝะฐัะฝะพะต ัะธัะปะพ') |
787d672bae6ccf8fd6ade5c418e0771c5bde8ef5 | eminom/py-simple-tutorial | /chapter8/7.py | 290 | 3.640625 | 4 | class MyError(Exception):
def __init__(self, value):
self.value = value
# def __str__(self):
# return repr(self)
try:
raise MyError(2*2)
except MyError as e:
print("My exception occured, value:", e.value)
print(e)
print(str(e))
print(repr(e))
|
54d703356a71d54322a10d4186d61e3a3523b69f | lk0423/data-science | /exp2/Discrete_Probability_distribution.py | 2,268 | 3.53125 | 4 | # -*- coding: utf-8 -*-
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
#1. ไบ้กนๅๅธ
def binom_dis(n=1, p=0.1):
"""
ไบ้กนๅๅธ๏ผๆจกๆๆ็กฌๅธ่ฏ้ช
:param n: ๅฎ้ชๆปๆฌกๆฐ
:param p: ๅๆฌกๅฎ้ชๆๅ็ๆฆ็
:return: ่ฏ้ชๆๅ็ๆฌกๆฐ
"""
bin_dis = stats.binom(n, p) #ไบง็ไธไธชไบ้กนๅๅธ
X = bin_dis.rvs() # ็ฌฆๅ่ฏฅๅๅธ็ไธไธช้ๆบๅ้X,ๅๅผ่กจ็คบๅบ... |
7807b639915238fdf428707c5491b92172ebd7c6 | daniellebunker/intro-to-ubermelon | /process.py | 1,388 | 4 | 4 | #My answers:
log_file = open("um-server-01.txt")
#opens log_file which contains sales report info
def sales_reports(log_file):
"""Displays sales report for Mondays"""
for line in log_file:
#iterate over each line in log_file
line = line.rstrip()
#strips trailing characters of line and sto... |
9f1cc773585adf12444922f203dbb5eb8c173357 | Ahtisham-Shakir/Python_Basics | /Basic Programs/tut_39.py | 184 | 3.640625 | 4 | # F strings
import math
me = "Harry"
a1 = 3
# a = "this is %s %s"%(me, a1)
# a = "This is {1} {0}"
# b = a.format(me, a1)
# print(b)
a = f"this is {me} {a1} {math.cos(65)}"
print(a)
|
e6e5b462372d5f80ab1edc5f30936ffdf22fdab9 | ZhenghaoJi/Leetcode.Medium | /0125.py | 626 | 3.578125 | 4 | class Solution:
def isPalindrome(self, s: str) -> bool:
if len(s)==0:
return True
l = 0
r = len(s) -1
# I don`t know isalnum(), and i used a stupid way to describe number and abc.
# Then I can`t pass 0p hhh --
while(l < r):
if(not s[l].isalnum()):
... |
cd0012371e71f2d9ba4739beab15634e1b259c2f | ilimugur/yapaybeyan.at | /getContent.py | 3,158 | 3.609375 | 4 | import urllib2
from BeautifulSoup import BeautifulSoup, NavigableString
import re
def getDomainURL(url):
slashToLookFor = 1
if url.find("http://") > -1 or url.find("https://") > -1:
slashToLookFor = 3
endIndex = 0
for i in range(0, slashToLookFor):
endIndex = url.find("/", endIndex) + 1... |
448c0524817675fdf4274a533f027aa5b4b348fe | jianglin521/learn_python | /day02/04่ฟญไปฃๅจ.py | 372 | 4.0625 | 4 | # ่ฟญไปฃๅจ
a = list() # ่ฝฌไธบlist
print(a)
b = 'jianglin'
b = list(b)
print(b)
c = (1, 1, 23, 45, 78, 4, 2, 10)
c = list(c)
print(c, type(c))
d = tuple(c) # ่ฝฌไธบๅ
็ป
print(d, type(d))
print(len(b)) # ่ฟๅ้ฟๅบฆ
print(max(c)) # ่ฟๅๆๅคงๅผ
print(min(c)) # ่ฟๅๆๅฐๅผ
e = (3.1, 2.3, 4.5)
print(sum(e)) # ๆฑๅ
print(sorted(c)) # ไปๅฐๅฐๅคงๆๅบ |
530d36dfa83b03754f32c96e22ea54744f69138d | listenviolet/leetcode | /055-Jump-Game.py | 519 | 4.03125 | 4 | def canJump(nums):
"""
:type nums: List[int]
:rtype: bool
"""
def move(left, i):
if left == 0 and i == len(nums) - 1: return True
elif i >= len(nums) - 1 and left != 0: return False
for take in range(nums[i], 0, -1):
res = move(left - take, i + take)
... |
f522c7d39b0fc0f41fec48e15f155b458319105a | CarlosYiip/LeetCode | /frequencySort.py | 317 | 3.5 | 4 | from collections import Counter
from heapq import *
class Solution(object):
def frequencySort(self, s):
c = Counter(s)
l = [(c[key], key) for key in c]
heapify(l)
res = []
while l:
m = heappop(l)
res.insert(0, m[1]*m[0])
return ''.join(res)
|
d9564b10ea01caa2287aa209770020634549d2f5 | rekikhaile/Python-Programs | /2 function string logic/python_logic.py | 283 | 3.859375 | 4 | def combo_string(a,b):
if len(a) < len(b):
return a + b + a
else:
return b + a + b
print(combo_string('gutentag','hello'))
def combo_string(a,b):
if len(a) < len(b):
return a + b + a
return b + a + b
print(combo_string('gutentag','hello'))
|
dfe9ccec8d5ea8fdd158db201ef99764fe7678a0 | hxnterxhxnter/caesar_cipher | /Decrypter.py | 639 | 4 | 4 |
message = []
def decrypt(encryption, key):
for i in encryption:
letter_ascii = ord(i)
decrypted_letter = letter_ascii - key
other_letter = chr(decrypted_letter)
message.append(other_letter)
decrypted_text = convert(message)
print("-" * 60)
print(f"[+] encrypted mes... |
df31b2b57b14ca62c6cc032c38e193ab5d886a84 | Harrywekesa/Sqlite-database | /inforetrieval.py | 269 | 4.15625 | 4 | import sqlite3
#select first and last names of people over the age of 30
with sqlite3.connect("insert_many.db") as conn:
c = conn.cursor()
c.execute("SELECT First_name, Last_name FROM people WHERE Age > 20")
for row in c.fetchall():
print(row)
|
ab890fd30e7662ba7bf671a5ad2c3f33ca5271f5 | Brensterfrenster/Lesson-5 | /problem2.py | 285 | 4.03125 | 4 | from turtle import *
link = Turtle()
link.color('yellow')
link.pensize(6)
link.speed(0)
link.shape('turtle')
def drawTriangle():
for x in range(3):
link.forward(100)
link.left(120)
def drawPizza():
for x in range(18):
drawTriangle()
link.left(20)
drawPizza()
mainloop() |
0734ec9fce8be08c22df3ca2e08b3bcc39886fb6 | Ahmedziya/icp2 | /icp2.py | 974 | 3.875 | 4 | n = int(input("Enter number of students: "))
list1=[]
list2=[]
for x in range(n):
list1.append(float(input("Enter student "+str(x+1)+" weight: ")))
for x in range(n):
list2.append((list1[x]*0.454))
print("Weights of students in kgs: " +str(list2))
def string_alternative():
str= input("Enter the s... |
a5dcf4c2ef75047dda7cffb26499476d80119162 | DaVaHa/ScriptsLibrary | /Artikel.py | 819 | 3.703125 | 4 | '''
Print Article given a link.
'''
import sys
from newspaper import Article
# read user input
#print(sys.argv)
if len(sys.argv) > 1:
url = str(sys.argv[1]).strip()
else:
print("\n>> No URL given. Please provide a URL as argument.\n")
sys.exit()
# download article
print("\n>> Downloading article...")
arti... |
6d44fd3aa220b916c2f9f6e29089077934c171e3 | rego1989/GitLibrary | /PythonLearning/Exercises100/100-000/100-000.py | 1,011 | 3.96875 | 4 | # -*-coding:UTF-8-*-
"""
PIL.ImageDraw.Draw.text(xy, text, fill=None, font=None, anchor=None)
Draws the string at the given position.
Parameters:
xy โ Top left corner of the text.
text โ Texta to be drawn. If it contains any newline characters, the text is passed on to mulitiline_text()
fill โ Color to use for the tex... |
acd2347fe99d1e374773f88a2d64e202a39eec75 | LiliaSkaletska/amis_python71 | /km71/Skaletska_Liliia/4/task2.py | 155 | 4.09375 | 4 | x = float(input("Enter value of function: "))
if x > 0:
result = -1
elif x < 0:
result = -1
else:
result = 0
print("sign(x)=", result)
|
994db786095b6005600f28653ea96334b3472c5e | SpikyClip/rosalind-solutions | /bioinformatics_stronghold/LIA_independent_alleles.py | 4,670 | 4.0625 | 4 | # url: http://rosalind.info/problems/lia/
# Problem
# Figure 2. The probability of each outcome for the sum of the values on
# two rolled dice (black and white), broken down depending on the number
# of pips showing on each die. You can verify that 18 of the 36 equally
# probable possibilities result in an odd sum.
#... |
33bb80bec97ca5476a6b431dd54870181c0cd953 | strengthen/LeetCode | /Python3/133.py | 1,908 | 3.59375 | 4 | __________________________________________________________________________________________________
sample 32 ms submission
"""
# Definition for a Node.
class Node:
def __init__(self, val, neighbors):
self.val = val
self.neighbors = neighbors
"""
class Solution:
def cloneGraph(self, node: 'Node')... |
08239268e210edd2c9e93799eace2c6c1368aea2 | hsiaotingluv/20181221_Python | /20200326 (shell) (zh).py | 2,142 | 3.765625 | 4 | Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> for x in range(1,10):
print(x, end = " ")
1 2 3 4 5 6 7 8 9
>>> for x in range(1,10):
print(x, end = " ")
print("dljfaskd")
1 dljfaskd
2 ... |
edbec9f7184f4d5e3f16e5ee5069680142da5cc2 | Anvar1511/hangman | /hangman.py | 1,757 | 3.71875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun May 9 16:23:58 2021
@author: Anvar
"""
import random
words_list = ["baxt", "salomatlik", "boylik"]
chosen_word = random.choice(words_list)
display = []
word_len = len(chosen_word)
stages = [''' +---+
| |
O |
/|\ |
... |
9cee8f6c74a3ff970b28ea1a5617d93dde035c56 | daniel-reich/ubiquitous-fiesta | /2iETeoJq2dyEmH87R_8.py | 124 | 3.765625 | 4 |
def count_digits(n, d):
num_arr = list(x**2 for x in range(0,n+1))
return str(list(x for x in num_arr)).count(str(d))
|
434ffe9f6696877d631a9f9a96c3a5c9731bc1a5 | green-fox-academy/ilcsikbalazs | /week-02/day-2/34exercise.py | 597 | 4.21875 | 4 | # Write a program that stores a number, and the user has to figure it out.
# The user can input guesses, after each guess the program would tell one
# of the following:
#
# The stored number is higher
# The stried number is lower
# You found the number: 8
number = int(input("Guess a number: "))
import random
r = rand... |
976bbae90308bab7a95ab2e9a25026e5c9922350 | tanersyn/Project-Euler | /Problem09.py | 397 | 3.671875 | 4 | # ฤฐki sayฤฑnฤฑn karesinin toplamlarฤฑ bir sayฤฑnฤฑn karesine eลit olan sayฤฑlarฤฑ bulunmalฤฑ ve 3 sayฤฑnฤฑn toplamฤฑ 1000 olmalฤฑ.
# Bu รผรง sayฤฑyฤฑ nedir?
def Bul():
maksimum = 1000
for a in range(1,maksimum+1):
for b in range(a+1,maksimum+1):
c = maksimum - a - b
if a * a + b * b == c... |
127e3a0aeef7536344cac201e422cd71c9f3678b | Vermit1110/Gamecube_Michael | /Gamecube_Michael/Gamecube_Michael.py | 4,691 | 3.953125 | 4 | #My progression variable to determine which game to go to
nextgame = 1
#Start score for games
score = 0
import pickle
while True:
print("""
Welcome to Michaels text adventure game
1: New Game 2: Highscore 3: Load Game
""")
menuchoice = ... |
91c67029fa74f2ddf06dc7897358923d365aca76 | dankoga/URIOnlineJudge--Python-3.9 | /URI_3068.py | 521 | 3.609375 | 4 | farm_x1, farm_y1, farm_x2, farm_y2 = map(int, input().split())
test_number = 1
while all([farm_x1, farm_x2, farm_y1, farm_y2 != 0]):
meteor_qty = int(input())
meteor_inside = 0
for m in range(meteor_qty):
meteor_x, meteor_y = map(int, input().split())
meteor_inside += int((farm_x1 <= meteor_... |
f5e542c2a84644372db319c8d81ffc57a3214080 | ChangxingJiang/Python-DM-Homework-W4-W5 | /Week-04/0402/Exercise-0402-้็ๅคฉ.py | 904 | 4.03125 | 4 | '''
Pythonๆฐๆฎ้้ๆกไพ(2)๏ผSeleniumๅฎ็ฐ็็ซ็ผ็ฝๆญ็ญๅบฆ้้
'''
from selenium import webdriver
browser = webdriver.Chrome(executable_path=r"C:\Users\lenovo\Python38\chromedriver.exe") # ChromeDriverๅฏๆง่กๆไปถ็่ทฏๅพ
browser.get("http://piaofang.maoyan.com/dashboard/web-heat")
for movie_label in browser.find_elements_by_css_selector("#app > div > ... |
72c90a31d3e233decc52f1ab5b427ef45374e7dd | mhhg/FarsStat | /core/SeperatingGroup.py | 520 | 3.515625 | 4 | from collections import defaultdict
class SeperatingGroup():
def __init__(self, var, group):
self.var = var
self.group = group
def sepreat_group(self):
value = self.var
gr = self.group
group_list = []
for i in range(0, len(value)):
temp = []
... |
a0a68ef8ecb945cc6f38fdc8ce09498f4c621188 | Chinechelum/Rock-Paper-Scissors-Game | /R_P_S.py | 4,158 | 4.21875 | 4 | #Implementing the rock-paper-scissors game
import random
options = ["rock", "paper", "scissors"]
def mode_1():
def display_choice(choice):
random.shuffle(options)
if choice == 1:
print(f"You have chosen {options[0]}")
return options[0]
elif choice == ... |
deaf921bb9ae685431c9b3b08f0536c51f688ed0 | antithalian/advent-of-code-2020 | /day02/day2_q1.py | 843 | 3.828125 | 4 | # day 2 question 1
# password database
# should be as simple as counting occurrences
# input processing
pw_db = []
with open('input.txt', 'r') as file:
for line in file:
# reformat line for splitting
line = line.replace('-', ';')
line = line.replace(': ', ';')
line = line.replace(... |
6b4f53d8087f3330f03a422d22506411b56c6259 | andyyu/coding-problems | /rotated_array.py | 348 | 3.734375 | 4 | def find_initial_element(nums):
if not nums:
return None
left = 0
right = len(nums)-1
while left < right:
mid = (left+right)/2
if nums[mid] < nums[left]:
right = mid
elif nums[mid] > nums[right]:
left = mid + 1
else:
return nums... |
e9e4f9766ed81e21d30b553d14aed3968b732f48 | iswetha522/Plural_Sight | /corepy/iterations/sets.py | 1,131 | 4.1875 | 4 | # SETS: Unordered collection of unique items
# sets are mutable
# Elements in a set must be immutable
# Sets removes duplicate objects from the list
# set uses shallow copy method
p = {6, 28, 496, 8128, 33550336}
print(p)
print(type(p))
d = {}
print(type(d)) # dictionay
e = set()
print(e)
s = set([2, 4, 16, 64, 409... |
d6a1628f9376939e4fc081e495d3f398e10cf2ee | eyyeung/queue_deque | /deque.py | 1,839 | 4.03125 | 4 | class Deque:
def __init__(self):
self.items= []
def enqueue_back(self,item):
self.items.append(item)
def enqueue_front(self,item):
self.items.insert(0,item)
def dequeue_front(self):
return self.items.pop(0)
def dequeue_back(self):
return se... |
15c2da7baff1591def7c7d9bef5078e506b3d522 | grit4/Python-Programs | /Unit 3/p_3.4.py | 443 | 3.75 | 4 | import random
def roll():
dice1=random.randint(1,6)
dice2=random.randint(1,6)
print(" ",dice1," ",dice2)
return dice1+dice2
def crap():
print("Dice1 Dice2")
sum=roll()
if sum in [2,3,12]:
return "LOSE"
elif sum in [7,11]:
return "WIN"
while True:
s=ro... |
2ca26f0cd02bc91b939ee96cbcc3ae1ca614b671 | apugba123/python | /while_loop.py | 316 | 4 | 4 | #def while_loop(number1, number2):
# i = number1
# while (i < number2):
# i = i + 1
#if (i % 2 == 0):
# print i
def print_two_numbers(begin, end):
#for i in reversed(range(begin, end)): //
for i in range(end, begin, -1):
if (i % 2 == 0):
print i
print_two_numbers(4, 10)
#while_loop(4, 10)
|
e4b19f43c9f1791b3973e77a34640815c8bbc624 | sudhanshuptl/MyCodeDump | /Python/Algorithm/QuickSelect.py | 1,654 | 3.515625 | 4 |
class QuickSelect:
def __init__(self, data_list):
if not isinstance(data_list, list):
raise ValueError('Data should be in list format')
self.arr = data_list
def quick_select(self, target_index, base, end):
if base > end:
return
pivot = self.partition(bas... |
9ea08cd3b538e329cb5089d77f08525cb1fec00d | Rasmusa91/python-adventure-game | /objectTroll.py | 1,409 | 3.9375 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Adventure object
"""
from object import AdventureGameObject
class AdventureGameObjectTroll(AdventureGameObject):
"Adventure Game Object"
class State:
"States of the"
alive = 1
dead = 2
state = State.alive
def getName(s... |
dfef24611e5a641c1a8ef7f3ae27f3822985aa4c | geniustom/cvpy | /api_voice_recogn.py | 491 | 3.515625 | 4 | # -*- coding: utf-8 -*-
import speech_recognition
from pydub import AudioSegment
def trans_mp3_to_wav(filepath):
song = AudioSegment.from_mp3(filepath)
song.export("now.wav", format="wav")
trans_mp3_to_wav("voice_test.mp3")
r = speech_recognition.Recognizer()
with speech_recognition.AudioFile("now.wav") ... |
61cb408e8d64f5660814fcdef8a69a11a2d97309 | DevGab5/PyWhatKit | /pywhatkit/handwriting.py | 411 | 3.578125 | 4 | import requests
def text_to_handwriting(
string: str, save_to: str = "pywhatkit.png", rgb: tuple = (0, 0, 0)
) -> None:
"""Convert the given String to Handwritten Characters"""
data = requests.get(
f"https://pywhatkit.herokuapp.com/handwriting?text={string}&rgb={rgb[0]},{rgb[1]},{rgb[2]}"
).c... |
923fff590ba38d53a4035422b914d1316bd6507a | Llari7/mi_primer_programa | /modulo_sleep_ficheros/adivina_el_numero_random.py | 310 | 3.90625 | 4 | from random import randint
from time import sleep
winner_number = randint(1, 10)
user_number = int(input("ยฟCรบal es el nรบmero ganador? (1-10) "))
sleep(3)
if user_number == winner_number:
print("ยกFelicidades, has ganado!")
else:
print("Incorrecto, el nรบmero ganador era {}".format(winner_number)) |
987cbd574cef4f78bac0b511ac55745b85f5d69f | loggar/py | /py-core/list/list.1.py | 1,157 | 4.4375 | 4 | list1 = ['abcd', 786, 2.23, 'john', 70.2]
tinylist = [123, 'john']
print(list1) # Prints complete list
print(list1[0]) # Prints first element of the list
print(list1[1:3]) # Prints elements starting from 2nd till 3rd
print(list1[2:]) # Prints elements starting from 3rd element
print(tinylist * ... |
0e438d850aabfa6c6a1202147af291317e0790a5 | VineetPrasadVerma/GeeksForGeeks | /SudoPlacementCourse/ReverseBits.py | 184 | 3.734375 | 4 | for _ in range(int(input())):
n = int(input())
binary_num = '{0:032b}'.format(n)
binary_num = binary_num[::-1]
decimal_from = int(binary_num, 2)
print(decimal_from) |
201b1510d7c88fd2c356690a0e72a9c1bd4ddf36 | aidaimurat/test3 | /test3.py | 2,532 | 4 | 4 | #5
class Animal:
def speak(self):
print(I cant speak)
class Dog(Animal):
def sound(self):
print(But i say gaw gaw)
class Cat(Animal):
def sound(self):
print(But i say myau myau)
dog = Dog()
dog.speak()
dog.sound()
#6
class Encapsulation:
__name = None
def... |
9e9e47bd0be09e81256586882afe56d12662593a | MohithS04/My_Captain_Projects | /positive numbers.py | 389 | 3.703125 | 4 | Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> list1 = [12,-7,5,64,-14]
>>> list2 = [12,14,-95,3]
>>> for num in list1:
if num >= 0:
print(num, end = " ")
12 5 64
>>> for num in... |
d1e5166754a8aafe046f59cac5e2beacbf862bae | giovannicappabianca/Algorithms | /src/SortingAlgorithm/QuickSorter.py | 1,104 | 3.8125 | 4 | from src.SortingAlgorithm.Sorter import Sorter
class QuickSorter(Sorter):
def sort(self, collection, asc):
self.quicksort(collection, 0, len(collection)-1, asc)
def quicksort(self, collection, p, r, asc):
if p < r:
q = self.partition(collection, p, r, asc)
self.qui... |
504a2fec8a559e6833a078a1cf0b5bacf376c9f4 | Lusarom/progAvanzada | /ejercicio12.py | 557 | 3.96875 | 4 | from math import radians, cos, sin, asin, sqrt
print('Introduce Latitud y Longitud:')
Latit1= float(input('Latitud 1:'))
Long1= float(input('Longitud 1:'))
Latit2= float(input(' Latitud 2:'))
Long2= float(input('Longitud 2:'))
Long1= radians(Long1)
Long2= radians(Long2)
Latit1= radians(Latit1)
Latit2= r... |
d6d7e570dd133b289719fe652739a1306c6ad45b | lenaindelaforetmagique/ProjectEuler | /Python/PE093.py | 1,975 | 3.59375 | 4 | ##Problem 93
##
##By using each of the digits from the set, {1, 2, 3, 4}, exactly once, and making use of the four arithmetic operations (+, โ, *, /) and brackets/parentheses, it is possible to form different positive integer targets.
##
##For example,
##
##8 = (4 * (1 + 3)) / 2
##14 = 4 * (3 + 1 / 2)
##19 = 4 * (2 + 3... |
193d4f9b31c2a3afddd1625ef784abe7ed4c4903 | kalietong/parseltongue_part2 | /03_palindrome.py | 435 | 4.28125 | 4 |
import string
def remove_punctuations(word):
return "".join(i.lower() for i in word if i not in string.ascii_letters)
def reverse(text):
return text[::-1]
def is_palindrome(text):
text = remove_punctuations(text)
return text == reverse(text)
something = input("Enter the text which may be a palindrom... |
dcd1f740fd5a8e135c6f74832dd4e81654447868 | ilkkaaw/quiz | /peli.py | 823 | 3.9375 | 4 | quiz = {
1: {"question": "Who was the leader for the group?", "answer" : "rick"},
2: {"question": "Who is Carol's best friend?", "answer" : "deryl"},
3: {"question": "Who was killed rather dramatically with a baseball bat in the Walking Dead?", "answer" : "glenn"},
4: {"question": "Who delivered the dea... |
363749ea2edae5beff4a1b0187426c3f5cfd2875 | kailash-manasarovar/GCSE_code | /class_notes/arrays_1d_and_2d.py | 2,891 | 3.78125 | 4 | # normally a list is OK
# arrays better for large amounts of data and when doing mathematical calculations on the data
# list
# l = [1.0, 2.0, 3.0]
# print(type(l))
# #
# print(l)
# a = array(l)
# print(a)
# print(a.shape)
# print(a.dtype)
#
# from numpy import empty
# a = empty([3,3])
# print(a)
# print(a.shape)
#... |
976066571eedb7e888d47c5934a0f3dafd3c1baa | micromass/Noah | /Nicolas LA/linearcombination.py | 590 | 4.15625 | 4 | #This program verifies whether one vector in R^3 is a linear combination of combination of two other vectors
def is_linear_combination(v1, v2, v3):
try:
scalar_3 = (v1[1]*v2[0] - v2[1]*v1[0])/(v3[1]*v2[0]-v3[0]*v2[1])
scalar_2 =(v1[0]/v2[0]) - (v3[0]/v2[0])*scalar_3
print(f"The first vector... |
04eeed77eb4a7806a1846a2444fdd8444a7ed352 | cjrzs/MyLeetCode | /ๆฐ็ปไธญ็็ฌฌKไธชๆๅคงๅ
็ด .py | 1,460 | 3.734375 | 4 | '''
coding:utf8
@Time : 2020/6/29 14:54
@Author : CJR
@File : ๆฐ็ปไธญ็็ฌฌKไธชๆๅคงๅ
็ด .py
้ข็ฎ้พๆฅ๏ผhttps://leetcode-cn.com/problems/kth-largest-element-in-an-array/
'''
from typing import List
import random
class Solution:
def findKthLargest(self, nums: List[int], k: int) -> int:
"""
ๆดๅ่งฃๆณ๏ผๅ
ๆๆฐ็ปๅๅบๆๅบ๏ผๅ ไธบๆฏๆพKไธชๆๅคง็ๅ
็ด
... |
d8050c8febf88a23015050ef3474c01026f4d76a | TheKerfuffle/python-projects | /helloworld.py | 109 | 3.828125 | 4 | print('Hello World!')
age = 20
first_name='John Smith'
new_patient=True
print(age)
input("What is your name?")
|
c457860c9bdbf71dffbc97b3513316d20dd835e5 | gohdong/algorithm | /leetcode/867.py | 479 | 3.65625 | 4 | from typing import List
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def transpose(self, matrix: List[List[int]]) -> List[List[int]]:
answer = [[] for _ in matrix[0]]
for i in range(len(matrix)):
for j in ra... |
baae9ce539c308fd6f1bbe6d1afbcc6c3b5143d6 | TraceTschidaUT/cs313e | /War.py | 10,234 | 3.78125 | 4 | # File: Dice.py
# Description: A game of war simulator
# Student's Name: Trace Tschida
# Student's UT EID: TRT729
# Course Name: CS 313E
# Unique Number: 51465
#
# Date Created: 9/24/2017
# Date Last Modified: 9/26/2017
import random
class Deck():
# initialize
def __init__(self):
# hold th... |
690e158d687d332078f3ab29116ad766964fda94 | Nimor111/101-v5 | /week2/file_problems/sum_numbers.py | 275 | 3.625 | 4 | # sum_numbers.py
from sys import argv
def sum_numbers():
sum_ = 0
with open(argv[1], 'r') as f:
sum_ = sum([int(x) for x in f.read().split(" ") if not x == ''])
return sum_
def main():
print(sum_numbers())
if __name__ == '__main__':
main()
|
5779ab09df52b7916c7c9d80b362efc6fc13239d | enterpreneur369/holbertonschool-higher_level_programming | /0x0B-python-input_output/3-write_file.py | 689 | 4.65625 | 5 | #!/usr/bin/python3
""" Module 3-write_file
Module that contains the function write_file
that write a text in the given filetext.
"""
def write_file(filename="", text=""):
""" Returns The numbers of characters written
A function that write a text and returns he
characters printed.
Args:
file... |
3b2b1bed00f4c05ab432b765b442dc656c7424fd | Hubwithgit89/PythonLearn | /may12/lamda expression filter,map,reduce.py | 438 | 3.859375 | 4 | #lambda expression filter
nums=[1,2,5,4,77,55,7,88,9,44]
print("nums= ",nums)
def eve(n):
return n%2==0
evensfun=list(filter(eve,nums))
print("evens using function= ",evensfun)
evens=list(filter(lambda n : n%2==0,nums))
print("evens using lambda= ",evens)
#MAP
doubles=list(map(lambda n : n*2,evens))
print("dou... |
3222c197c5608e2b95dc73d3abdd02c0611c1659 | solitaryowl/algoexpertsolutions | /hard/SubarraySort.py | 845 | 4.03125 | 4 | def subarraySort(array):
# Write your code here.
sArray = array.copy()
sArray.sort()
fromInd = -1
toInd = -1
for i in range(0, len(sArray)):
if sArray[i] != array[i]:
fromInd = i
break
for j in range(len(sArray)-1, 0, -1):
if sArray[j] != array[j]:
... |
d0df86ca18f771176ce6bd999fc41d2bcb98da28 | harshithkumar2/python_programes | /linked_list/linkd_list_prac.py | 328 | 3.71875 | 4 | class node:
def __init__(self,data=None):
self.data = data
self.next = None
class ll:
def __init__(self):
self.head = node()
def append(self,data):
new_node = node(data)
cur = self.head
while cur.next != None:
cur = cur.next
cur.next = n... |
3973fe976bcedf13c00962a0e1a98458fd2b95cc | Marciaq7296/FinTechWeek1 | /labs/test1.py | 1,243 | 4.375 | 4 | # print("Hello World")
# #Data types
# #anything between quotes is called a string
####### integers / numbers ######
# print(7)
# print(7+5)
# print(9-7)
# print(4-8)
# print(3*3)
# print(25/5)
# print(25/6)
# print(4**2)
# print(23%4)
###### functions and methods #######
# name = "John Jacob Jingleheimer Schmidt... |
16f7bc941b8f160d2890ac248611182b0a181516 | xiaeryu/LeetCode | /validSudoku.py | 1,340 | 3.71875 | 4 | #########################################################################
## LeetCode Number 67 Valid Sudoku
## Problem description can be found here:
## https://leetcode.com/problems/valid-sudoku/
## Python script
#########################################################################
class Solution:
# @param ... |
119f68627528950e664644e4fda75afdcacc7e07 | GhillieDhu/Archive | /bb/py/regula_falsi.py | 580 | 3.703125 | 4 | def find_root(func, a, b, tol):
aF = func(a)
bF = func(b)
if (abs(b - a) < tol):
return round(max(a, b) / tol) * tol
elif (aF == 0):
return a
elif (bF == 0):
return b
else:
c = (bF * a - aF * b) / (bF - aF)
cF = func(c)
if (cF * aF > 0):
... |
8009ae8c936077760634ffabedd8848ff0706c20 | prozacchiwawa/icfp2016 | /fract.py | 442 | 3.5625 | 4 | from math import sqrt
def float_of_fract(p,off=0,scale=1):
if type(p) == type(0.0):
return (p * scale) + off
else:
return (((float(p.numerator) / float(p.denominator)) * scale) + off)
def fract_dist(a,b):
ax = float_of_fract(a[0])
ay = float_of_fract(a[1])
bx = float_of_fract(b[0])... |
2e96e89de79440c811362a23769d6f12e16cee5d | loganmurphy/DC_2017_Python3 | /week1/hello_you2.py | 150 | 4.0625 | 4 | name = input("WHAT IS YOUR NAME?")
length = len(name)
print("HELLO, {}".format(name.upper()))
print("YOUR NAME HAS {} LETTERS IN IT!".format(length))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.