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
15dc3911ee2d06b2047a7dfc53feaeded0c0f1e0
croguerrero/pythonexercises
/ejercicio13.py
319
3.828125
4
## vamos crear manualmente una matrix 4x4 y guardar la lista A = [] for i in range(4): A.append([]) for j in range(4): A[i].append(float(input("Introduce el elemento ({},{}): ".format(i, j)))) for i in range(4): for j in range(4): print(A[i][j], end = " " if A[i][j] >= 0 else " ") print("")
9ab9a300bdda856d7d05757c6c2916887719c524
croguerrero/pythonexercises
/funcioncompleja.py
2,666
4.125
4
from typing import Container def euclidean_division(x, y): ints = (x == int(x)) and (y == int(y)) if not ints: x = int(x) y = int(y) print("Se tomarán como parámetros la parte entera de los valores introducidos.") if abs(x) >= abs(y): q = x // y r = x % y print("Se ha realizado la ...
707330c6a067b20d68b1864052f8114237154a52
croguerrero/pythonexercises
/funcionsorted.py
635
4.46875
4
#### la funcion sorted() ### Ordena los elementos del objeto iterable que indiquemos de acuerdo a la función que pasemos por parámetro #### Como output, devuelve una permutación del objeto iterable ordenado según la función indicada ##Ejercicio: Con la ayuda de las funciones lambda, apliquemos sorted() para ordenar ...
5673cdc8eba64608daaf82b636f3aa45c3a82643
croguerrero/pythonexercises
/reducefuncion.py
984
3.734375
4
### Funcion Reduce() ## Aplica from functools import reduce ##Ejemplo con funcion lambda num = [1,2,3,4,5,6,8,150] print(reduce(lambda x, y:x*y,num)) ### Ejemplo con funcion normal def biger(a,b): if a > b: return a return b print(reduce(biger,num)) ###Ejercicio dad una lista de palabras vamos ...
5e328edff9d75bf00d39b4b2b795f6f0588e20d8
croguerrero/pythonexercises
/variablesfuncion.py
957
3.9375
4
##Variables de un funcion ## Hay dos variables local y global, local solo dentro de la funcion y global es en el entorno global def arit_ope(x,y): suma = x + y diff = x - y prod = x * y div = x * y return print({"Suma: ", suma, "Prod: ", prod, "Diff: ", diff, ...
439c6022f91c4d7b0cb16018e57f117216469331
croguerrero/pythonexercises
/ejercicio36.py
417
3.78125
4
s = input(" Ingrese un frase: ") s.lower() vowels = ["a", "e", "i", "o", "u"] vowels_count = 0 consonants_count = 0 blanks_count = 0 for c in s: if c in vowels: vowels_count += 1 elif c.isalpha(): consonants_count += 1 elif c == " ": blanks_count += 1 info = [("# Vocales: ", v...
20f6bef45410f3ea293191f3415269a895c15b6c
annkara/NLP100
/ch1/07.py
402
3.828125
4
## 07.テンプレートによる文生成 def str_template(x, y, z): ''' x時のyはzというテンプレートに当てはめた文字列を返す。 ''' # 文字列へのキャストは不要 # x_, y_, z_ = str(x), str(y), str(z) template = '{}時の{}は{}' return template.format(x, y, z) if __name__ == '__main__': print(str_template(x=12, y='気温', z=22.4))
280dea1a4d2fdbd0bf4f551a5be508244dcef511
annkara/NLP100
/ch3/22.py
556
3.65625
4
# 22.カテゴリ名の抽出 ''' [[Category:カテゴリ名|...]] ''' import re text = 'England.txt' pattern = 'category' # Category部分のみを抽出 with open(text) as f: categories = [] for line in f.readlines(): if re.search(pattern, line, flags=re.IGNORECASE): categories.append(line) # stripメソッドを利用して、先頭および末尾から不要文字を...
1ae789e12949c407d6747bb6825e7b27a1d372cc
annkara/NLP100
/ch1/05.py
1,320
3.859375
4
## n-gram """ n-gramとは 任意の文字列や文書を連続したn個の文字で分割するテキスト分割方法のこと。 特にnが1のことをユニグラム、2の場合をバイグラム、3の場合をトライグラム と呼ぶ。 """ def n_gram(n, sequence): ''' 引数nに指定された単語n-gramのリストと文字n-gramのリストを返す。 ''' # 単語n-gramのリストを生成する num = n words = sequence.split() start = 0 end = len(words) word_n_gram...
b887836475e807f2eb058534a16f1f3f254f2699
dong-pro/fullStackPython
/p1_basic/day01_07base/day02/07_in和notin.py
134
3.8125
4
content = input('请输入你的评论:') if '马化腾' not in content: print('你的言论不和谐') else: print(content)
50301c81d476974677431103e112c5dc38edbce9
dong-pro/fullStackPython
/p1_basic/day01_07base/day03/06_str相关操作.py
3,045
3.53125
4
s = 'code change the World! Just do it' # s1 = s.capitalize() # 把首字母变成大写 # print(s1) # s2 = s.lower() # 小写 # print(s2) # s3 = s.upper() # 大写 # print(s3) # s4 = s.swapcase() # 大小写互换 # print(s4) # s2 = 'БBß' # 俄美德 # print(s2) # print(s2.lower()) # print(s2.casefold()) # s5 = s.title() # 把每个单词的首字母大写 # print(s5) ...
1ff8a37472b697bc873820b85e4da555880953f5
dong-pro/fullStackPython
/p1_basic/day22_26oop/day25/07_反射示例-面向对象/a.简单示例.py
324
3.828125
4
class Foo(object): country = "中国" def func(self): pass v = getattr(Foo, 'func') # Foo.func # 根据字符串为参数,去类中寻找与之同名的成员。 print(v) obj = Foo() v = getattr(obj, "func") # obj.func # 根据字符串为参数,去对象中寻找与之同名的成员。 print(v)
37ba1b301fe26772fba80187da9ed861a4bcc290
dong-pro/fullStackPython
/p1_basic/day22_26oop/day23/09_练习题.py
1,392
3.609375
4
# 以前写法 # data_list = [] # for i in range(1, 901): # data_list.append('alex-%s' % i) # # while True: # # 1. 要查看的页面 # page = int(input('请输入要查看的页码:')) # # # 2. 每页显示 10 条 # per_page_num = 10 # # start = (page-1) * per_page_num # end = page * per_page_num # # page_data_list = data_list[start:...
68921d767e34e0b83d386ff259721c877a79d907
dong-pro/fullStackPython
/p1_basic/day32_35thread/day33/06_锁Condition.py
885
3.609375
4
import time import threading lock = threading.Condition() # ############## 方式一 ############## # def func(arg): # print('线程进来了') # lock.acquire() # lock.wait() # 加锁 # # print(arg) # time.sleep(1) # # lock.release() # # for i in range(10): # t = threading.Thread(target=func, args=(i,)) # ...
1d06bbd86af7852912dd03cdd6551da042102e99
dong-pro/fullStackPython
/p1_basic/day08_15filefunction/day12/03_函数名.py
1,221
3.984375
4
# a = 10 # b = a # 赋值操作 # print(b) # def func(): # print("我是一个小小的函数") # a = func # print(a) # func() # a() # # func = 3 # print(func) # 函数名就是一个变量 # a = 10 # b = 20 # c = 30 # lst = [a, b, c] # print(lst) # def func1(): # print("我是1") # def func2(): # print("我是2") # def func3(): # print("我是3") # # l...
aa0efc390d97afd4128fdc2279a0d8e76af2f3ac
dong-pro/fullStackPython
/p1_basic/day08_15filefunction/day08/06_文件相关操作.py
695
3.59375
4
# f = open('读文件01', mode='r', encoding='utf-8') # for line in f: # print(line.strip()) # f.seek(0) # 移动到开头 # # for line in f: # print(line.strip()) # f.close() # f = open('读文件01', mode='r', encoding='utf-8') # f.seek(3) # 3byte => 1中文 # s = f.read(1) # 读取一个字符 # print(s) # print(f.tell()) # 光标在哪儿??? # f.clo...
37bdd91ccb7a01f16c99d4222e38f84fca0ccd3d
dong-pro/fullStackPython
/p1_basic/day16_21module/day21/03_模块的导入_fromimport.py
1,535
3.703125
4
# 如何使用 from import # 需要从一个文件中使用哪个名字,就把这个名字导入进来 # from my_module import name # from import的过程中仍然执行了这个被导入的文件 # from my_module import read1 # import谁就只能用谁 # read1() # from my_module import read2 # read2() # 当前文件命名空间和模块的命名空间的问题 # from my_module import read1 # def read1(): # print('in my read1') # read1() # # from my...
5f977044ed36db5c41a50070626f2eff52afef6a
talitadeoa/head-first-code
/tartaruga espiral.py
473
3.546875
4
import turtle tortuguinha = turtle.Turtle() tortuguinha.shape('turtle') tortuguinha.color('red') tortugo = turtle.Turtle() tortugo.shape('turtle') tortugo.color('blue') def faz_quadradin(the_turtle): for i in range(0,4): the_turtle.forward(100) the_turtle.right(90) def faz_espiral(the_turtle): ...
47fa11d64b349484cca96fd2e792ae74d69bac5d
shashbhat/Internship_Data_Analytics
/Lab qustions/simple.py
287
4
4
'''Simple interest''' Principle = float(input('Enter principle value')) Rate_of_interest = float(input('Enter the rate of interest')) Time = float(input('Enter the duration')) simple_interest = (Principle * Rate_of_interest * Time) / 100 print(f"Simple Interest Is: {simple_interest}")
a120d3e7a6b4e939a25bc8784a02549a6f024c4a
shashbhat/Internship_Data_Analytics
/Assignment/Day 2/6.py
287
3.8125
4
from functools import reduce def get_input(N): input_list = list() for i in range(0, N): input_list.append(int(input())) return input_list N = int(input("How many elements: ")) numbers = get_input(N) res = reduce(lambda x, y : x + y, numbers ) print(f"Sum : {res}")
253c75c300ba55ab4dbdad4a4d4db77d33b0ee1b
shashbhat/Internship_Data_Analytics
/Lab qustions/account.py
611
3.6875
4
class Account: def __init__(self, accno, name, balance): self.accno = accno self.name = name self.balance = balance def deposit(self,deposit_amount): self.balance += deposit_amount def withdraw(self,withdraw_amount): self.balance -= withdraw_amount def showinfo...
5e1be5d482455a3a8a06eb309a4055306fd5d0a7
shashbhat/Internship_Data_Analytics
/Day 4/Quiz/test.py
1,243
3.703125
4
from quiz import Quiz class Question: questions = [] @classmethod def load_questions(cls): with open("qus.txt") as f: data = f.readlines() for i in data: lines = i.split(',') cls.questions.append(Question(*lines)) @classmethod def be...
60fb76af491beed940ad9146fc5c916c9d0ef870
shashbhat/Internship_Data_Analytics
/Lab qustions/5.py
91
4
4
num = int(input('Enter num:')) while num > 9: num = (num % 10 + num // 10) print(num)
c77a6dd6090ddd15e50741841a66cb05e8db771a
shashbhat/Internship_Data_Analytics
/Assignment/Day 1/6.py
387
4.375
4
''' 6. Write a program to accept a number from the user; then display the reverse of the entered number. ''' def reverse_num(num): ''' Reverses a number and returns it. ''' rev = 0 while num != 0: rev = rev * 10 + num % 10 num = num // 10 return rev num = int(input("Enter a numb...
4ac7158db07e3d5ce9de5125b646eee70fec24b3
milind1992/CheckIO-python
/Boolean Algebra.py
1,713
4.5
4
OPERATION_NAMES = ("conjunction", "disjunction", "implication", "exclusive", "equivalence") ​ def boolean(x, y, operation): ​ if operation=="conjunction": #"conjunction" denoted x ∧ y, satisfies x ∧ y = 1 if x = y = 1 and x ∧ y = 0 otherwise. return x*y ​ elif operation=="disjunction": #"disjunc...
0a3819f547ceaf442473d0e25e8468b74e16f3e2
Dukerider45/guvicode
/str_to_int.py
93
3.578125
4
file=open("one.txt","r") x=file.read() if(x.isalpha()): print(x) else: print(int(x))
522ae88bfc5d2169e125f96eb2a3a9e7af6d6bfe
Emc2356/Code-Generator-With-Pygame
/Classes/User_Input.py
6,026
3.546875
4
import pygame class User_Input: def __init__(self, WIDTH: int, HEIGHT: int, x: int, y: int, width: int, height: int, base_color: tuple[int, int, int], WIN: pygame.Surface, text_color: tuple[int, int, int], font_size: int): """ Parameters ---------- WIDTH: int ...
0fdbe94d7e3ba9cdae33612d91ef2f39c5d57a7a
CodeAltus/Python-tutorials-for-beginners
/Lesson 7 - Declaring and calling functions/add_from_1_to_x.py
329
3.8125
4
# Write a function named add_from_1_to_x # that takes in one parameter # and adds the consecutive values from 1 to parameter inclusive # Eg. if parameter is 10 then return # 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55 def add_from_1_to_x(x): result = x * (x + 1) / 2 return result print(add_from_1_to_x(1000000...
47ad2084d09c9be3ffae5d20f34cac14b96f85e3
CodeAltus/Python-tutorials-for-beginners
/Lesson 3 - Comments, input and operations/lesson3.py
269
4.21875
4
# Taking user input dividend = int(input("Enter dividend: ")) divisor = int(input("Enter divisor: ")) # Calculation quotient = dividend // divisor remainder = dividend % divisor # Output results print("The quotient is", quotient) print("The remainder is", remainder)
c86b788a0d4bab42f59fde14c1d3a35b034171a1
GedasLuko/Python
/Chapter 5 2/program52.py
673
4.15625
4
#Gediminas Lukosevicius #October 8th, 2016 © #import random function #build numbers function first #create accumulator #create a count in range of five numbers #specify five numbers greater than ten but less than thirty #create a total for five numbers assignment #display five random numbers and total as specified #bu...
1527cdb327c0d59506154813384d32718ceb1864
GedasLuko/Python
/chapter 2/program24.py
587
4.5
4
#Gediminas Lukosevicius #September 1st, 2016 © #This program will convert an improper fraction to a mixed number #Get Numerator #Get Denominator #Convert improper fraction to mixed number #Dislpay the equivalent mixed number with no space either side of the / symbol numerator = int(input('Please enter the numerator: '...
53c1bd002b7c652df805e6ea2cd1991746508aef
GedasLuko/Python
/write_numbers.py
510
4.375
4
#Gediminas Lukosevicius #October 24th, 2016 © #This program demonstrates how numbers must be converted to strings before they are written to a text file. def main(): outfile = open('numbers.txt', 'w') num1 = int(input('Enter a number: ')) num2 = int(input('Enter another number: ')) num3 = int(input('...
7ab57f62d55657bcba373ca0ab2cfea240039b64
GedasLuko/Python
/Chapter 5/program53/tempconvert.py
490
4.40625
4
#Gediminas Lukosevicius #October 8th, 2016 © #This program will convert temperature from celsius to fahrenheit #and fahrenheit to celsius #write formula for celsius to fahrenheit #display converted celsius temperature in fahrenheit #create function with formula for fahrenheit to celsius conversion #return fahrenheit t...
9010655de0a1edf62d5a61d8ed1cf390dfde6801
Kengros/Magic-8-Ball
/Magic-8-Ball.py
1,144
3.96875
4
#Magic 8-Ball """Allow the user to enter their question Display an in progress message Create 20 responses, and show a random response Allow the user to ask another question or quit Bonus Using whatever module you like, add a gui. Your gui must have: A box for users to enter the question At least 4 buttons: Ask , clea...
67e93e1c4feb97169c56294c63dc75d3db3a2980
zsoltkebel/university-code
/python/CS1527/practicals/p04/parenthesis_matching.py
630
3.96875
4
# Author: Zsolt Kébel # Date: 13/02/2021 # CS1527 Lecture 3.4 import array_stack d = array_stack.ArrayStack() def is_matching(expr): s = array_stack.ArrayStack() lefty = '({[' righty = ')}]' for i in expr: if lefty.__contains__(i): s.push(i) elif righty.__contains__(i):...
a2f47c662c185135da0356007805e2c1142d2bb4
zsoltkebel/university-code
/python/CS1028/practicals/p3/ex2.py
242
3.734375
4
# Author: Zsolt Kébel # Date: 21/10/2020 a = int(input("a: ")) b = int(input("b: ")) c = int(input("c: ")) n = int(input("n: ")) if a ** n + b ** n == c ** n: print("Holy smokes, Fermat was wrong!") else: print("No, that doesn’t work")
aa0f077ac732c9705b8d5b5bd769482e24c1d8f5
zsoltkebel/university-code
/python/CS1028/practicals/p2/discount.py
591
3.859375
4
# Author: Zsolt Kébel # Date: 14/10/2020 # Discount is offered on the total amount on the receipt as follow: # • 0 discounts for less than 10 items # • 20% discount between 10 and 19 items # • 30% discount between 20 and 30 items # • 50% for more than 30 items. amount = float(input("Amount: ")) numOfItems = int(input...
24bf28a166703dc6e7d2ddbfabc13d358cd83fa0
zsoltkebel/university-code
/python/CS1527/practicals/p08/kth_to_last.py
555
3.609375
4
from singly_linked_list import SinglyLinkedList def kth_to_last(k, singly_linked_list: SinglyLinkedList): kth = singly_linked_list._head end = singly_linked_list._head counter = 0 while end is not None: if counter >= k: kth = kth._next end = end._next counter += 1 ...
f9b3655fc9ad630b8a79ca530e94133d0dbf31f3
zsoltkebel/university-code
/python/CS1028/practicals/p5/e1.py
158
3.78125
4
# Author: Zsolt Kébel # Date: 04/11/2020 total = 0 for i in range(20): number = float(input("Enter a number: ")) total += number print("Total:", total)
993a683c52285f2bb12af2a2b966974e524600a7
zsoltkebel/university-code
/python/CS1527/lectures/week_9/decorators.py
397
3.609375
4
def our_decorator(func): def function_wrapper(x): print('Before calling' + func.__name__) func(x) print('After calling' + func.__name__) return function_wrapper def foo(x): print('Hi, foo has been called with ' + str(x)) foo('Hi') foo = our_decorator(foo) foo(42) @our_decorator ...
f5eb9acca1d254b9269deaba1304efb87c8bd581
zsoltkebel/university-code
/python/CS1527/practicals/p10/part_i/count_down.py
659
3.90625
4
# Date: 01/04/2021 # # Implement a Python class CountDown that takes a single integer parameter to its constructor and # then behaves as an iterator – returning the next integer value in turn, counting down from the # initial input value. class CountDown: def __init__(self, num): self._start_from = num ...
bcbc3dccb7d722515d2d32947e7763d513c99e7c
zsoltkebel/university-code
/python/CS1028/practicals/p1/ex6.py
104
4.09375
4
side = float(input("length of a side of a square: ")) print("area:", side ** 2, "perimeter:", side * 4)
1520a050e8d88587539708c3a4282e56707b3081
zsoltkebel/university-code
/python/CS1028/practicals/p7/e5.py
684
3.625
4
# Author: Zsolt Kébel # Date: 18/11/2020 import random wordsFile = open("words.txt", "r") words = wordsFile.readlines() numWords = len(words) # generating two random NUMBERS for getting two different words firstWordIndex = random.randint(0, numWords - 1) secondWordIndex = firstWordIndex while firstWordIndex == se...
6d02d1bc21d421d3ceb379e609399edeb817fb15
zsoltkebel/university-code
/python/CS1028/practicals/p6/e3.py
193
3.609375
4
# Author: Zsolt Kébel # Date: 11/11/2020 def only_even(t): result = [] for s in t: if s % 2 == 0: result.append(s) return result print(only_even([1, 3, 5, 2, 1]))
25e2f64d1c80edac30dfb37bf57035cc2b3d1e1d
zsoltkebel/university-code
/python/CS1028/practicals/p2/seasons.py
868
4.25
4
# Author: Zsolt Kébel # Date: 14/10/2020 # The first day of seasons of the year are as follow: # Spring: March 20 # Summer: June 21 # Fall: September 22 # Winter: December 21 # Display the season associated with the date. month = "Mar" date = 23 if month == "Jan" or month == "Feb": print("Winter") elif month ==...
7c1263f8c5daaedccfe34b208cac60fa7dead610
leozitor/URI
/1252.py
1,362
3.75
4
from heapq import heappush, heappop class Node: def __init__(self, num, mod): self.num = num self.mod = mod if (num & 1) == 0: self.even = True else: self.even = False def __lt__(a, b): if a.mod == b.mod: if a.even and b.even: # se a...
6d9521b2566c9345ba30ae0ed305067d5a14624c
leozitor/URI
/1258.py
5,615
3.84375
4
sizes ={'P':1, 'M': 2, 'G':3} colors ={'branco':1, 'vermelho': 2} def mergeN(llist, rlist): """ Merge two lists into an ordered list. """ final = [] while llist or rlist: # This verification is necessary for not try to compare # a NoneType with a valid type. if len(llist) and...
727a91cd2c9f5c1b96492633f78a7fa05be80b93
Sh-Zh-7/zombie-enterprise-recognition
/TraditionML/data/spliter.py
1,659
3.578125
4
""" 这个:文件的作用就是把已经处理好的data_set.csv 按照8:2的比例重新分为train_set.csv和test_set.csv 理由如下: 1. 如果直接在程序中使用train_test_split,那么会增加程序运行的时间,降低开发效率。 2. 从物理上直接把文件分成两个文件,能有效避免data leakage,避免我们的估计过于乐观 """ import random import pandas as pd import logging import utils SPILT_RATE = 0.2 def GetDataSet(filename: st...
1d1df7a600bd6b20d50543ac2548cee2eb5ac32a
verbistjoel/Python_MemeGenerator
/MemeEngine/MemeEngine.py
2,443
3.546875
4
"""Meme Engine.""" from PIL import Image, ImageDraw, ImageFont import random class MemeEngine(): """Generates the Meme - pic and quote. The MemeEngine generates the picture and overlay quote. Grabs the picture from the provided path and resizes it, if necessary, to max width of 500px. Then ...
4ddeb350998543e4a6059af34fbf58cb6069b005
gschen/where2go-python-test
/1906101041刘仕豪/第九周练习题/2.py
330
3.53125
4
''' 2、 一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少? ''' import math for a in range(1,10000): if int(math.sqrt(a+100))*int(math.sqrt(a+100))==a+100 and int(math.sqrt(a+268))*int(math.sqrt(a+268))==a+268: print("该数为:{}".format(a))
344f7af22ddc49a64a779296713921166cd8b754
gschen/where2go-python-test
/1906101007李和龙/库/binary_search.py
600
3.875
4
#二分法寻找一个数字在一个列表中的索引值 def binary_search(num_list,num): low = 0 high = len(num_list) while low < high: mid = int((low+high)/2) guess_number = num_list[mid] if guess_number == num: return mid if guess_number > num: high = mid if guess_number ...
c5b87363f4abfd6162108f89b39c5ed848832eb8
gschen/where2go-python-test
/1300-蓝桥杯/year-2012/JAVA-C(2)/test-02.py
2,856
3.515625
4
# 2.密码发生器 # 在对银行账户等重要权限设置密码的时候,我们常常遇到这样的烦恼:如果为了好记用生日吧, # 容易被破解,不安全;如果设置不好记的密码,又担心自己也会忘记;如果写在纸上,担心纸张被 # 别人发现或弄丢了... # 这个程序的任务就是把一串拼音字母转换为6位数字(密码)。我们可以使用任何好记的拼音 # 串(比如名字,王喜明,就写:wangximing)作为输入,程序输出6位数字。 # 变换的过程如下: # 第一步. 把字符串6个一组折叠起来,比如wangximing则变为: # wangxi # ming # 第二步. 把所有垂直在同一个位置的字符的ascii码值相加,得出6个数字,如上面的例子, # 则得出: #...
2ef9eaf5be2a6e0481e5c9a34a58b897b70b8255
gschen/where2go-python-test
/1906101103王自强/day20191001/test.py
322
3.703125
4
# -*-_ coding:UTF-8 -*- #求三角形的面积 while True: a=float(input('请输入三角形的一边长;')) b=float(input('请输入三角形的二边长;')) c=float(input('请输入三角形的三边长;')) s=(a+b+c)/2 area=(s*(s-a)*(s-b)*(s-c))**0.5 print('三角形的面积为;%0.2f'%(area))
9aea23a823bfe746e7c7df10282fce3b1f0fbac4
gschen/where2go-python-test
/1906101038江来洪/day20191022/Test_2_5.py
159
3.625
4
#求奇数分之一序列前N项和 x = int(input('请输入一个数:')) n = 1 S = 0 while n<=x: S = S+1/(2*n-1) n += 1 print('sum = %s'% '%.6f'% S)
94b05f21b3f8715c0250ebbd1b22d749d84715fc
gschen/where2go-python-test
/1906101103王自强/likou周赛4/2.py
775
4.03125
4
'''我们定义「顺次数」为:每一位上的数字都比前一位上的数字大 1 的整数。 请你返回由 [low, high] 范围内所有顺次数组成的 有序 列表(从小到大排序)。 示例 1: 输出:low = 100, high = 300 输出:[123,234] 示例 2: 输出:low = 1000, high = 13000 输出:[1234,2345,3456,4567,5678,6789,12345] 提示: 10 <= low <= high <= 10^9''' def sequentialDigits(low, high): box1=[] box = [12,23,34,45,56,67,78,89,123...
4119ddc7824d60472542d8381e8668bf9e3d12dc
gschen/where2go-python-test
/1300-蓝桥杯/year-2018/JAVA-C/test-05.py
92
3.609375
4
n=input() while int(n)>=10: s=0 for i in str(n): s+=int(i) n=s print(n)
a94078380045ef4dd10ee27684fbbe77fa3224aa
gschen/where2go-python-test
/1906101001周茂林/day20191024/第九周-08.py
416
3.5
4
''' 猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个.第二天早上又将剩下的桃子吃掉一半,又多吃了一个。 以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。 ''' a = 1 for i in range(0,9): a = (a+1) * 2 print('第一天共摘了{}个.'.format(a))
5020d298c5358611e894050f74c974240658f7ff
gschen/where2go-python-test
/1806101007侯帅/1.py
638
3.5625
4
# class test: # def test(self,name): # # return ("hello",name) # # # if __name__ == '__main__': # # t1=test() # a=t1.test(input()) # print(a) # from itertools import groupby # lst = sorted([3,2,1,2,3,4,3,4,5,9,10,11]) # # fun = lambda x: x[1]-x[0] # for k, g in groupby(enumerate(lst), fun): # ...
de617bcd10528f107c8a78551b08d5a7f49de4a3
gschen/where2go-python-test
/1906101031王卓越/类/lei_.py
679
3.828125
4
class A(object): def __init__(self): print('A') super(A,self).__init__() class B(object): def __init__(self): print('B') super(B,self).__init__() class C(A): def __init__(self): print('C') super(C,self).__init__() class D(A): def __init__(self): pr...
dde49f77586fcd4d5b1fa1983257bb9163a55f74
gschen/where2go-python-test
/1906101001周茂林/day20191003/Text_02_03.py
186
3.8125
4
a = float(input()) if a < 0: print('Invalid Value') elif a <= 50: print('cost = {:.2f}'.format(a * 0.53)) else: a = 50*0.53 + (a-50)*0.05 print('cost = {:.2f}'.format(a))
5c5a801388dee418787dcde076b0b96a2d9283ad
gschen/where2go-python-test
/1906101105石涛/十四周练习/第四题 数字的拆分(十四周作业).py
529
3.6875
4
# coding=utf-8 '''4. 给定一个正整数N,将其表示为数字1,2,5,11相加的形式输出。 要求上述数字出现的总次数最少(每个数字可以重复使用)。 输入说明:一个正整数N (N<= 10000)。 输入:21 输出:11 5 5 ''' 1,2,5,11 x=int(input('请输入一个你比较喜欢的正整数:')) print() print('准备好了吗?我要开拆了哈,嘿嘿...') while x>=11: x=x-11 print(11) while x>=5: x=x-5 print(5) while x>=2: x=x-2 print(2) ...
c437e2b2397e99a209a6b2273117a443d198e277
gschen/where2go-python-test
/1906101041刘仕豪/第九周练习题/3.py
802
4.125
4
''' 3、 输入三个整数x,y,z,请把这三个数由小到大输出。 ''' # x = int(input("请输入正整数x:")) # y = int(input("请输入正整数y:")) # z = int(input("请输入正整数z:")) # if y>x and y>z and z>x: # x1 = y # y1 = z # z1 = x # elif y>x and y>z and x>z: # x1 = y # y1 = x # z1 = z # elif x>z and z>y: # y1 = z # z1 = y # x1 = x # eli...
5fada243d94aa3fb57b15ed5eca98f03e1a9cdde
gschen/where2go-python-test
/1906101033唐超/20191210/5.py
325
3.78125
4
''' 本题目要求计算下列分段函数f(x)的值:f(x)=0 x=0 f(x)=1/x x-=0 输入格式: 输入在一行中给出实数x。 输出格式: 在一行中按“f(x) = result”的格式输出,其中x与result都保留一位小数。 ''' x = float(input()) if x != 0: print("sum=",1 / x) else: print("0")
c71287094356331d5a1aa27635bb8d21210ad87c
gschen/where2go-python-test
/1906101038江来洪/day20191103/蓝桥杯训练题_10_2.py
318
3.875
4
#最后留下的是原来几号 n = int(input('请输入人数:')) list = list(range(1,n+1)) if n == 1: print('最后留下来的是:1') else: x = 0 for i in range(n-1): x = (x+3)%len(list)-1 list.pop(x) if x < 0: x = 0 print('最后留下来的是:',list[0])
11dfd5d160e7d523c23f6f332df3e297ed82ee0d
gschen/where2go-python-test
/1906101031王卓越/以前的代码/给定一个只包含字符串.py
380
3.5625
4
def raw(n): n=str(n) k=0 for i in range(0,len(n)): if n[k]==n[-k-1]: print("true") k=k+2 elif n[k]!=n[-k-1]: print("false") k=k+2 elif n[k]!=n[k+1]: print("true") k=k+2 elif n[k]!=n[k+1]: prin...
6f7e5ef41a4bc136139de03c0521798c37e9bf75
gschen/where2go-python-test
/1806101073刘玉江/practice/Day0227/test02.py
1,734
3.734375
4
''' 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。 示例 1: 给定数组 nums = [1,1,2], 函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。 你不需要考虑数组中超出新长度后面的元素。 示例 2: 给定 nums = [0,0,1,1,1,2,2,3,3,4], 函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。 你不需要考虑数组中超出新长度后面的元素。 说明: 为什么返回数...
cda5349b8af7329251343a19b5403ef201f71164
gschen/where2go-python-test
/1906101105石涛/十四周练习/第二题 满足的算式(十四周作业).py
1,482
3.6875
4
# coding=utf-8 '''2 马虎的算式 小明是个急性子,上小学的时候经常把老师写在黑板上的题目抄错了。 有一次,老师出的题目是:36 x 495 = ? 他却给抄成了:396 x 45 = ? 但结果却很戏剧性,他的答案竟然是对的!! 假设 a b c d e 代表1~9不同的5个数字(注意是各不相同的数字,且不含0) 能满足形如: ab * cde = adb * ce 这样的算式一共有多少种呢? 请你利用计算机的优势寻找所有的可能,并回答不同算式的种类数。 满足乘法交换律的算式计为不同的种类,所以答案肯定是个偶数。 因为 36 * 495 = 396 * 45 = 17820 类似这样的巧合情况可能还有很多,比如:2...
60b40f345a12dac59f986ec76fbf76bc787a9ff3
gschen/where2go-python-test
/1906101001周茂林/第16周20191215/力扣-1.py
503
4.25
4
''' 给你一个单链表的引用结点 head。链表中每个结点的值不是 0 就是 1。已知此链表是一个整数数字的二进制表示形式。 请你返回该链表所表示数字的 十进制值 。 示例 1: 输入:head = [1,0,1] 输出:5 解释:二进制数 (101) 转化为十进制数 (5) 示例 2: 输入:head = [0] 输出:0 ''' def getDecimalValue(head): s = int(''.join(str(x) for x in head), 2) print(s) getDecimalValue([1, 0, 1]) getDecimalValue([0, 0])
a5213e7d67f4e7d832c73d12e41e332f6d00ae64
gschen/where2go-python-test
/1906101103王自强/蓝桥杯测试/6.py
550
3.609375
4
'''标题:打印大X 如下的程序目的是在控制台打印输出大X。 可以控制两个参数:图形的高度,以及笔宽。''' h,x=map(int,input().split(' ')) m=h-x-1 i=0 while m>0: print('.' * i + '*'*x + "." * (m) + '*'*x + '.' * i) m-=2 i+=1 s=q=h+x-1-2*(i) while q>=x: print('.'*i+'*'*q+'.'*i) q-=2 i+=1 q=q+4 i=i-1 while q<=s: i=i-1 print('.' * i...
f7ea87d48b891c67666cd946656bf055268b015a
gschen/where2go-python-test
/1906101059王曦/11月/day20191129/1129.py
265
3.765625
4
#求将一个正整数分解质因数 n=int(input()) while n>1: for i in range(2,n+1): if n%i==0: n=int(n/i) if n==1: print(i) else: print('{}'.format(i),end='*') break
29faac0fc01900ce5d6b7d5382f1a7ccd19ce63d
gschen/where2go-python-test
/1906101031王卓越/以前的代码/游戏.py
224
3.984375
4
for i in range(3): name = input("用户名") password = input("密码") if name == "王卓越" and password == "123": print("登陆成功") break else: print("登陆失败") print("你还剩余%d次机会"%(2-i))
726a7f1cf4f50554b429f5203a29a78552d48fe3
gschen/where2go-python-test
/1906101041刘仕豪/第九周练习题/5.py
261
3.671875
4
''' 5、 判断101-200之间有多少个素数,并输出所有素数。 ''' a = [] print("101-200之间的素数有:") for b in range(101,201): if b%2!=0 and b%3!=0 and b%5!=0: a.append(b) print(b) print("共{}个素数".format(len(a)))
cacbf029b45a960fa30b175e3f0bafe66ebfaab6
gschen/where2go-python-test
/1200-常用算法/其他/111_二叉树的最小深度.py
1,288
4.15625
4
# https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/ from typing import * import unittest # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrderBottom(self, root: TreeNode)...
69700e3b044c27af7a1d678dab09f85e999783b3
gschen/where2go-python-test
/1004-regression/SimpleLinearRegression.py
1,165
3.515625
4
import numpy as np import matplotlib.pyplot as plt class SimpleLinearRegressionSelf: def __init__(self): self.a_ = None self.b_ = None def fit(self, x_train, y_train): x_mean = np.mean(x_train) y_mean = np.mean(y_train) numerator = 0.0 denominator = 0.0 ...
f2a4fe94b1afce04d0c0b80d7b96a14800dc38a0
gschen/where2go-python-test
/1906101041刘仕豪/第九周练习题/8.py
460
3.640625
4
''' 8、 猴子吃桃问题:猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。 ''' a = 1 t = 0 while t<9: a = (a+1)*2 t+=1 print("猴子第一天一共摘了{}个桃子。".format(a))
e504075b0dd3b5bc7afde98ebbd4552b3534bf55
gschen/where2go-python-test
/1906101038江来洪/day20191026/蓝桥杯训练题_9.py
346
3.625
4
#找出三队赛手的名单 list1 = [] list2 = [] for m in range(ord('a'),ord('d')): for n in range(ord('x'),ord('z')+1): if m+23 != n and m+24 != n and m+21 != n: list1.append(chr(m)) list2.append(chr(n)) n = 0 while n <= 2: j = list1[n] k = list2[n] print('%s VS %s' % (j,k),end='; ') ...
46112bf652e1a6bcfb10e133f3fe4fe3c8877934
gschen/where2go-python-test
/1906101031王卓越/20191229/2.py
399
3.640625
4
class Node: def __init__(self,value=None,left=None,right=None): self.value=value self.left=left #左子树 self.right=right #右子树 def preTraverse(root): # ''' # 前序遍历 # ''' if root==None: return print(root.value) preTraverse(root.left) ...
25f64eb55ac086484e098f2c83efb6a883d21a74
gschen/where2go-python-test
/1906101080张珈瑜/十四周 3.py
98
3.578125
4
n=int(input()) a=2 b=1 sum=0 for i in range(n): c=a/b sum=sum+c a,b=a+b,a print(sum)
ece509638d6bcaf542e8483d52ac4cf6348f8f9f
gschen/where2go-python-test
/1200-常用算法/回溯算法/79. 单词搜索.py
766
3.75
4
''' 给定一个二维网格和一个单词,找出该单词是否存在于网格中。 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。 示例: board = [ ['A','B','C','E'], ['S','F','C','S'], ['A','D','E','E'] ] 给定 word = "ABCCED", 返回 true. 给定 word = "SEE", 返回 true. 给定 word = "ABCB", 返回 false. 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/probl...
8bca195ad4bd77b4a1f88cb1ade4be8262bb347c
gschen/where2go-python-test
/1906101105石涛/蓝桥杯寒假练习/2019年java C组/test1.py
787
3.75
4
# coding=utf-8 ''' 试题 A: 求和 本题总分:5 分 【问题描述】 小明对数位中含有 2、0、1、9 的数字很感兴趣,在 1 到 40 中这样的数包 括 1、2、9、10 至 32、39 和 40,共 28 个, 他们的和是 574。 请问,在 1 到 2019 中,所有这样的数的和是多少? 【答案提交】 这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一 个整数,在提交答案时只填写这个整数,填写多余的内 容将无法得分 ''' # (思路:用for循环取出需要的数字再将其拆分,看里面是否包含需要的数字) x=0 for i in range(1,2020): for it in str(i...
18905408c096d8026f8d9ac759efb2d1c7c8f924
gschen/where2go-python-test
/1300-蓝桥杯/year-2012/JAVA-C(2)/2 密码发生器.py
2,027
3.5
4
''' 在对银行账户等重要权限设置密码的时候,我们常常遇到这样的烦恼:如果为了好记用生日吧, 容易被破解,不安全;如果设置不好记的密码,又担心自己也会忘记;如果写在纸上,担心纸张被 别人发现或弄丢了... 这个程序的任务就是把一串拼音字母转换为6位数字(密码)。我们可以使用任何好记的拼音 串(比如名字,王喜明,就写:wangximing)作为输入,程序输出6位数字。 变换的过程如下: 第一步. 把字符串6个一组折叠起来,比如wangximing则变为: wangxi ming 第二步. 把所有垂直在同一个位置的字符的ascii码值相加,得出6个数字,如上面的例子, 则得出: 228 202 220 206 120 105 ...
a6aa35fb01ceff2649a038ae7bbcc28383cc1644
gschen/where2go-python-test
/1906101001周茂林/第11周/1.py
607
3.53125
4
''' 1. 每个非负整数 N 都有其二进制表示。 例如, 5 可以被表示为二进制 "101",11 可以用二进制 "1011" 表示,依此类推。 注意,除 N = 0 外,任何二进制表示中都不含前导零。 二进制的反码表示是将每个 1 改为 0 且每个 0 变为 1。 例如,二进制数 "101" 的二进制反码为 "010"。 给定十进制数 N,返回其二进制表示的反码所对应的十进制整数。 ''' def qwqqw(n): list1 = [] while int(n): list1.append(str(n % 2)) n = n // 2 list1.reverse() ...
27e7d4c31a1dbbfd0bed2fe068eeee6beff4459d
gschen/where2go-python-test
/1906101077杨修伟/第六周练习/12.py
211
3.546875
4
#huashi,sheshi a,b=input().split() a,b=eval(a),eval(b) if(a>b): print("Invalid.") else: print("fahr celsius") i = a while i <= b: print("{:d}{:>6.1f}".format(i,5*(i-32)/9)) i += 2
cc81033abc8a9b65e417cb532e678e6effb8acc4
gschen/where2go-python-test
/1906101001周茂林/2020寒假/力扣171/1.py
698
3.84375
4
''' 「无零整数」是十进制表示中 不含任何 0 的正整数。 给你一个整数 n,请你返回一个 由两个整数组成的列表 [A, B],满足: A 和 B 都是无零整数 A + B = n 题目数据保证至少有一个有效的解决方案。 如果存在多个有效解决方案,你可以返回其中任意一个。 示例 1: 输入:n = 2 输出:[1,1] 解释:A = 1, B = 1. A + B = n 并且 A 和 B 的十进制表示形式都不包含任何 0 。 示例 2: 输入:n = 11 输出:[2,9] ''' def getNoZeroIntegers(n): for i in range(1, n): if '0' not in ...
74ad0d0e5c7dbc3ae929c3b0672d1745985f233d
gschen/where2go-python-test
/1906101001周茂林/第15周/小强爱电影.py
976
3.6875
4
''' 小强爱看电影。但他的记忆力不好,只记得最近看过的k部电影,之前的就完全忘记了,忘记的电影作为没看过进行处理, 在电影库有很多电影,小强获得了一个长度为n的推荐电影序列(用编号a1,a2,,,an表示), 电影可能被重复推荐,如果小强还记得已经看过就不会再看,请问小强最后到底记得看过哪些电影并输出。 输入说明:第一行有两个整数N,K(N表示推荐电影序列长度,K表示他能记得影片的数量).第二行有N个整数。a1,a2,,,an. 输出说明:第一行输出正整数M(M为小强最后记得的电影数量)。第二行输出记得的电影。 输入样例: 7 2 1 2 3 2 1 3 2 输出样例: 2 1 2 ''' N, K = map(int, inpu...
7b1b854373b05f83dcc889df5be17a04b4190ce0
gschen/where2go-python-test
/1906101007李和龙/Day20191117/16.py
189
3.625
4
a=['Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] s=input() l=len(s) for i in range(1,l): if s[i-1:i+2]in a: print(s[i-5:i+2]) else: print('2000Jan')
be8f4114777f866ba50dc567d75843ceb9c59bd0
gschen/where2go-python-test
/1906101103王自强/likou周赛3/3.py
1,082
3.75
4
'''给你一个整数数组 nums 和一个正整数 threshold ,你需要选择一个正整数作为除数, 然后将数组里每个数都除以它,并对除法结果求和。 请你找出能够使上述结果小于等于阈值 threshold 的除数中 最小 的那个。 每个数除以除数后都向上取整,比方说 7/3 = 3 , 10/2 = 5 。 题目保证一定有解。 示例 1: 输入:nums = [1,2,5,9], threshold = 6 输出:5 解释:如果除数为 1 ,我们可以得到和为 17 (1+2+5+9)。 如果除数为 4 ,我们可以得到和为 7 (1+1+2+3) 。如果除数为 5 ,和为 5 (1+1+1+2)。 示例 2: 输入:nums = [...
56ed3089f44d7044ae99521f43ebc3639f956334
gschen/where2go-python-test
/1906101007李和龙/Day20191001/作业1-猜数字.py
343
3.671875
4
import random #猜数字 a = random.randint(0,10) print(a) N = 0 while True: N += 1 b = int(input("请猜一个数字:")) if a < b: print("遗憾,太大了") if a > b: print("遗憾,太小了") if a == b: print("你猜对了,猜了%d次"% N) break
59ea7ea3e7f77b6085ed5ff0b72728f9221c89b9
gschen/where2go-python-test
/1906101025康健铭/ago/12.py
1,831
3.953125
4
def quick_sort(alist, start, end): """快速排序""" if start >= end: # 递归的退出条件 return mid = alist[start] # 设定起始的基准元素 low = start # low为序列左边在开始位置的由左向右移动的游标 high = end # high为序列右边末尾位置的由右向左移动的游标 while low < high: # 如果low与high未重合,high(右边)指向的元素大于等于基准元素,则high向左移动 while low < high...
609becc37eff825fa6838724929955d567c4148d
gschen/where2go-python-test
/1806101073刘玉江/practice/Day0228/test01.py
848
3.671875
4
''' 在一个 m*n 的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 0)。你可以从棋盘的左上角开始拿格子里的礼物, 并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物? ''' grid = \ [ [1, 3, 1], [1, 5, 1], [100, 2, 1] ] for i in range(len(grid)): for j in range(len(grid[0])): if i == 0 and j != 0: grid[...
d2f26d23205005037b49e1b468d2c0fe351ba1e1
gschen/where2go-python-test
/1906101007李和龙/Day20191223/约瑟夫环问题.py
468
3.625
4
def Josephus_problem(num,gap): location_list = [a for a in range(1,num+1)] if num == 1 : return else: index = 0 for i in range(num-1): index = (index + gap )%len(location_list) - 1 print("本次出局的人为:",location_list[index]) del location_list[index] ...
9b835a69344e428fe8f33fc97ce5b5a6de8bacc9
gschen/where2go-python-test
/1806101049马原涛/practice/GA/ga_onself.py
6,773
3.921875
4
import numpy1 as np import matplotlib.pyplot as plt import math class GA: ''' Genetic Algorithm class one population has many chromosomes(individuals) one chromosome has many genes ''' # 值定义 # 种群大小、染色体长度、基因值范围、交叉概率、变异概率 def __init__(self): self.population_size = 30 # one populati...
ca5333d4f7831f7cdd55a38d984fc1d17fae6fa6
gschen/where2go-python-test
/1906101031王卓越/1300-蓝桥杯/year-2015/java-B组/text-06.py
1,015
4.03125
4
# 6.饮料换购 # • 乐羊羊饮料厂正在举办一次促销优惠活动。乐羊羊C型饮料,凭3个瓶盖可以再换一瓶C型饮料,并且可以一直循环下去,但不允许赊账。 # • 请你计算一下,如果小明不浪费瓶盖,尽量地参加活动,那么,对于他初始买入的n瓶饮料,最后他一共能得到多少瓶饮料。 # 输入:一个整数n,表示开始购买的饮料数量(0<n<10000) # 输出:一个整数,表示实际得到的饮料数 # 例如: # 用户输入:100 # 程序应该输出:149 # 用户输入:101 # 程序应该输出:151 # 资源约定: # 峰值内存消耗(含虚拟机) < 256M # CPU消耗 < 1000ms # 请严格按要求输出,不要画蛇添足地打印类似...
3973aaf954332406b0ba8fa880f0b21ca542ebbe
gschen/where2go-python-test
/1200-常用算法/回溯算法/784. 字母大小写全排列.py
1,311
3.8125
4
''' 给定一个字符串S,通过将字符串S中的每个字母转变大小写,我们可以获得一个新的字符串。返回所有可能得到的字符串集合。 示例: 输入: S = "a1b2" 输出: ["a1b2", "a1B2", "A1b2", "A1B2"] 输入: S = "3z4" 输出: ["3z4", "3Z4"] 输入: S = "12345" 输出: ["12345"] 注意: S 的长度不超过12。 S 仅由数字和字母组成。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/letter-case-permutation 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请...
fa4049f7e0fa5b995b10e42bf4925fc405cd7c68
gschen/where2go-python-test
/1906101025康健铭/ago/2.py
440
3.71875
4
from datetime import datetime kjm=datetime(2000,4,13) print(kjm.isoformat()) print(kjm.year,"年",kjm.month,"月",kjm.day,"日") print(kjm.day,"日",kjm.month,"月",kjm.year,"年") print(kjm.strftime("%Y-%m-%d")) print(kjm.strftime("%d-%m-%Y")) print(kjm.strftime("%Y:%m:%d")) print(kjm.strftime("%Y=%m=%d")) print(kjm.strftime("%Y/...
c87e9725be34a7a728bd9694e1069e860a25d0fb
gschen/where2go-python-test
/1300-蓝桥杯/year-2019/C++-B/test-07.py
484
3.65625
4
class Solution: def countNodes(self, root): def height(t): h = -1 while t: h += 1 t = t.left return h h = height(root) nodes = 0 while root: if height(root.right) == h - 1: nodes += 2 ** h...
69a3c466d603028e10a47d9d5ab318dc67ceb331
gschen/where2go-python-test
/1300-蓝桥杯/year-2012/JAVA-C(2)/4 括号问题.py
420
3.5625
4
s = input() kuohao = ['(',')','[',']','{','}'] kuohao_list = [] for i in s: if i in kuohao: kuohao_list.append(i) kuohao_str = ''.join(kuohao_list) l = [] for i in kuohao_str: if i == '(' or i =='[' or i == '{': l.append(i) elif i == ')' and l[-1] == '(': l.pop() elif i == ']' an...
669fcd20a59e754a92d32629987a1d50ff2a433c
gschen/where2go-python-test
/1906101105石涛/蓝桥杯寒假练习/2013年java B组/test3.py
1,400
3.53125
4
# coding=utf-8 ''' 3.标题: 振兴中华 小明参加了学校的趣味运动会,其中的一个项目是:跳格子。 地上画着一些格子,每个格子里写一个字,如下所示:(也可参见p1.jpg) 从我做起振 我做起振兴 做起振兴中 起振兴中华 比赛时,先站在左上角的写着“从”字的格子里,可以横向或纵向跳到相邻的格子里,但不能跳到对角的格子或其它位置。一直要跳到“华”字结束。 要求跳过的路线刚好构成“从我做起振兴中华”这句话。 请你帮助小明算一算他一共有多少种可能的跳跃路线呢? 答案是一个整数,请通过浏览器直接提交该数字。 注意:不要提交解答过程,或其它辅助说明类的内容。 (答案:35) '''...
b3b8836c6aa544628b4ab0f6190de041bec3fbaa
gschen/where2go-python-test
/1906101103王自强/蓝桥杯测试/2.py
1,155
3.6875
4
'''标题:猴子分香蕉 5只猴子是好朋友,在海边的椰子树上睡着了。这期间,有商船把一大堆香蕉忘记在沙滩上离去。 第1只猴子醒来,把香蕉均分成5堆,还剩下1个,就吃掉并把自己的一份藏起来继续睡觉。 第2只猴子醒来,重新把香蕉均分成5堆,还剩下2个,就吃掉并把自己的一份藏起来继续睡觉。 第3只猴子醒来,重新把香蕉均分成5堆,还剩下3个,就吃掉并把自己的一份藏起来继续睡觉。 第4只猴子醒来,重新把香蕉均分成5堆,还剩下4个,就吃掉并把自己的一份藏起来继续睡觉。 第5只猴子醒来,重新把香蕉均分成5堆,哈哈,正好不剩! 请计算一开始最少有多少个香蕉。 需要提交的是一个整数,不要填写任何多余的内容。 ''' i=1 while True:...
9a87f6304b28b038e701e1766c814b6156cb5545
gschen/where2go-python-test
/1906101103王自强/15周练习/2.py
434
3.75
4
'''本题要求编写程序,计算序列 1 + 1/3 + 1/5 + ... 的前N项之和。 输入格式: 输入在一行中给出一个正整数N。 输出格式: 在一行中按照“sum = S”的格式输出部分和的值S,精确到小数点后6位。题目保证计算结果不超过双精度范围。 输入样例: 23 输出样例: sum = 2.549541''' N=int(input()) sum=0 for i in range(1,2*N+1,2): sum+=1/i print('sum=%.6f'%sum)