blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
cf8f18ec1b0e9ae0ee1bfce22be037b352681437 | afialydia/Intro-Python-I | /src/13_file_io.py | 982 | 4.1875 | 4 | """
Python makes performing file I/O simple. Take a look
at how to read and write to files here:
https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
"""
# Open up the "foo.txt" file (which already exists) for reading
# Print all the contents of the file, then close the file
# Note: pay close... |
2c23abc2f506ebd8d0b276c0bd159b02667ece1f | apabon03/python-basic-course | /strings.py | 566 | 4.03125 | 4 | myStr = "Hello World"
print(f"Mi saludo en ingles es: { myStr }")
print("Mi saludo en ingles es: {0}".format(myStr))
#print(dir(myStr))
print(myStr.upper())
print(myStr.lower())
print(myStr.swapcase())
print(myStr.capitalize())
print(myStr.replace('Hello', 'bye').upper()) #metodos encadenados
print(myStr.count('l'))... |
195c5794e88d74e1c8aac57f2e435fe1f963b74b | dinhthong/m3_handy_scripts | /check_output/check_output_duplicate_check.py | 2,168 | 3.5 | 4 | #!/usr/bin/python
#https://stackoverflow.com/questions/51800122/using-openpyxl-to-find-rows-that-contain-cell-with-specific-value-python-3-6/51801421
# component_code_list = [STT in Excel 1, Component Code, STT in Excel 2, Ma vat tu cu]
# first excel sheet name
# wb range for first sheet
#
from openpyxl import ... |
9e91a4f589096df6a5dd3d9f2ee3726cd0f20351 | neeraj08/spoj | /uj.py | 100 | 3.625 | 4 | while 1:
i,j=raw_input().split(' ')
i=int(i)
j=int(j)
if i==0 and j==0:
break
print pow(i,j)
|
d15f9b28307a2180cd2a1e7d6a6c7cf9deb6d85c | zuwannn/Python | /Tree based DSA/PerfectBinaryTree.py | 1,382 | 4.28125 | 4 | # perfect binary tree
'''
A perfect binary tree เป็น binary tree ชนิดหนึ่ง
โดยที่ทุกโหนดภายใน (internal node) ต้องมีโหนดย่อยสองโหนด
และ(leaf nodes) ทั้งหมดอยู่ในระดับเดียวกัน
'''
class Node:
def __init__(self, k):
self.k = k
self.right = self.left = None
# Calculate the depth
def calculateTheDepth(... |
c48dcb189abf82abb6bee0cac9b92777b6ab1380 | zuwannn/Python | /Tree based DSA/TreeTraversal.py | 1,029 | 4.21875 | 4 | # tree traversal - in-order, pre-order and post-order
class Node:
def __init__(self, item):
self.left = None
self.right = None
self.value = item
# left -> root -> right
def inorder(root):
if root:
# traverse left
inorder(root.left)
# traverse root
print(... |
e367ed81791d2dfc42e60202b1c12e8d75d47de8 | zuwannn/Python | /Tree based DSA/binary_tree.py | 1,362 | 4.21875 | 4 | #Binary Tree
"""
Tree represents the nodes connected by edges(Left Node & Right Node). It is a non-linear data structure.
-One node is marked as Root node.
-Every node other than the root is associated with one parent node.
-Each node can have an arbiatry number of chid node.
We designate one node as root node and then... |
183ba099250d645d37d4f56890e107f95b7666ad | DincerDogan/Dataquest-3 | /Data Analyst in Python/Step 1 - Introduction to Python/1. Python for Data Science Fundamentals/6. Functions Fundamentals.py | 5,945 | 3.53125 | 4 | ## 1. Functions ##
a_list = [4444, 8897, 6340, 9896, 4835, 4324, 10, 6445,
661, 1246, 1000, 7429, 1376, 8121, 647, 1280,
3993, 4881, 9500, 6701, 1199, 6251, 4432, 37]
sum_manual = 0
for list_element in a_list:
sum_manual += list_element
print(sum_manual)
sum(a_list)
## 2. Built-in Functions #... |
86e65f3ff0896bc5d29ab746843df5c7f790f873 | DincerDogan/Dataquest-3 | /Data Scientist In Python/Step 1 - Python Introduction/1. Python for Data Science Fundamentals/4. Conditional Statements.py | 5,443 | 3.625 | 4 | ## 1. If Statements ##
# INITIAL CODE
opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
free_apps_ratings = []
for row in apps_data[1:]:
rating = float(row[7])
# Complete the code from here
# SOLUTION CODE
free_apps_ratings = []
for row in ... |
8f86446f3de74aca8bd3441bffc2ba9aef301624 | d-yuji/atcoder_study | /abc/ABC120/c.py | 402 | 3.625 | 4 | # coding:utf-8
def main():
S = input()
RED = "0"
BLUE = "1"
red_count = 0
blue_count = 0
ans = 0
for si in S:
if si == RED:
red_count += 1
else:
blue_count += 1
if red_count == 0 or blue_count == 0:
ans = 0
else:
ans = 2 * m... |
ddeff55d30094be5acbe8e81b3e3880bf3bcc9da | tumajote/Mnist-NN-classifier | /mnistclassifier/plots.py | 4,138 | 3.78125 | 4 | import matplotlib.pyplot as plt
import numpy as np
def make_plots(evaluation_cost, evaluation_accuracy, training_cost,
training_accuracy,
num_epochs,
training_set_size=50000,
evaluation_set_size=10000
):
"""Draw plots for the cost and accu... |
a8bd01fd9d311b058acaa123f430f4e71c6cffa5 | hibfnv/Python_Study | /super_cars.py | 3,105 | 4.09375 | 4 | # 此实例主要用途在于理解类与类的继承,通过对该实例的代码实现,以理解类与子类的继承,子类将延用父类的有用信息。
class Car():
def __init__(self, manufacture, model, product_date):
self.manufacture = manufacture
self.model = model
self.product_date = product_date
self.odometer = 0
def car_description(self):
full_name ... |
5708c453055afcbb51e8109b8b5ac672830228d4 | hibfnv/Python_Study | /user_names.py | 642 | 3.921875 | 4 | """通过用户输入来获取用户的姓和名,然后输出为用户全名"""
from Chap11.name_function import get_formatted_name
print("退出程序请按q。")
while 1:
first = input("请输入你的姓(请用英文输入):")
if first == 'q':
break
middle = input("请输入你名字中间的字(请用英文输入):")
if middle == 'q':
break
last = input("请输入你名字的最后的字(请输入英文):")
if l... |
d3271b18bd3344693750aa9a8531f46160f7ce7f | hibfnv/Python_Study | /fileread.py | 693 | 3.984375 | 4 | # 利用open函数以打开文件,并写入相应的数据,利用不同的模式实现文件的写,读,追加操作
f = open('chap10_01.txt', mode='w', encoding='utf-8')
f.write("I love python, that's so interesting!!")
f.write("\n")
f.write("Well, you know python has so easy to learn for beginner.")
f.close()
f = open('chap10_01.txt', mode='r', encoding='utf-8')
lines = f.readl... |
34a5b7152b380b21c8f3142bfc11aace4eaab2c0 | ayushiagarwal99/leetcode-lintcode | /leetcode/breadth_first_search/934.shortest_bridge/934.ShortestBridge_zheyuuu.py | 2,224 | 3.703125 | 4 | # Source : https://leetcode.com/problems/shortest-bridge/
# Author : zheyuuu
# Date : 2020-08-04
#####################################################################################################
#
# In a given 2D binary array A, there are two islands. (An island is a 4-directionally connected
# group of 1s no... |
eb757bf908687f99e0e3ea952930478942c715bf | ayushiagarwal99/leetcode-lintcode | /leetcode/hash_table/438.find_all_anagrams_in_a_string/438.FindAllAnagramsinaString_YipingPan.py | 1,774 | 3.984375 | 4 | # Source : https://leetcode.com/problems/find-all-anagrams-in-a-string/
# Author : YipingPan
# Date : 2020-08-13
#####################################################################################################
#
# Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.
#
# ... |
413aa79127d9b91c941882c1fe97e122fb37f01a | ayushiagarwal99/leetcode-lintcode | /leetcode/link_list/82.remove_duplicates_from_sorted_list_ii/82.RemoveDuplicatesfromSortedListII_JohnJim0816.py | 1,574 | 4.09375 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-08-05 09:55:43
LastEditor: John
LastEditTime: 2020-08-05 09:55:56
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/
# Author : JohnJim0816
# Date : 2020-08-05
##... |
a538c4a925dd06a6949aa3965568550c2fc95429 | ayushiagarwal99/leetcode-lintcode | /leetcode/binary_search/29.divide_two_integers/29.DivideTwoIntegers_JohnJim0816.py | 1,876 | 4.03125 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-08-06 09:34:46
LastEditor: John
LastEditTime: 2020-08-06 09:35:03
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/divide-two-integers/
# Author : JohnJim0816
# Date : 2020-08-06
####################... |
5824a66b5ef6dd87dfd024ee464bdec8611b99fd | ayushiagarwal99/leetcode-lintcode | /leetcode/breadth_first_search/994.rotting_oranges/994.RottingOranges_zheyuuu.py | 2,344 | 3.515625 | 4 | # Source : https://leetcode.com/problems/rotting-oranges
# Author : zheyuuu
# Date : 2020-07-31
#####################################################################################################
#
# In a given grid, each cell can have one of three values:
#
# the value 0 representing an empty cell;
# the valu... |
2bb6f4e7baf577397f7d7d2f66374b3249146c6f | ayushiagarwal99/leetcode-lintcode | /leetcode/backtracking/39.combination_sum/39.CombinationSum_JohnJim0816.py | 1,971 | 3.625 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-09-10 00:22:28
LastEditor: John
LastEditTime: 2020-09-10 00:22:40
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/combination-sum/
# Author : JohnJim0816
# Date : 2020-09-10
########################... |
eac9eea7860abcb3474cfa2c4599b31c3e2a0af1 | ayushiagarwal99/leetcode-lintcode | /leetcode/breadth_first_search/199.binary_tree_right_side_view/199.BinaryTreeRightSideView_yhwhu.py | 1,597 | 4.125 | 4 | # Source : https://leetcode.com/problems/binary-tree-right-side-view/
# Author : yhwhu
# Date : 2020-07-30
#####################################################################################################
#
# Given a binary tree, imagine yourself standing on the right side of it, return the values of the
# nod... |
ed4eff337d15ac38a78f2175bbe60461b3f4daa4 | ayushiagarwal99/leetcode-lintcode | /leetcode/greedy/55.jump_game/55.JumpGame_JohnJim0816.py | 1,470 | 3.671875 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
@Author: John
@Email: johnjim0816@gmail.com
@Date: 2020-07-27 14:19:46
@LastEditor: John
@LastEditTime: 2020-07-27 14:20:11
@Discription:
@Environment: python 3.7.7
'''
# Source : https://leetcode.com/problems/jump-game/
# Author : JohnJim0816
# Date : 2020-07-27
###########... |
2cea028c0d947c8bb6bd85eaa2c16126c4f62660 | ayushiagarwal99/leetcode-lintcode | /leetcode/binary_tree/236.lowest_common_ancestor_of_a_binary_tree/236.LowestCommonAncestorofaBinaryTree_JohnJim0816.py | 1,875 | 3.921875 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-07-30 23:01:40
LastEditor: John
LastEditTime: 2020-08-03 10:13:24
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/
# Author : JohnJim0816
# Date : 2020-07-30
... |
13c33b098c198b5d8f08c56873722bb7c7da5d02 | ayushiagarwal99/leetcode-lintcode | /leetcode/binary_tree/124.binary_tree_maximum_path_sum/124.BinaryTreeMaximumPathSum_JohnJim0816.py | 1,906 | 3.703125 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-08-04 10:02:52
LastEditor: John
LastEditTime: 2020-08-04 10:03:03
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/binary-tree-maximum-path-sum/
# Author : JohnJim0816
# Date : 2020-08-04
###########... |
a61da4d87653fb154cb59bf9b58410935f270d6f | ayushiagarwal99/leetcode-lintcode | /leetcode/stack/150.evaluate_reverse_polish_notation/150.EvaluateReversePolishNotation_JohnJim0816.py | 1,774 | 3.875 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-08-10 10:40:54
LastEditor: John
LastEditTime: 2020-08-10 10:41:09
Discription:
Environment:
'''
# Source : https://leetcode.com/problems/evaluate-reverse-polish-notation/
# Author : JohnJim0816
# Date : 2020-08-10
#######... |
51aaf41708716c064fa75fe3e2433db9ad64fd73 | ayushiagarwal99/leetcode-lintcode | /leetcode/binary_tree/226.invert_binary_tree/226.InvertBinaryTree_JohnJim0816.py | 1,157 | 3.828125 | 4 | #!/usr/bin/env python
# coding=utf-8
'''
@Author: John
@Email: johnjim0816@gmail.com
@Date: 2020-07-29 21:21:47
@LastEditor: John
@LastEditTime: 2020-07-29 21:22:09
@Discription:
@Environment:
'''
# Source : https://leetcode.com/problems/invert-binary-tree/
# Author : JohnJim0816
# Date : 2020-07-29
##############... |
f33ea8de3a3a683d99bf273638dc7b04ac34bb99 | andreodendaal/code_kata | /python/primes.py | 599 | 4.03125 | 4 | def is_prime(number):
if number < 0:
return True
if number in (0, 1):
return False
"""Return True if *number* is prime."""
for element in range(number):
if element == 0 or element == 1:
continue
if number % element == 0:
return False
... |
f3ba1d07688b426f1f81af4460ebf1fa7781314c | dynizhnik/python_home_work | /ua/univer/lesson06HW/chapter10_task02_Car.py | 561 | 3.625 | 4 | class Car:
def __init__(self, year_model, make, speed):
self.__year_model = year_model
self.__make = make
self.__speed = speed
def set_year_model(self, year_model):
self.__year_model = year_model
def set_make(self, make):
self.__make = make
def set_speed(self, ... |
850dea87ff366a9f162acc98e1bca646a3e7a1a5 | dynizhnik/python_home_work | /ua/univer/lesson03/task_matrix.py | 687 | 3.703125 | 4 | if __name__ == '__main__':
matrix = [
[1, 2, 3, 4],
[6, 7, 8, 9, 4, 7],
[3, 4, 5, 6, 5]
]
print(len(matrix))
print(len(matrix[0]))
print(len(matrix[1]))
print(len(matrix[2]))
sum_matrix = 0
for i in range(len(matrix)):
# ---befor i row
# ---
... |
660b6d8f93ee759a3ee42f6fd9077181b650b653 | dynizhnik/python_home_work | /ua/univer/lesson03HW/chapter07_task01.py | 243 | 3.828125 | 4 | WEEK = 7
sale_day = []
sale_total = 0.0
for i in range(WEEK):
sale = float(input(f'Enter {i+1} day: '))
sale_day.append(sale)
sale_total += sale
print('All sales by days:', sale_day)
print('Total sales:', format(sale_total,'.2f')) |
9b1cc89a69491aa878ba2f9d6eecd948b202d7f3 | dynizhnik/python_home_work | /ua/univer/lesson03HW/chapter07_task06.py | 459 | 3.921875 | 4 | def main():
list = []
enter_list(list)
n = int(input('Enter count n:'))
find_count_more_n(list, n)
def enter_list(list):
again = 'y'
while again == 'y':
name = int(input('Enter count of list: '))
list.append(name)
print('Do you want enter new count?')
again = in... |
ff67ed53d127a6d0bbac33f87e92ef5b37def88f | dynizhnik/python_home_work | /ua/univer/lesson01HW/Chapter02/chapter02_task03.py | 136 | 3.546875 | 4 | square_in_m = float(input('Input square land in meters:'))
square_in_acr = square_in_m / 4047
print('Squre in acr is -', square_in_acr)
|
b2425c49dc4ec04be75b65477cd8dbd678041bd3 | dynizhnik/python_home_work | /ua/univer/lesson04HW/chapter06_task02.py | 338 | 3.84375 | 4 | def main():
LINE = 5
file_name = input('Enter file name: ')
infile = open(file_name, 'r')
line = infile.readline()
for i in range(1, LINE + 1):
line = line.rstrip('\n')
if line != '':
print(line)
else:
return
line = infile.readline()
infil... |
bfa94675dc973246bb2fb5f497af5e62032f9d74 | dynizhnik/python_home_work | /ua/univer/lesson01HW/Chapter03/chapter03_task10_2.py | 417 | 4.0625 | 4 | COIN1 = 5
COIN2 = 10
COIN3 = 50
number1 = int(input(f'Enter number of {COIN1} coins:'))
number2 = int(input(f'Enter number of {COIN2} coins:'))
number3 = int(input(f'Enter number of {COIN3} coins:'))
total = number1 * COIN1 + number2 * COIN2 + number3 * COIN3
if total == 100:
print('Congratulation you winner, tota... |
fb1402006711860c628f6b510884ee2d973b060d | dynizhnik/python_home_work | /ua/univer/lesson02HW/chapter04_task01.py | 116 | 3.875 | 4 | total = 0
for i in range(5):
error = int(input('Enter count of error: '))
total = total + error
print(total) |
bb80605b9a392b6a9b4a86b5b29400148d4f7091 | dynizhnik/python_home_work | /ua/univer/lesson01HW/Chapter02/chapter02_task15_5.py | 471 | 3.5 | 4 | import turtle
R = 40
A_X = 100
A_Y =0
B_X = 0
B_Y = 100
C_X = 0
C_Y = -100
D_X = -100
D_Y = 0
turtle.hideturtle()
turtle.speed(0)
turtle.goto(0,-40)
turtle.circle(R)
turtle.penup()
turtle.goto(A_X,A_Y)
turtle.pendown()
turtle.write('East')
turtle.penup()
turtle.goto(B_X,B_Y)
turtle.pendown()
turtle.write('North')
... |
567f8b97bebb8a3360a30f18e810dc504b40b65f | bwilt17/Course-Assignments | /ME106/Labs/Lab7/motor_blink.py | 458 | 3.53125 | 4 | '''
Basic "blink" program, modified to control a 3V DC motor on pin D13 of Adafruit nRF52840 Feather Sense board.
Video of code running can be found here: https://www.youtube.com/watch?v=dFxukxS_Sjk
Written by Beverly Wilt (beverly.wilt@sjsu.edu)
'''
import board
import digitalio
import time
motor = digitalio.Digital... |
46f5ff3e6b69a25a7235bee3cd6e554a27e16d5e | Will-Carr/Live-Betting | /live_betting/model.py | 1,061 | 3.53125 | 4 | """Loads current game and stores it as global."""
import time
CUR_GAME = {}
LAST_FOUND = 0.0
CUR_STAT = ""
CUR_STAT_URL = None
def load_cur_game():
"""
Load the current game.
Ex:
CUR_GAME = {
"sport": "football",
"team": "texas"
}
"""
global CUR_GAME
CUR_GAME = {
... |
ebe8b1f54b32754316095c4e8f979c19f2b01e3e | rodrilinux/Python | /Python/_3.1-chamadaDeFuncao.py | 929 | 4.40625 | 4 | # coding: iso-8859-1_*_
# Voc j viu um exemplo de uma chamada de funo:
# >>> type(32)
# <class str>
# O nome da funo type e ela exibe o tipo de um valor ou varivel. O valor ou varivel, que chamado de
# argumento da funo, tem que vir entre parnteses. comum se dizer que uma funo recebe um valor ou mais
# valores e ... |
cc027c2c1f102a4ab38cc6c7f645f69698b178d5 | bjeavons/zxcvbn-php | /data-scripts/build_keyboard_adjacency_graphs.py | 3,705 | 3.5 | 4 | #!/usr/bin/python
import sys
import json as simplejson
def usage():
return '''
constructs adjacency_graphs.json from QWERTY and DVORAK keyboard layouts
usage:
%s src/Matchers/adjacency_graphs.json
''' % sys.argv[0]
qwerty = r'''
`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+
qQ wW eE rR tT yY uU iI oO pP [{ ]} \|
... |
c8c9ee13aa39c17ca87633a0d19557042248576a | h0rn3t/asyncio-examples | /tail_recursion_with_asyncio.py | 591 | 3.6875 | 4 | import asyncio
# Tail-recursive factorial using asyncio event loop as a trampoline to
# keep the stack from growing.
@asyncio.coroutine
def factorial(n, callback, acc=1):
if n == 0:
callback(acc)
else:
asyncio.async(factorial(n-1, callback, acc*n)) # async -> ensure_future in Python 3.4.4
def ... |
befbe0f8e2212f116e5edda70e9e7e916d4fc3c2 | bnl75/CursoWeb | /Primera semana/Viernes/Tareas/Ejercicios Python/Ejercicio6.py | 368 | 3.53125 | 4 | def parImpar():
print("Serie de numeros: (1, 2, 3, 4, 5, 6, 7, 8, 9)")
serie = [1, 2, 3, 4, 5, 6, 7, 8, 9]
par = 0
impar = 0
for i in serie:
if ((i % 2) != 0):
impar += 1
else:
par += 1
print("Numeros pares en la serie: " + str(par))
print("Numeros i... |
c660ba6b3e5fd3c2577897f8a3b6856af9626f97 | MarcoHuXHu/learningpython | /Algorithm/Union-Find.py | 332 | 3.90625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
parent = []
def find_root(n):
if parent[n] == n:
return n
else:
root = find_root(parent[n])
parent[n] = root
return root
def merge(a,b):
parent[find_root(b)] = find_root(a)
def init(n):
for x in range(n+1):
parent... |
d0a5e8fdbdaec96173164faf66143bfac359b689 | MarcoHuXHu/learningpython | /Algorithm/Heap.py | 1,541 | 4.15625 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 如果一颗完全二叉树中, 每个父节点的值都大于等于(或者都小于等于)其左右子节点的值, 这样的完全二叉树称为堆.
# 此处以一个小根堆为例(即父节点的值小于等于左右子节点的值)
# 堆的插入, 弹出(删除根节点), 以及利用堆进行排序
class Heap(object):
def __init__(self):
self.data = []
def swap(self, indexA, indexB):
y = self.data[indexA]
self.da... |
331ba25d4f34c30d1ac418c0d05a0b9b1cce35bb | MarcoHuXHu/learningpython | /Function/filter.py | 1,520 | 4.1875 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# filter传入一个返回True或False的函数,与一个Iterable对象,返回经过函数筛选为True的元素
# filter返回为iterator
def is_odd(n):
return n % 2 == 1
print(list(filter(is_odd, [1, 2, 4, 5, 6, 9, 10, 15])))
# 结果: [1, 5, 9, 15]
# 例1:筛选回文数
def is_palindrome(n):#0123456
digits = str(n)
length = le... |
d2e6311e17ed97b922c499911eeab5d77b042d6a | bilakhiyaasif/Python | /Python_Books_Prablem/ICPS with Python/Chapter 4/4.1.1 Mathematical Functions/Solution.py | 639 | 3.65625 | 4 | """
Mathematical Functions
Developer:Bilakhiya Asif
"""
import math
print("math.sqrt(25)\t\t",math.sqrt(25))
print("abs(-120)\t\t",abs(-120))
print("math.ceil(12.2)\t\t",math.ceil(12.2))
print("math.floor(12.2)\t",math.floor(12.2))
print("math.pow(2,3)\t\t",math.pow(2,3))
print("math.exp(3)\t\t",math.exp(3))
print("ma... |
43c6933255f6410b65d4d3b801c4ab7b23c99bf4 | bilakhiyaasif/Python | /Introduction/Loops/Solution.py | 170 | 3.65625 | 4 | if __name__ == '__main__':
n=int(input())
if n>=1 and n<=20:
for i in range (0,n):
print(i*i)
#this also work
#while i<5:
# print(i)
# i=i+1
|
7e81ca2ddb37ba76de819d6d1a05be39b4ebbeb4 | bilakhiyaasif/Python | /Python_Books_Prablem/ICPS with Python/Chapter 3/Q-3.11 Input Output/Solution.py | 235 | 3.75 | 4 | """
Input/output python
Developer:Bilakhiya Asif
"""
print("Hello Python")
print(1,2,3,4,sep=" ")
print(1,2,3,4,end=":")
print(1,2,3,4,5,sep=" ",end="}\n")
print(input("Enter Anything:"))
x=input("input something:");
print("you enter :",x)
|
e6253a8f91330d91b827da921b6b30ed90f4067f | hellfire1991/private12306 | /extension/clock.py | 1,560 | 3.53125 | 4 | import time
from extension.log import log_input
class CLOCK(object):
#夜间12306网站停机,设置时间检测,让脚本在12306网站停机时进入睡眠
def __init__(self):
pass
@classmethod
def check_clock(cls,user):
local_time=time.localtime()
local_hour=local_time.tm_hour
local_min=local_time.tm_min
if l... |
2a3dee498863086d116b52cf3a6d1badea7be378 | xmzyshypnc/GreedySnake | /Button.py | 556 | 3.640625 | 4 | class Button(object):
def __init__(self,lefttop_x,lefttop_y,rightbottom_x,rightbottom_y):
self.left_top_x = lefttop_x
self.left_top_y = lefttop_y
self.right_bottom_x = rightbottom_x
self.right_bottom_y = rightbottom_y
def judge(self,point_x,point_y):
if self.left_top_x... |
55dff8a504ddc8afe40872cbcc16ece98f685097 | okumurakengo/til | /python/17_str.py | 303 | 3.53125 | 4 | name = "taguchi"
score = 52.3
print("name: %s, score: %f" % (name, score))
print("name: %-10s, score: %10.2f" % (name, score))
print("name: {0}, score: {1}".format(name, score))
print("name: {0:10s}, score: {1:10.2f}".format(name, score))
print("name: {0:>10s}, score: {1:<10.2f}".format(name, score))
|
5fea5ffadf93326414b6f608d096d8be9b67b2b8 | rg3915/dg-challenge | /dress/selenium/gen_random_values.py | 664 | 3.5 | 4 | import string
from random import randint, choice
def gen_string(max_length):
return str(''.join(choice(string.ascii_letters) for i in range(max_length)))
gen_string.required = ['max_length']
def gen_number(min_number=1, max_number=99):
# gera numeros inteiros entre 1 e 99
return randint(min_number, max_... |
7daaa922ca91469e5f6d7574394706e8c2ca15cd | forlink/CSV_Toolkit | /csv_toolkit/csv_sort.py | 709 | 4.03125 | 4 | import csv
import csv_converter
# sort the csv file by certain column to put the similar record together for further analysis
def sort_csv_byColumn(in_file, out_file,column_name):
with open(in_file, 'rb') as f:
reader = csv.reader(f, delimiter=',')
fieldnames = next(reader)
reader = csv.Dic... |
5ad682593da115fe56792c45b88c3100b6241688 | luminaphor/boardgame_framework | /gameboard.py | 4,768 | 3.625 | 4 | class boardLoc: #generic class for a location node
locID=0 #unique ID for location. Assigned on object creation.
totalID=0 #total location ID's. Increments each time a location object is created.
def __init__(self): #initializes object creation.
self.locID=self.totalID
boardLoc.totalI... |
f6fd202e360fef959e9274e7df20d538ce4112f4 | Eliseowzy/financialFraudDetection | /programm/EmailExtract.py | 3,593 | 3.84375 | 4 | """
Email message extract module.
Author: Zhiyi Wang
Date: 04-11-2021
Version: 1.0
"""
import pandas as pd
def extract_emails(input_email_data_frame):
""" Extract emails from a single csv file, then store the data as csv format
The format of input file is:
file message
--------------------... |
476e09423baa48669ac78c4f416c19c14fbdf31b | LumpyChen/Arithmetic | /SPOJ-AGGRCOW/solve.py | 693 | 3.515625 | 4 | def judge(n, c, x, d):
m = 1
k = 0
for i in range(1, n):
if x[i] - x[k] >= d:
m = m + 1
k = i
if m >= c: break
return m >= c
def binarySearch(n, c, x):
l = 0
r = x[n-1] - x[0]
while l < r:
mid = (l + r) >> 1
mid = mid + 1
ok = ... |
bcdbddbd7e6e3bbcd00f90c1821f209479c570fb | shaay333/Algorithms | /Reverse_array.py | 291 | 3.9375 | 4 | def reverse(arr,start,end):
while start<end:
arr[start],arr[end]=arr[end],arr[start]
start+=1
end-=1
n=int(input())
array=[]
for i in range(n):
x=int(input())
array.append(x)
reverse(array,0,n-1)
for i in range(n):
print(array[i]) |
38b6e85f55d0dcb80939ec57e4a0e2eceebf5eba | sammienjihia/dataStractures | /Strings/3longestSubstringWithoutrepeatChar.py | 3,510 | 3.609375 | 4 | """
LeetCode question 3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.
Solution walk through:
We can utilise the sliding window technique:
1. We'll have two pointers, start and end to represent the start and the end of our window... |
3e75a6666d33bc5965ff3df6d54f7eef487a9900 | sammienjihia/dataStractures | /Trees/inOrderTraversal.py | 2,293 | 4.15625 | 4 | class Node:
def __init__(self, val):
self.val = val
self.rightchild = None
self.leftchild = None
def insert(self, node):
# compare the data val of the nodes
if self.val == node.val:
return False
if self.val > node.val: # make the new node the left chi... |
76b271670264e42e982f9daa12dc04b4d366daa9 | sammienjihia/dataStractures | /Strings/stringPermutation.py | 1,258 | 3.921875 | 4 | class Permutation:
def __init__(self):
self.mySet = set()
def swap(self, myString, left, index):
# NB: String are imutable, meaning you'll have to change it to an array, perform the swap then change it back to a string
stringAsList = list(myString)
# swap the characters in the ... |
7da8b99c02a58f57057791304402e8216d63223f | sammienjihia/dataStractures | /Graphs/dijkstra.py | 6,057 | 4.09375 | 4 | """
Dijkstra's algorithm can be considered an implementation of a BFS whereby instead of using
a FIFO queue, we use a priority queue
"""
class dijkstra:
def __init__(self, graph):
self.graph = graph
self.visited = set()
self.priority_queue = [0]
def bubble_up(self, last_index):
... |
259f920b6321784f7c985e26bddb701feefeb459 | gToye/informatica5 | /Toetsvoorbereiding/skyline.py | 434 | 3.6875 | 4 | gebouwen = int(input('aantal gebouwen'))
for i in range(0,1):
naam = input('naam gebouw')
hoogte = input('hoogte gebouw')
print(naam +' is zichtbaar van het gelijkvloers tot '+ hoogte + ' meter.')
y = hoogte
for i in range (0,gebouwen):
naam = input('naam gebouw')
hoogte = input('hoogte gebouw')... |
e37e1e984711cc44df4bd74599df0607500b8102 | gToye/informatica5 | /07-a-iteraties-for-us/getalen.py | 288 | 3.6875 | 4 | aantal = int(input('aantal'))
som = 0
grootste = int(input('getal: '))
for i in range(aantal ):
getal = int(input('getal:'))
som += getal
if(getal > grootste):
grootste == getal
print('Het grootste getal is {} en het gemiddelde is {:.2f}'.format(grootste,som/aantal)) |
55b1a4ed3bdc6f09b6176ef10a236a8f78652bc9 | gToye/informatica5 | /toets2/basen.py | 104 | 3.625 | 4 | n = str(input('wat is n'))
getal = 0
if n % 2 == 0:
getal += (n / 2)
else:
getal += (3 * n) + 1 |
78c142613356eecd84d53b79de2fd0d2432dfebe | Chuxiaxia/python | /10_石头剪刀布.py | 572 | 4.03125 | 4 | # 导入随机工具包,放在顶部
import random
print("欢迎来到石头剪刀布游戏!")
print("----------------------------")
# 电脑随机数生成random
computer = random.randint(1,3)
player = int( input("请输入你要出的拳头(1.石头 2.剪刀 3.布):"))
print("玩家:%d -- 电脑:%d"%(player,computer))
if player == computer:
print("平局了!")
else:
if (player==1 and computer==2) or (player... |
7570ffc99cf7a107d6b74806b1140918d6d25850 | Chuxiaxia/python | /hm_15_元组基本使用.py | 261 | 3.75 | 4 | info_tuple = ("xey", "ajl", "安家樑")
# 1.取值和取索引
print(info_tuple[0])
# 该数据在元组中的索引
print(info_tuple.index("ajl"))
# 2. 统计计数
print(info_tuple.count("xey"))
# 统计元组中包含元素的个数
print(len(info_tuple)) |
a0f106ce704bba1801a7ec6dcf1761bd45cd4eb2 | Chuxiaxia/python | /hm_17_格式化字符串.py | 213 | 3.5625 | 4 | info_tuple = ("小明", 18, 1.75)
# 格式化字符串后面的‘()’本质上就是元组
print("%s 年龄:%d 身高:%.2f" % info_tuple)
info_str = "%s 年龄:%d 身高:%.2f" % info_tuple
print(info_str) |
6cc412ee2ed4e71fd9aff6409db2434a64735ec2 | Chuxiaxia/python | /hm_10_列表基本使用.py | 955 | 4.21875 | 4 | name_list = ["xey", "ajl", "xx"]
# 1. 取值和取索引
print (name_list[2])
# 知道数据的内容,想确定数据在列表的位置
# 使用index方法需要注意,如果传递的数据不在列表中,程序会报错。
print(name_list.index("xey"))
# 2. 修改
# 注意: 列表指定的索引超出范围,程序会报错
name_list[1] = "安家樑"
# 3. 增加
# append方法可以向列表末尾增加数据
name_list.append("夏夏")
# insert方法可以在列表的指定索引位置插入数据
name_list.insert(1, "an")
# ex... |
d37c9096b73eda12ad29228aa9bca97e6da01aaa | Dstorr/Python | /average 1.py | 190 | 4.25 | 4 | print("Give me three numbers, and i'll give you the average")
num1 = int(input())
num2 = int(input())
num3 = int(input())
avg = 3
average= num1 + num2 + num3/avg
print(average)
|
2eda7481be48bfedb2236ebba41903837c63f995 | cvhs-cs-2017/sem2-exam1-easy-as-pi | /ExtraCredit.optional.py | 854 | 3.9375 | 4 | """Write a program that will take a Binary number and return its Whole Number Value:
example: 10011 would return (16+0+0+2+1 = 19)"""
def BinaryToNum(num):
length = len(num)
tracker = 0
ind = 0
for i in num:
new = (int(num[ind])*(2**(length-(ind+1))))
tracker += new
ind += 1
... |
20ce3fc899aa6766a27dfe73c6dd0c14aa3d4099 | Julien-Verdun/Project-Euler | /problems/problem9.py | 711 | 4.3125 | 4 | # Problem 9 : Special Pythagorean triplet
def is_pythagorean_triplet(a,b,c):
"""
This function takes 3 integers a, b and c and returns whether or not
those three numbers are a pythagorean triplet (i-e sum of square of a and b equel square of c).
"""
return a**2 + b**2 == c**2
def product_pythagorean_triplet(N):
... |
edcf4056207a9d1c5434358094c6dae3fda9e41e | Julien-Verdun/Project-Euler | /problems/problem20.py | 567 | 3.953125 | 4 | # Problem 20 : Factorial digit sum
def factorielle(n):
"""
This function calculates the factorial of the integer n,
i-e the product of every integer beetwen 1 and n.
"""
if n == 0 or n == 1:
return 1
else:
return n*factorielle(n-1)
def sum_digit_factorielle(n):
"""
This fun... |
9ac30285496268736a3769ed411af4ebaa3a4c28 | Julien-Verdun/Project-Euler | /problems/problem16.py | 304 | 3.796875 | 4 | # Problem 16 : Power digit sum
def somme_digit_puissance_2(N):
"""
This function returns the sum of digit inside the number 2**N
"""
str_nb = str(2**N)
somme = 0
for elt in str_nb:
somme += int(elt)
return somme
print(somme_digit_puissance_2(1000))
# Result 1366
|
d7b755a86b57a9f2d04ac3c10259f74b930d6f4f | Julien-Verdun/Project-Euler | /problems/problem28.py | 407 | 3.75 | 4 | # Problem 28 : Number spiral diagonals
def sum_spiral_diag(n):
"""
This function calculates the sum of spiral diagonals.
"""
somme = 1
N = n*n
i = 1 # indique la vauleur des cases
j = 2 # indique la couche
while i < N:
somme += 4*i+10*j
i += j*4
j += 1
ret... |
e797855978c848a426d59cb209b3dc2efde4ff6b | ThePoisoned1/Codewars | /Python/6kyu/Unique_in_Order.py | 144 | 3.65625 | 4 | out = []
previous = None
for x in iterable:
if previous != x:
out.append(x)
previous = x
return out
|
66b23e80f9e7bf797b271c76cd48d5231cdcf610 | Hojang2/school_contest | /automat/automat.py | 3,563 | 3.765625 | 4 | #!usr/bin/python3
from time import ctime
class Ticket:
def __init__(self, minutes, zones, cheap_price, expensive_price):
self.minutes = minutes
self.zones = zones
self.cheap_price = cheap_price
self.expensive_price = expensive_price
self.return_money = 0
self.price... |
a95efa3d194bfa4b7d501d7c67a479a70a3297f1 | TyPetrochko/machine-learning-practice | /adaline.py | 4,097 | 3.703125 | 4 | import numpy as np
from numpy.random import seed
# Just a description of some of the parameters
# -- Paramaters --
#
# X = the (training) data itself (no headers),
# where each row maps to a single item,
# and each column is an attribute, like
# petal length, sepal length, height,
# etc.
#
... |
56e0a5b4c0b7496fd7c652f60b502871a1c0d10c | ReshmaRajanChinchu/python-programming | /python87.py | 131 | 3.75 | 4 | a=int(input("enter no"))
b=int(input("enter no"))
for i in range(b,0,-1):
if(a%i==0 and b%i==0):
print(i)
break
|
94142102dd36fbac3a370599f872fe8705de2383 | ReshmaRajanChinchu/python-programming | /python96.py | 106 | 3.578125 | 4 | a=int(input("Enter A"))
d=int(input("Enter B"))
n=int(input("Enter C"))
c=n*(2*a+(n-1)*d)/2
print(int(c))
|
6b756fa499f7fd91f4a6eaa0ba1a4c6a51d225d7 | ReshmaRajanChinchu/python-programming | /python35.py | 148 | 3.671875 | 4 | s1 = input("i")
words = sum(c1.isalpha() for c1 in s1)
spaces = sum(c1.isspace() for c1 in s1)
others = len(s1) - words - spaces
print(others)
|
fa5b14d28eee69a73ffb4c25eb88d6f7ae900fda | ReshmaRajanChinchu/python-programming | /A17.py | 175 | 3.734375 | 4 | n=int("Number:")
l=int("Number:")
x=0
for i in range(0,l):
l=n[i]
y=(int(l))**3
x +=y
if x==int(n):
print("amstrong no")
else:
print("not an amstrong no")
|
d9a99710fff9188239141c2095efb66eac346321 | ReshmaRajanChinchu/python-programming | /A19.py | 185 | 4.3125 | 4 | num=input("Enter the value:")
f=input("Enter the value:")
if(num<0):
print('not a factorial number')
elif(num==0):
print('factorial')
else:
for x in range(1,num+1):
f=x*f
print(f)
|
f93a86dadcdd55124ab0e97233c6382c92ee4968 | ReshmaRajanChinchu/python-programming | /A12.py | 165 | 3.75 | 4 | N=int("Num=")
if(N<1000):
a=N
cha=0
while N>0:
ch= N%10
cha= cha*10+ch
N= N/10
if(t==cha):
print("palindrome")
else:
print("not palindrome")
|
37d647621f6a1ae22744dfa2c78d7ea06bd64d66 | Hector-N/JetBrainsAcademy_Projects_ARCHIVED | /regex_engine/regex.py | 2,863 | 3.53125 | 4 | import sys
sys.setrecursionlimit(20000)
def char(re, ch):
"""
Match single character with 'dot' metacharacter.
:param re: str, len <= 1, metacharacter
:param ch: str, len <= 1, searched character
"""
if len(re) > 1 or len(ch) > 1:
raise ValueError("Args to 'char()' must be of 0 or 1 l... |
72457abeaf584a87db055eacf1d80b06bbd8f7bd | dujiaojingyu/Personal-programming-exercises | /编程/程序/Myqueue.py | 1,276 | 3.734375 | 4 | class Myqueue:
#构造函数设置默认队列
def __init__(self,size = 10):
self._content = []
self._size = size
self._current = 0
def setSize(self,size):
if size < self._current:
for i in range(size,self._current)[::-1]:
del self._content[i]
self._curre... |
8e2ea76725b385b42d0d53b19badde664d14be01 | dujiaojingyu/Personal-programming-exercises | /编程/8月/8.6/Merge_Sort.py | 776 | 3.78125 | 4 | __author__ = "Narwhale"
def merge(alist,first,mid,last):
low = first
high = mid + 1
result = []
while low <= mid and high <=last:
if alist[low] < alist[high]:
result.append(alist[low])
low += 1
else:
result.append(alist[high])
high += 1
... |
29c459e5e2e359f89c4e5d47e72fea70615bb1e4 | dujiaojingyu/Personal-programming-exercises | /编程/4月/4.7/var.py | 177 | 3.5625 | 4 | __author__ = "Narwhale"
pizza = ['番茄浆','火腿','牛肉']
for i in pizza:
print(i)
#-----------------------------
for i in pizza:
print('I like %s pizza'%i)
|
ad1b43f3aca37ef23174083e58c361eaad671688 | dujiaojingyu/Personal-programming-exercises | /编程/程序/注册登录程序.py | 1,607 | 3.96875 | 4 |
date = {}
def new_user():
name = input("请输入用户名字:")
while True:
if name in date:
name = input("此用户名已经被使用,请重新输入:")
else:
password = input("请输入密码:")
date[name] = password
print("注册成功请登录试试!")
break
def entry():
name = input("请输入用户名... |
7765e42ab98459b0486e45c91e98c317c3fd93b7 | dujiaojingyu/Personal-programming-exercises | /编程/8月/8.15/列表有序合并.py | 357 | 3.78125 | 4 | __author__ = "Narwhale"
def loop_merge_sort(l1, l2):
temp = []
while len(l1) > 0 and len(l2) > 0:
if l1[0] < l2[0]:
temp.append(l1.pop(0))
else:
temp.append(l2.pop(0))
temp.extend(l1)
temp.extend(l2)
return temp
l1 = [1,3,5,7,9]
l2 = [2,4,6,8,10,14,15,78]
... |
87b00d8065f044647e6fac2d9030d92453331251 | dujiaojingyu/Personal-programming-exercises | /编程/8月/8.15/链表成对调换.py | 1,290 | 3.921875 | 4 | __author__ = "Narwhale"
class ListNode:
def __init__(self,elem):
self.elem = elem
self.next = None
class Solution(object):
def __init__(self,node=None):
self.__head = node
def is_empty(self):
return self.__head == None
def append(self,item):
node = ListNode(it... |
ad8880fc2ec78deab1c46e4f17f5d2ade63a5b61 | dujiaojingyu/Personal-programming-exercises | /编程/5月/5.27/var2.py | 542 | 4 | 4 | __author__ = "Narwhale"
string = input("请输入字符串:")
length = len(string)
count = 1
if string != string.upper():
count = 0
for i in range(length-1):
if string[i] == string[i+1]:
count = 0
for i in range(length-3):
x1 = string.find(string[i],i+2)
if x1 == -1:
continue
else:
for j... |
75a4a9d731349d180476fdcaabe87e235e2595c2 | dujiaojingyu/Personal-programming-exercises | /编程/8月/8.3/Binary_Search.py | 1,459 | 3.65625 | 4 | # __author__ = "Narwhale"
#
# def binary_search(alist,item):
# """二分查找"""
# n = len(alist)
# low = 0
# high = n - 1
# while low <= high:
# mid = (low + high) // 2
# if alist[mid] == item:
# return mid
# elif alist[mid] > item:
# high = mid - 1
# ... |
562d7effa4255cf789ac3ed741acfe14bb5702ab | dujiaojingyu/Personal-programming-exercises | /编程/book_example/9-3.py | 325 | 3.625 | 4 | # _*_ coding: utf-8 _*_
# 程序 9-3 (Python 3 version)
import requests
url = 'http://www.xxx.edu.cn/exam/check_001_NO_0_2015.html'
name = input("请输入要查询的姓名:")
html = requests.get(url).text
if name in html:
print("恭喜名列金榜")
else:
print("不好意思,榜单中找不到{}".format(name)) |
ad4467102620b056966ff19192846b4d0b582fa8 | dujiaojingyu/Personal-programming-exercises | /编程/8月/8.16/链表交点.py | 1,481 | 3.875 | 4 | __author__ = "Narwhale"
class ListNode:
def __init__(self,elem):
self.elem = elem
self.next = None
class Solution(object):
def __init__(self,node=None):
self.__head = node
def is_empty(self):
return self.__head == None
def append(self,item):
node = ListNode(i... |
8a5e312c38413300988772c14f3efd3dbab8f733 | dujiaojingyu/Personal-programming-exercises | /编程/2月/2.6/反射.py | 958 | 3.828125 | 4 | __author__ = "Narwhale"
# class Dog(object):
#
# def __init__(self,name):
# self.name = name
#
# def eat(self):
# print('%s is eating ....'%self.name)
#
# d = Dog('xiaohei') #实例化对象
# choice = input('>>>>:').strip() #strip()去除左右空格
#
# if hasattr(d,choice): ... |
4f161b321598eaefc7451a7d5c1b3ccc8dafcf1b | dujiaojingyu/Personal-programming-exercises | /编程/8月/8.2/Insert_Sort.py | 420 | 3.875 | 4 | __author__ = "Narwhale"
def insert_sort(alist):
"""插入排序"""
n = len(alist)
for j in range(1,n):
for i in range(j,0,-1):
if alist[i] < alist[i-1]:
alist[i],alist[i-1] = alist[i-1],alist[i]
else:
break
if __name__ == "__main__":
li = [54,26,... |
d6e2197effb4e7fa4aa8e82dd9ed0fda9f13884e | dujiaojingyu/Personal-programming-exercises | /编程/book_example/2-1.py | 182 | 3.65625 | 4 | age = int(input("你的年龄是:"))
if age >= 18:
print("恭喜!你成年了。")
else:
diff = str(18 - age)
print("要年满18岁才成年,你还差 " + diff + " 岁")
|
90911d03419223cfd09fa926687559f4f9ceeb3a | dujiaojingyu/Personal-programming-exercises | /编程/程序/斐波拉切.py | 206 | 3.78125 | 4 | def fun(n):
if n < 0:
print("输入错误!请输入大于0的数!")
elif n == 1 or n == 2 :
return 1
else:
return fun(n-1) + fun(n-2)
result = fun(10)
print(result) |
fd7d10d5173ec7bd1f1753707a9f38308cec4aa3 | dujiaojingyu/Personal-programming-exercises | /编程/4月/4.13/survey.py | 1,255 | 3.515625 | 4 | __author__ = "Narwhale"
class AnonymousSurvey():
'''收集匿名调查问卷'''
def __init__(self,question):
'''存储一个问题,并为其存储答案准备'''
self.question = question
self.responses = []
def show_question(self):
'''显示调查问卷'''
print(self.question)
def store_response(self,new_response):
... |
1b2da7fb58c79c764008535c1551d9f4452576b4 | dujiaojingyu/Personal-programming-exercises | /编程/程序/分解正偶数输出素数.py | 446 | 3.890625 | 4 | import math
def isPrime(n):
#判断是否是素数
m = int(math.sqrt(n)) + 1
for i in range(2,m):
if n % i == 0:
return False
return True
def demo(n):
#分解正偶数
if (n % 2 == 0) and isinstance(n,int) and (n > 0): #判断n是否符合条件
for j in range(3,int(n/2)+1):
if (j % 2 == 1) and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.