blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
7c359fcf053420233f1d4d06a1af2ef3a4ca3f9d
KayDeVC/Python-CeV
/MUNDO2/Ex037_Conv_Base.py
550
3.953125
4
print('\n CONVERSOR DE BASES ') num = int(input('Digite um número inteiro: ')) print('Escolha uma das bases para conversão:') print('[1] para Binário\n[2] para Octal\n[3] para Haxadecimal') esc = int(input('Sua escolha:')) if esc == 1: print('\n{} convertido para Binário é {}'.format(num, bin(num)[2:])) elif esc...
cf72b1419954422f155ebefa40e4b7a224eab846
KayDeVC/Python-CeV
/MUNDO1/Ex008_m_cm_mm.py
226
4.0625
4
print(' Convertendo "m" em "cm" e "mm" ') m = float(input('Digite um valor em metros:')) cm = m*100 mm = cm*10 print('O valor equivale á {} centímetros.'.format(cm)) print('E também equivale á {} milímetros.'.format(mm))
dd6f1c0d9418683e507f113f171871541c5dcea8
KayDeVC/Python-CeV
/MUNDO2/Ex065_NumFlag.py
567
4.03125
4
print('\n<---> Fabricando números <--->\n') esc = 'S' soma = qt = med = maior = menor = 0 while esc in 'Ss': num = int(input('Digite um número: ')) soma += num qt += 1 if qt == 1: maior = menor = num else: if num > maior: maior = num if num < menor: me...
4bdfcf08de195124327ecbe327ede951e8d9ecaa
KayDeVC/Python-CeV
/MUNDO2/Ex040_Media2.py
413
3.890625
4
print('\n \33[1;32m====== PROJETO MÉDIA 2.0 ======\33[m') nota1 = float(input('Digite a primeira nota: ')) nota2 = float(input('Digite a segunda nota: ')) media = (nota1 + nota2) / 2 print('\nSua média é {:.1f}'.format(media)) if media < 5: print('\n\33[1;31mALUNO REPROVADO!\33[m') elif 5 <= media < 7: print('\...
4f4ace2dc65df7724e540d03e2a21670893359f1
KayDeVC/Python-CeV
/MUNDO3/Ex102_Fatorial.py
544
3.859375
4
def fatorial(n, show = False): """ => Calcula o valor do fatorial do número. :param n: O número a ser calculado. :param show: (opcional) Mostrar ou não a conta. :return: O valor fatorial do número n. """ cont = n fat = 1 while cont > 0: if show: print(f'{c...
1db1093d43320f4492f9571ce11cb39c579fe13e
KayDeVC/Python-CeV
/MUNDO3/Ex073_CampBr.py
637
3.890625
4
camp = ('Corinthians', 'Palmeiras', 'Santos', 'Grêmio', 'Cruzeiro', 'Flamengo', 'Vasco da Gama', 'Chapecoense', 'Atlético MG', 'Botafogo', 'Atlético PR', 'Bahia', 'São Paulo', 'Fluminense', 'Sport Recife', 'EC Vitória', 'Coritiba', 'Avaí', 'Ponte Preta', 'Atlético GO') print('\n') print('-'*40) ...
45c381091022aaa041709404d845cd0ae7029bb2
KayDeVC/Python-CeV
/MUNDO2/Ex047_Pares_1~50.py
129
3.640625
4
print('\n{:=^40}'.format(' PARES 1-50 ')) n = 0 for n in range(2, 51,2 ): print('{:^3}'.format(n), end = '') print('\n\nFIM')
dcd2f990eec14d4e1b6100a30f9720712feb69a6
KayDeVC/Python-CeV
/MUNDO3/Ex084_ListDados.py
868
3.546875
4
pessoas = list() aux = list() pes = lev = 0 while True: aux.append(str(input('\nNome: '))) aux.append(float(input('Peso (Kg): '))) if len(pessoas) == 0: pes = lev = aux[1] else: if aux[1] > pes: pes = aux[1] if aux[1] < lev: lev = aux[1] pessoas.append...
325d9bc227274df46f0ee94a2b07b7177cf4ea5f
KayDeVC/Python-CeV
/MUNDO3/Ex095_JogFut2.py
1,375
3.75
4
time = [] jogador = {} gols = [] print() while True: jogador.clear() jogador['nome'] = str(input('Nome do Jogador: ')) partidas = int(input(f'Quantas partidas {jogador["nome"]} participou: ')) gols.clear() for c in range(0, partidas): gols.append(int(input(f' Quantos gols na partida {c + 1}?...
f938b5f8789c38414174376398e2aaa3e5d2317d
KayDeVC/Python-CeV
/MUNDO1/Ex020_Shuffle.py
290
3.703125
4
from random import shuffle print('Ordem de entrega dos trabalhos!') a1 = str(input('Aluno 1:')) a2 = str(input('Aluno 2:')) a3 = str(input('Aluno 3:')) a4 = str(input('Aluno 4:')) lista = [a1,a2,a3,a4] shuffle(lista) print('Os trabalhos serão apresentados na ordem: \n {}.'.format(lista))
991d85e324051d5cb8b58901760231d18f899ca3
lsabiao/PyBrainfuck
/PyBrainfuck.py
5,945
3.5625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # interpretador python de Brainfuck # Implementação da especificação da linguagem # Os 8 comandos # comandos = {"+":"mais", incrementa em 1 o valor da célula atual # "-":"menos", decrementa em 1 o valor da célula atual # ">":"sobeP...
60b4b263cc9d1dc5eda0e828e3e6d316d4ea24f7
NH333/CellSegmentation
/code/test.py
229
3.5
4
list1 = ['1','2','3'] list2 = ['a','b','c'] list3 = ['A','B','C'] count = 141 list4 = [] d = {} for i in range(0, len(list1)): d[list1[i]]=(list2[i], list3[i]); for i in range(count): list4.append(('%d')%(i+1)) print(d)
9ead0396a9d02de00691d4ead6a37ef349bb3089
Yoone/aa-regrade
/src/charms.py
607
3.546875
4
# -*- coding: utf-8 -*- from config import prices """ Regrade Charms """ class Charm: def __init__(self, name, chance, price): self.name = name, self.chance = chance self.price = price def __str__(self): return self.name green_charm = Charm('Green', chance=1.75, price=int(p...
e69bce0ab26d95b2a9b444a599ab8b226f00f0be
zerodawn1802/ResearchLab
/b1.py
336
3.6875
4
s = (input().strip()) s = s.lower() for i in s: if (i < 'a' or i > 'z') and i != ' ': s = s.replace(i, "") res = s.split(" ") for i in range(len(res) - 1): temp = res[i] if(len(temp) > 0): print(temp[0].upper(), end = '') print(".", end = '') temp = res[len(res) - 1] print(te...
c28025e2004edd4ab034ea50520528934b1540fe
EmrahNL55/Class4-PythonModule-Week7
/week7_1.py
1,035
4.0625
4
print('*'*21) '''Write a program that detects the ID number hidden in a text. We know that the format of the ID number is 2 letters, 1 digit, 2 letters, 2 digits, 1 letter, 1 digit (For example: AA4ZA11B1). Input : AABZA1111AEGTV5YH678MK4FM53B6 Output : MK4FM53B6 Input : AEGTV5VZ4PF94B6YH678 ...
e5301833f55eaeafc9871e9c1f205a87829b2062
afolson/cia
/.svn/pristine/e5/e5301833f55eaeafc9871e9c1f205a87829b2062.svn-base
3,541
3.765625
4
import orderedset import thread class TwoLevelQueue(object): """ A blocking queue with uniqueness and two priorities. The basic idea is to use as scheduling queue for cronned jobs (low priority) and spontaneously-triggered jobs (high priority). A job still scheduled will not be scheduled twice if,...
43f7fe3320bbee84eefe16f2ee039a2e37231c76
matthew-brett/draft-statsmodels
/scikits/statsmodels/datasets/datautils.py
2,971
3.546875
4
import os import time import numpy as np from numpy import genfromtxt, array class Dataset(dict): def __init__(self, **kw): dict.__init__(self,kw) self.__dict__ = self # Some datasets have string variables. If you want a raw_data attribute you # must create this in the dataset's load function. ...
40da19c9b1653ddadd5e389799069fcd01a03b36
tukuanchung/hi
/for.py
107
4.15625
4
# for loop cars = ['Toyata', 'Honda'] for car in cars: print(car) car = 'Audi' for c in car: print(c)
5b4c903b86e0c95c93d680a749fcc03a714b4b52
tukuanchung/hi
/list.py
142
3.5625
4
# list 清單 a = ['Toyata', 'Honda'] print(a) print(a[0]) a.append('Audi') print(len(a)) print('Audi' in a) # True, False print('Benz' in a)
b3ff6b9fc89413be4d500f49307391428da18b75
SunnySunhwa/FDS
/OOP/inheritance/polymorphic_class.py
718
4.3125
4
#simple example of polymorphism from abc import * #추상 클래스 #인스턴스를 만들 수 없다. #인터페이스를 제공한다. class Animal(metaclass = ABCMeta): @abstractmethod def say(self): pass class Dog(Animal): def say(self): print('BOW-WOW') class Cat(Animal): def say(self): print('MEW MEW') class Duck(Anim...
2916b0fef96b722b01fcadf72a31a315e94528ca
chandrakanttiwari31/programs-_for_Tcs_campus
/primeno.py
153
3.734375
4
a=int(input("enter yu no")) for i in range(2,a+1): if(a%i==0): break if(a==i): print("your no in prime") else: print("sry")
c5df5dbe2dbaee07234b23990a6b581b3b3d4512
wk53/euler
/solved/prob6.py
336
3.734375
4
"""Project Euler - Problem 6. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. """ sum_of_squares = 0 for i in range(1, 101): sum_of_squares += i**2 SUM = 0 for j in range(1, 101): SUM += j square_of_sum = SUM**2 print(square_of_sum - ...
ad68c03331c1e7b348614d00b24eac29da1ec857
dicompathakofficial/TicTacToe
/script.py
6,970
3.765625
4
# ------------------------------------------------------- # Vertical and horizontal checks [DONE] # Diagonal checks from left and right side [DONE] # Actions when no condition is met [DONE] # User input feature [DONE] # Game over along with making the computer wanna win [DONE] # Improvement in the random function and ...
45f4bde110c97481dab0fbd4dc1fcc6bde114e45
apurva92/jetbrainsacademy
/Coffee Machine/coffee_machine.py
3,000
4.03125
4
class CoffeeMachine: def __init__(self, water, milk, beans, cups, money): self.water = water self.milk = milk self.beans = beans self.cups = cups self.money = money def current_state(self): print('The coffee machine has:') print(f'{self.water} of water') print(f'{self.milk} of milk') print(f'{self....
243996783263f1f96ceabe26d56ba60ac64ab404
CookieDoughTwist/Finance
/Utilities.py
790
4.09375
4
def consolidate_dict_array(dict_array,keys=None): """ Condense an array of dictionaries into a dictionary of arrays """ # Input keys allows the user to define which dictionary keys # to consolidate. Passing nothing will consolidate all keys. # This function assumes that every dictionary in array_dict ...
415798b95904eec2398146f3c93bdd2ce5f1e1d5
guymatz/rosalind
/hamm.py
278
3.6875
4
#!/usr/bin/env python import sys if len(sys.argv) == 2: file = open(sys.argv[1]) s1 = file.readline() s2 = file.readline() elif len(sys.argv) == 3: s1, s2 = sys.argv[1:] else: print("Problem!!") sys.exit(2) print sum([a != b for a, b in zip(s1, s2)])
bb16200dc6cd059bede94f3aeed58097709b29ec
joaoxbatista/processamento_imagem
/aula02.1.py
712
3.625
4
#coding: utf-8 ''' *** Objetivo: Gerar um histograma de uma imagem: sem bibliotecas *** Funções: PrettyPrinter(indent=4) = configura o pprint para exibir identação de 4 espaços set_printoptions(threshold=np.nan) = seta o threshold da exibição dos arrays ravel() = retorna os valores da imagem em array hist() = função d...
62b8a34cd169a00c520236db7a3c4eb68cab3b3c
lukk47/LeetCode
/Python/217-Contains-Duplicate.py
612
3.640625
4
#1 class Solution(object): def containsDuplicate(self, nums): """ :type nums: List[int] :rtype: bool """ if len(nums)<2: return False else: nums.sort() s = nums[0] for i in range (1,len(nums)): if nums[i]...
be9ee5140b79cb3ea121ed22c10023deaa7fcf18
lukk47/LeetCode
/Python/33-Search-in-Rotated-Sorted-Array.py
1,516
3.515625
4
class Solution(object): def search(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ start,end = 0,len(nums)-1 while end-start>=0: middle = (start+end)/2 print start,end,middle ...
afa9694fe4076efb281fa3637641d8b03b2ba21d
wdr1/cvsimport
/SaneDelicious/fpython.py
77
3.546875
4
#!/usr/bin/python for i in (range(5)): foo = "a" print "foo: %s" % foo
6a65f10c41e718fdcc2b027fd87b99fcbbf6acb0
lgl90pro/lab-8
/1.3.1) 4.py
1,131
3.515625
4
'''у матриці 4*4, що задана користувачем замініть всі від’ємні елементи на 0.''' import numpy as np # імпортуємо бібліотеку NumPy print('Введіть елементи матриці А:') a = np.zeros((4, 4), dtype=int) # задаємо масив A розмірністю 4 на 4, заповнений нулями, тиа даних - цілочисельний for i in range(4): for j ...
377078e33ed159a404be1faf4b1ab8c26d3d140d
simonmrog/machine-learning
/spark/sandbox/walmart_stock/script.py
2,691
4.09375
4
# %%Start a simple Spark Session from pyspark.sql import SparkSession spark = SparkSession.builder.appName ("spark").getOrCreate () # %%Load the Walmart Stock CSV File, have Spark infer the data types. df = spark.read.csv ("walmart_stock.csv", inferSchema=True, header=True) # %%What are the column names? df.columns ...
1d1d389d426edbf273770ff10a7f9d5cb6347cc1
MayarAlfares/AI-for-Medicine-Specialization
/AI for Treatment/AI4M_C3_M3_gradcam.py
8,216
3.65625
4
# coding: utf-8 # # Introduction To GradCAM (Part 1) - Lecture Notebook # In this lecture notebook we'll be looking at an introduction to Grad-CAM, a powerful technique for interpreting Convolutional Neural Networks. Grad-CAM stands for Gradient-weighted Class Activation Mapping. # # CNN's are very flexible models ...
6fcf21f993ef7b4bc516c4467ea7b56c9a4d7e42
Ayod3e/Ayodee_NumberGame
/Ayodee_Number Guessing.py
3,216
3.9375
4
print ('''******************************************************************************* Python Number Guessing Game AYO OMOLADE Slack username : Ayodee Email Address : omoladee11@gmail.com ********************************************...
4a01fecc27104360b1c76f840f1a58cfc895a9f6
Mridani-Dwivedi/lists
/list10_3.py
260
4.0625
4
#Write a function called middle that takes a list and returns a new list that contains all but the first and last elements. def middle(lis): lis1=[] lis1=lis1+lis[1:-1] return lis1 lis=[1, 3, 6, 10, 15, 21, 28, 36, 45, 55] print(middle(lis))
4ede76aa7df4432687f805c98e7b17645d7112bd
chbndrhnns/robotframework-vnfrobot
/vnfrobot/tools/matchers.py
1,133
3.640625
4
import operator def merge_two_dicts(x, y): """Given two dicts, merge them into a new dict as a shallow copy. source: https://stackoverflow.com/a/26853961/6112272 """ z = x.copy() z.update(y) return z # For contains not, there is no direct operator available. We rely on the implicit knowledg...
7972b222600e6890757f72d297b307de573f9132
mgperson/cauchy
/CONTEST/PROBLEM3/src/tests/TestPROBLEM3.py
1,535
3.609375
4
import unittest from ..PROBLEM3 import Problem3 class TestPROBLEM3(unittest.TestCase): def setUp(self): with open('src/1') as input_data: self.solver = Problem3(input_data.readline().strip()) def test_is_subsequence(self): self.assertTrue(self.solver.is_subsequence('abcdef', 'ace'...
9a70fa010eed02f8c63bf46fe628397dd9d4bfab
MicheasRosenkreuz/PJP2016
/cv01/triangle.py
312
3.90625
4
# -*- coding: utf8 -*- import math def triangle(a, b, c): """ Funkce vraci True nebo False, podle toho zda strany a, b, c mohou tvorit pravouhly trojuhelnik """ a, b, c = sorted([a, b, c]) return c == math.sqrt(a ** 2 + b ** 2) if __name__ == '__main__': assert triangle(3, 4, 5)
e4f18ad57968125db2d9e8263cdae241dbd0f0f0
wgrus/GDI_Intro_to_Python_class4
/months.py
252
3.984375
4
def get_age(): age = int(input('How old are you?\n')) return age def find_months(): age = get_age() months = (age + 1) * 12 return months print('At your next birthday, you will have been alive for', find_months(), 'months.\n')
c6bc88f2c641e48c3d77c4f7b9cdf206fcf40560
lokesh182002/vowel-check
/vowel check.py
253
4.1875
4
def vowelcheck(): word=input("enter a word:") vowels="aeiouAEIOU" flag=0 for ch in word: if ch in vowels: print(ch) flag=1 if flag==0: print("no vowels in given word")
0265784a56e0c067e137c108229892901899dd86
BPrasad123/EPAi_Phase-I_Advanced_Python
/S3/session3.py
3,450
4.3125
4
from fractions import Fraction def encoded_from_base10(number, base, digit_map): ''' This function returns a string encoding in the "base" for the the "number" using the "digit_map" Conditions that this function must satisfy: - 2 <= base <= 36 else raise ValueError - invalid base ValueError ...
3c1072bc9770cc0157056b24cbcdce91340f0a81
muhammadidrees/classwork
/AI/lab_4/lab4-tasks_78.py
3,015
4.09375
4
#Task 1 """ Find the traversal path for the given graph """ graph = { 'A' : ['B', 'E', 'C'], 'B' : ['D', 'E'], 'C' : [], 'D' : [], 'E' : [] } def dfs(graph, node, visited): if node not in visited: visited.append(node) for n in graph[node]: ...
0f6f58f5ab8bf123bc458f170e6b111c68890594
bernzzz/udemy-scripts
/Basics/fileread.py
332
3.546875
4
#!/usr/bin/python3 files = open("test.txt",'r') content =files.readlines() cleanlist=[] for i in content : cleanlist.append(i.rstrip()) files.close() for items in cleanlist : print (items) # the same can be achieved by creating a clean list on the fly using list comprehension content=[i.rstrip() for i in cont...
ec4073e63b8233a454a4f32c52b5952e78c4497e
lukebor/hackerrank_python
/Insert a node at the head of a linked list/Insert a node at the head of a linked list.py
370
3.59375
4
# Complete the insertNodeAtHead function below. # # For your reference: # # SinglyLinkedListNode: # int data # SinglyLinkedListNode next # # def insertNodeAtHead(llist, data): new_node=SinglyLinkedListNode(data) if llist==None: llist = new_node else: new_node.next,llist = llist, n...
723e5d7e8fd47590768cc782fcf47ac0d1ae0eef
lukebor/hackerrank_python
/Climbing the Leaderboard/Climbing the Leaderboard.py
755
3.703125
4
#!/bin/python3 import math import os import random import re import sys # Complete the climbingLeaderboard function below. def climbingLeaderboard(scores, alice): scores_wodup=sorted(set(scores),reverse=True) rank=[] l=len(scores_wodup) for i in alice: while l>0 and i>=scores_wodup[l-1]: ...
132e6187ca27b3fddb4f9da829b49ccb3b2eb0b9
lukebor/hackerrank_python
/Happy Ladybugs/Happy Ladybugs.py
926
3.546875
4
#!/bin/python3 import math import os import random import re import sys # Complete the happyLadybugs function below. def happyLadybugs(b): bugs=set(b) if '_' in bugs: for i in bugs: if b.count(i)>1 or i=='_': pass else: return 'NO' return 'YES' else:...
acdc01cd591b7c8b942cb0d95c33d505eff6a36d
william-liu-is-me/my-learning-path
/第 0001 题: 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成.py
1,060
4
4
''' 第 0001 题: 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券), 使用 Python 如何生成 200 个激活码(或者优惠券)? ''' from random import randint class N位激活码生成器(): def __init__(self,想要多少个激活码啊 = 50,多少位 = 4): self.size = 想要多少个激活码啊 self.length = 多少位 def __iter__(self): for i in range(self.si...
448bcdaf152577adc79805a738368040ebd26c41
william-liu-is-me/my-learning-path
/Fluent Python读后感.py
1,629
3.703125
4
Fluent Python Reading Summary 从2020年8月27日到9月22日,完成了fluent python的第一次阅读。 说是完成,其实有一部分内容是完全跳过的。 跳过的内容有:第四章:Text versus Bytes 第十二章:inheritance 第十三章:Operator overloading 以及第18,19,20,21章节。 之所以跳过这些章节,主要原因是自己能力有限水平不够,确实看不懂作者想表达的内容。尤其在最后4个章节,连doctest都不再是我能读懂的范畴。之前的几个章节,跳过的原因是不太会涉及或用到这些知识:1.继承:我目前很少自定义class,所以更不要说继承自己定义的类...
6da3a76066dadb2a4cd373ff492e9c8c21d5f316
william-liu-is-me/my-learning-path
/Leetcode 246 Strobogrammatic Number I and II.py
4,074
3.546875
4
# 246 Leetcode Strobogrammatic Number I, II class Strobogrammatic_num(): def __init__(self,num): self.num = num @property def SN_method(self): if self.num == 1: return 1 elif self.num == 6: return 9 elif self.num == 8: return 8...
e43fc3b654952f4392d01b7e1b15dc99700c5835
william-liu-is-me/my-learning-path
/#Best Time to Buy and Sell Stock.py
1,382
4.28125
4
#Best Time to Buy and Sell Stock ''' Input: [7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. Not 7-1 = 6, as selling price needs to be larger than buying price. Input: [7,6,4,3,1] Output: 0 Explanation: In this case, no transaction is ...
9910c06cc61c7da752dcb01154d6e9cef2f19a61
micky2007/python
/math.py
1,290
3.921875
4
def add(x, y): return x + y def subtract(x,y): return x - y def multiply(x,y): return x * y def divide(x,y): return x/y def average(x, y): sum = add(x,y) return sum/2 def max(x,y): if x > y: return x if y > x: return y def min(x,y): if x < y: return x ...
55f1cd630c7ec7311ab7bdd30af28b2790032f4b
akshitone/Python-Tutorial
/HackerRank/PhoneNo.py
928
3.828125
4
# Enter your code here. Read input from STDIN. Print output to STDOUT ''' lst = list() n = int(input()) for _ in range(n): line = input().split() name, number = line[0], line[1] lst.append([name, number]) output = list() for i in range(n): line = input() name = lst[i][0] if line == name: ...
27ff50a3a8b919ab24f5e2c36110a7b5dac34765
akshitone/Python-Tutorial
/Fundamentals/02-Dictionary-Variable.py
455
3.703125
4
# DICTIONARY - key and value data = { 'rollno': 'MCA-235', 'fname': 'Akshit', 'lname': 'Mithaiwala' } print(data) print(data['lname']) key = ['rollno', 'firstname', 'lastname'] value = ['MCA-235', 'Akshit', 'Mithaiwala'] data = dict(zip(key, value)) # print(list(data)) # print(tuple(data)) # print(set(data...
cd39943489ba527b1a28cbf5946eaee4c7987a9b
akshitone/Python-Tutorial
/Fundamentals/08-Function.py
928
3.796875
4
# FUNCTIONS ''' def whoAreYou(): print("Hello, I'm Akshit Mithaiwala") for i in range(5): whoAreYou() ''' def add_sub(x, y): add = x + y sub = x - y return add, sub addition, subtraction = add_sub(50, 20) print(addition) print(subtraction) # UNDEFINE ARGUMENTS def add(*b): sum = 0 f...
03b776cda6816217c5e09b84d7c05824e5041b3d
akshitone/Python-Tutorial
/HackerRank/SwapCaseAndReverseString.py
205
3.734375
4
stnr = "aWESOME is cODING" swap = stnr.swapcase().split(' ') rev = list(reversed(swap)) st = " ".join(rev) print(st) # DISPLAY VARIABLE WITH STRING # print(f"Hello {a} {b}! You just delved into python.")
dc228bfae4b94c20d5741e3306567ccba2ea2ffb
ranejeb/LACIT_Data_science
/Практика 6.04/11.py
203
3.59375
4
dictionary = {29:"двадцать девять", 3:"три", 7:"семь", 1:"один"} list_keys = list(dictionary.keys()) list_keys.sort() print(sorted(list_keys)) for i in list_keys: print(i, ':', dictionary[i])
a1b94f26c5e9df8e6f59e91421aef605ae996baf
ranejeb/LACIT_Data_science
/Практика 15.04/Sfera-1.py
1,043
3.921875
4
import math class Spher (object) : def __init__(self, r = None, x = None, y = None, z = None): if r == None: self.r = 1; self.x = 0; self.y = 0; self.z = 0 elif x == None: self.r = r; self.x = 0; self.y = 0; self.z = 0 else: self.r = r; self.x = x; self.y...
612ba78f8b91b9674f85785a85ab5669355693f8
ranejeb/LACIT_Data_science
/Практика 13.04/4.py
673
3.671875
4
def romb(num): for i in range(1, num+1): string = "" for j in range(1, num-i+1): string += " " for k in range(1, i): string += str(k) + " " string += str(i) + " " for l in reversed(range(1, i)): string += str(l) + " " print(string...
5ab4ba70d05288dd0bab0ffa1aece42c7c1c3e6c
ranejeb/LACIT_Data_science
/Практика 13.04/9.py
130
3.515625
4
def fn(string): for i in range(0,len(string)): print(string[i],'-',ord(string[i])) fn(str(input("введите , ")))
10fd3e99e2120acc0e930375164a97ac7e9bda42
Hatlelol/ITGK
/Øving 2/Andregradslikning.py
518
3.6875
4
import math print("En andregregradslikning på formen ax^2 + bx + c skriv inn for:") a = int(input("a")) b = int(input("b")) c = int(input("c")) d = ((b**2) - 4*a*c) def los(): x_1 = (-b+math.sqrt(d))/(2*a) x_2 = (-b-math.sqrt(d))/(2*a) if x_1 == x_2: print(x_1) else: prin...
d51ebcb7a69382ec60b69b03185e70d3b468d822
abinabraham/py_codez_2017
/hungry.py
646
3.859375
4
print "I am hungry !!" def arg_dec(operation): def wrapper(*args, **kwargs): for arg in args: if not isinstance(arg, int): raise ValueError('The arguments are not integers') break return operation(*args, **kwargs) return wrapper class Sum(object):...
6dd078c2665651b32967baf3d758ab29d95e9e5c
rsthakur83/cloud
/python program/list-repeated-element-count.py
147
3.96875
4
MyList = ["a", "b", "a", "c", "c", "a", "c"] my_dict = {i:MyList.count(i) for i in MyList} print my_dict #or print(my_dict) in python-3.x
450fdff2c999361ca1df32ab608fd8b158d4f5b2
gangasani228/madan
/word_split_w_o_split.py
150
3.578125
4
str_input=" madhan mohan " str_new_input="" for i in str_input: if i !=" ": str_new_input=str_new_input+i print(str_new_input)
ca829eb14b239e1209c6f84a3e7722a5c099e382
Longnguyen2006/Github-
/ceasar.py
695
4
4
def caesar_cipher(message, mode, key): LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' message = message.upper() translated = '' for symbol in message: if symbol in LETTERS: num = LETTERS.find(symbol) if mode.upper() == 'ENCRYPT': num = (num + k...
ec4294871aa0a6f7ee7ee43371a67eab508cea0c
mariacamila0712/Taller_secuenciales_python
/Ejercicio2.py
279
3.78125
4
# -*- coding: utf-8 -*- """ Created on Fri Sep 3 16:23:52 2021 @author: Maria Camila """ # z=5; n=3; m= z-n; y = (((z+2-n)^2 * m+8/2 -30 ) / 2 * 5 -3)^ 5 + 15 * 3 - 9/3 z = 5 n = 3 m = z - n y = (((z+2-n)**2*m+8/2-30)/2*5-3)**5+15*3-9/3 print(f'El resultado de y es igual a: {y}')
f2c5bfd590bf0ccc579c7f2b02bdee6b2db84819
Alex2020-maker/PythonBasics
/lesson1/third_task.py
370
4.0625
4
number = int(input('Enter a number up to 20: ')) if 10 < number < 20: print(number, "процентов") # If the last digit is 1 (процент) elif number % 10 == 1: print(number, "процент") # If the last digit is 2, 3 or 4 (процента) elif number % 10 == 2 or number % 10 == 3 or number % 10 == 4: print(number, "п...
8764abcc1e27a2f749d67064e9afe1964123e6e6
zgardner426/notes
/List notes.py
4,202
4.125
4
# Lists my_list = ["Abe", "Bev", "Cam", "Dan", "Eve", "Flo", "Gus"] my_numlist = [8, 4, 7, 5, 2, 9] print(my_list) print(my_list[0]) # single index print(my_list[0:2]) # multiple items, including the first one, not including the last one # negative indices work but count from the end of the list # copy of a list # j...
71bdd5a8f4330f24e9a18084f725cabba6f3fab2
adkline/CPEG672
/Module 2 Scripts/Mod2Les1Part2_2.py
353
3.921875
4
import math sub_group = [] for x in range(0,100): sub_group_element = 3*x % 10 print ' sub group is ', sub_group_element print x if sub_group_element in sub_group: break if sub_group_element not in sub_group: sub_group.append(sub_group_element) ...
51ecc06b300c3a55b6aee9072cc19345047522d5
jeffrey-hong/interview-prep
/LeetCode/wordSearchOne.py
954
3.78125
4
class Solution: def exist(self, board, word): """ :type board: List[List[str]] :type word: str :rtype: bool """ for x in range(len(board)): for y in range(len(board[0])): if self.dfs(board, x, y, word): return True ...
4c70ea12ef5a6ae450990795104e79fd829375f4
ZymHedy/code_practice
/leetcode/1.py
932
3.5625
4
# 输出单科最高成绩,以及需要表彰人数 while 1: nm = input() if nm != '': n, m = map(int, nm.split()) student_score = dict() for i in range(n): student_score[i] = [] for s in input().split(): student_score[i].append(int(s)) # print('n:{},m:{}'.format(n,m)) ...
20ce2af4f68fc416aeadb03df5ef3a48acdf7967
ZymHedy/code_practice
/offer/09jumpfloor2.py
261
3.515625
4
# -*- coding:UTF-8 -*- class Solution: def jumpFloorII(self, number): # write code here f = [0,1,2] for i in range(3,number+1): f.append(2*f[i-1]) return f[number] s = Solution() ans = s.jumpFloorII(4) print(ans)
569ac823060a053e9617b1e0fde32ebe6f13dae7
GVSRohita/kdmicp4
/icp4_RDD.py
878
3.734375
4
import pyspark from pyspark.sql import SQLContext from pyspark import SparkFiles sc = pyspark.SparkContext() sqlContext = SQLContext(sc) df = sqlContext.read.csv(SparkFiles.get("C:/Users/gvsrohita/PycharmProjects/ICP-4/data.csv"), header=True, inferSchema= True) df.printSchema() df.show(5, truncate = False) #If you...
8372abc9e3774be313b3dd89960440f9425ca446
PMicevski/Q-and-A-Analysis
/web_scraping.py
823
3.671875
4
# -*- coding: utf-8 -*- """ Url's are saved in txt file Each url consits of a date, Date is exctracted and used as part of new file name for extracted data """ from requests import get import re url = open('qanda_transscript_https_addr.txt', 'r') for line in url: # extracting date form url to...
b36650fb63f6f7906debbff1fcbeea9293d8d398
tomchequer/Snake_Game.py
/build/exe.win-amd64-3.9/score.py
688
3.578125
4
from turtle import Turtle from food import Food from snake import Snake class Score(Turtle): def __init__(self): super().__init__() self.score = 0 self.color('white') self.penup() self.goto(0, 250) self.hideturtle() self.update() def update(self): ...
506eabe7ea59ef282b64aa89481dfa3003ddb2ca
Noczio/ConsoleWelcomeMessage
/resources/funcs/is_data.py
434
4.09375
4
def is_in_range(value: int, low: int, high: int) -> bool: """Function that Returns True if a integer value is inside a domain""" if low <= value <= high: return True return False def is_int(value: str) -> bool: """Function that returns True if parameter can be parsed into a integer""" is_v...
08e1b2133539c8898fb5ae4a01d6150f2ee92718
FengliangChen/duty-list
/duty-list.py
1,386
3.875
4
#!/usr/bin/env python3 import calendar import copy morning = 3 noon = 6 night = 9 k = calendar.monthrange(2018,8) def get_whenday(day): return calendar.weekday(2018,8,day) # generate a list of days, with sub-list represents the 3 duty status. duty = [0, 0, 0] month_list =[] month_days = int(k[1]) a=0 while a < mo...
f4b43c82b8981996c1012253489043e09d6f2242
Elyneker/Python
/desafios/Numero Triangular.py
385
4.15625
4
##################################### # Descobrir se um numero e triangular ##################################### num = input("Digite um numero diferente de 0: ") while num == 0: num = input("Digite um numero diferente de 0: ") a = 1 x = 0 while x < num: x = a*(a+1)*(a+2) if x == num: print "Seu numero e triangul...
d629eafc5be79a4079edcf4a08d97baeaa9f59af
Elyneker/Python
/desafios/arvore-binaria.py
1,670
3.796875
4
qtdNos = input("Qual o tamanho da arvore?(ex: 63): ") linhas = [] espc_entre_num_base = 2 qtd_carac_num = 2 def Is_new_line(x): x = float(x) while x >= 1: if x/2 == 1 or x/2 == 0.5: return True x = x/2 return False def monta_nos(nos): pos = 0 for x in range(1, nos + 1): if Is_new_line(x): linhas.app...
b4e29f573dfee3b92885d093647f509aa9a9e374
trentonturner63/agenda
/main.py
3,553
4.09375
4
# Pickle module allows you to save data after program closes import pickle from typing import List week = {"Sunday": [], "Monday": [], "Tuesday": [], "Wednesday": [], "Thursday": [], "Friday": [], "Saturday": []} class Agenda(object): def __init__(self): self.week = week def main(self): ...
2de4e8b0782a2e30b3bd120ea1ecbbfc853ad011
magalyg/P4
/stub.py
4,455
3.734375
4
# Imports. import numpy as np import numpy.random as npr import pygame as pg from SwingyMonkey import SwingyMonkey class Learner(object): ''' This agent jumps randomly. ''' def __init__(self): self.last_state = None self.last_action = None self.last_reward = None sel...
7da2616ee0cc9df6ac03a4520cdaba51e3a172f6
petushoque/spa-django-rest-nuxtjs
/section3lesson5step4.py
380
4.03125
4
#Дана строка s состоящая из нескольких слов, разделенных пробелами, верните длину последнего слова в строке. Если последнее слово не существует, верните 0. s = input() if len(s) > 0: s_list = s.split(' ') print(len(s_list[-1])) else: print(0)
a313d3705e5415424ae81792cca9fe122210d45d
petushoque/spa-django-rest-nuxtjs
/section3lesson7step4.py
895
4
4
#Дан массив целых чисел, который уже отсортирован в порядке возрастания, найдите два числа, которые складываются в целевое целевое число. #Верните индексы двух чисел таким образом (индекс начинается не с 0 как обычно, а с 1), чтобы числа под этими индексами суммировались в целевое значение. Причем индекс 1 должен быть ...
ce63c5ad89c7e20bdbea471a359158960d66ae2a
petushoque/spa-django-rest-nuxtjs
/section2lesson1step3.py
1,053
4.03125
4
# решение с изобретением велосипеда # тестовые значения: flower,flow,flight s = input().split(',') # найти самый короткий элемент min_elem = s[0] min_len = 100 for i in range(len(s)): if len(s[i]) < min_len: min_len = len(s[i]) min_elem = s[i] # удалить из исходного списка самый короткий элемент,...
844f2c87a1f5bc81eb5a4c4d75af93207438a9ed
felipepratesc/datasciencedegree
/tp2_knn_class/class_knn.py
2,593
3.78125
4
class Knn: #método construtor e definição de k def __init__(self): self.k = int(input("Insira valor para k do modelo: ")) def calcular_distancia(self, ponto, data): """ Calculando as distâncias a partir de cada ponto no_class """ self.ponto = ponto s...
d37182f913996e6fa5f50a2e1f4376ed00b6bd8e
khk37601/ExpertAcademy
/SWEA/백준_알파벳위치.py
481
3.6875
4
input_string = input() dic_list = {} #-1로 초기화 alphabet = [-1 for i in range(26)] # string = "" # 알파벳 인덱스 for i, j in enumerate(input_string): # 덮혀 쓰기 방지. if j in dic_list.keys(): continue dic_list[j] = i # 알파벳위치한 인덱스 for i, j in dic_list.items(): # 문장을 int형으로 변환. alphab...
2b4fdcdfca181ca3b6f7dfc42eb180f14e8a85b9
khk37601/ExpertAcademy
/SWEA/백준_파도반수열.py
187
3.671875
4
n = int(input()) for i in range(n): s = int(input()) _list = [1, 1, 1] for j in range(2,s): _list.append(_list[j-2]+_list[j-1]) print(_list[s-1])
56a8ed0f14ca8c62b2b8ba0820bb80099b8aa0f6
khk37601/ExpertAcademy
/SWEA/백준_문자열_단어.py
116
3.71875
4
input_string = input() number = 0 for i in input_string.strip().split(): number += 1 print(number)
3e5cb58038c5a337b9203f6f2c789d981ec8551d
khk37601/ExpertAcademy
/이분탐색/백준_수 찾기.py
539
3.828125
4
def BinarySearch(arr, val, low, high): if low > high: return False mid = (low + high) // 2 if arr[mid] > val: return BinarySearch(arr, val, low, mid - 1) elif arr[mid] < val: return BinarySearch(arr, val, mid + 1, high) else: return True N = int(input(...
6eb139cffa5dafd5c7c704400dbeb1011cdd5366
khk37601/ExpertAcademy
/SWEA/오픈채팅방.py
709
3.640625
4
def solution(record): answer = [] ID = {} for loop in record: if loop.split()[0].strip() == "Enter" or loop.split()[0].strip() == "Change": ID[loop.split()[1].strip()] = loop.split()[2].strip() for loop in record: if loop.split()[0].strip() == "Enter": ...
d06e0979f2e1a9780be05da443ba8a3e90d39f9e
amberrevans/pythonclass
/chapter 4 and 5 programs/ex_4.6.py
294
3.921875
4
#amber evans #9/23/2020 #ex 4-6 #this program produces a table of celcius values from 0 to 20 #and the corresponding fahrenheit value print () print ('Celcius Fahrenheit') print('---------------------') for tempc in range (0,21): tempf=tempc*1.8+32 print (tempc, '\t ',f' {tempf: .2f}')
3a3ad4bae573f4dfe6c9bfbe06a44d226c34c27c
amberrevans/pythonclass
/chapter 4 and 5 programs/speed_converter.py
481
4.1875
4
#amber evans #9/19/20 #program 4-9 #This program converts the speeds 60kph #through 130kph (in 10kph increments) #to mph. Start_speed= 60 #starting speed End_speed= 131 #ending speed Increment= 10 #speed increment Conversion_factor= 0.6214 #conversion factor #print the table headings. print ('KPH\tMP...
1a5eb7451c416e6e5412e733c8ed780fa8584f88
amberrevans/pythonclass
/chapter 4 and 5 programs/ex_5-16.py
418
4.0625
4
#Amber Evans #9-30-2020 #ex 5-16 #This program generates a random number, determins if it's odd or even, #then computes the total number of odd and even numbers. import random def main(): numodd=0 numeven=0 for index in range(1,101): num=random.randint(1,1000) if num % 2==0: n...
6ae3d96a0766e8653550fc871b48d5cac3d02c6f
amberrevans/pythonclass
/chapter 6/modify_coffee_rec.py
1,898
4.375
4
#Amber Evans #10-8-2020 #program 6-18 #this program allows the user to modify the quantity in a record #in the coffee.txt file import os #Needed for the remove and rename functions def main(): #create a bool variable to use as a flag found=False #Get the search value and the new quantity search=input...
d2056a5ec2db601cc1c7e76f884c4171e9023ae8
amberrevans/pythonclass
/chapter 3 programs/test_score_average.py
712
4.3125
4
#amber evans #9/9/2020 #this program gets three test scores and displays #their average. It congratulates the user if the #average is a high score. #the High_score named constant holds the value that is #considered a high score. High_score= 95 #get the three test scores test1 = int(input('Enter the score for test 1: ...
499ed6cadd9cc5da24bcb89d220fe5cdde80efe4
amberrevans/pythonclass
/chapter 6/display_file.py
437
3.921875
4
#Amber Evans #10-11-2020 #program 6-24 #This program displays the contents of a file def main(): #Get the name of a file filename = input('Enter a filename: ') #Opent the file infile = open(filename,'r') #Read the files contents contents = infile.read() #Display the files contents pr...
fb2cfd384b4ad525a07b33544de97bc4d60a9652
amberrevans/pythonclass
/ch7/insert_list.py
466
4.53125
5
#Amber Evans #10/29/2020 #program 7-5 #This program demonstrates the insert method def main(): #Create a list with some names names= ['James', 'Kathryn' , 'Bill'] #Display the list print ('The list before the insert: ') print (names) #insert a new name at element 0 names.insert(0, 'Joe') ...
e323eb1f1530fa7100d54d3ca445a54de700f4b5
amberrevans/pythonclass
/ch7/rainfall_7-3.py
668
4.25
4
#Amber Evans #11-2-2020 #program exercise 7-3 #This program records monthly rain amounts and #calculates the average, the minimun and maximum #and total annual rainfall #Import random number generator import random #Define the main function def main(): #Creat constants rows, cols = (1,1) #Define list...
078895894d164ce1b50fc621968a17161ddeb88b
amberrevans/pythonclass
/chapter 1 and 2 programs/future_value.py
564
4.375
4
#amber Evans #9/6/20 #program 2-18 #this program calculates future value #Get the desired future value future_value=float(input('enter the desired future value: ')) #get the annual interest rate rate= float(input('enter the annual interest rate: ')) #get the number of years that the money will appreciate years=int(i...
9fd119bbd5d5fbb31d1af8a6e037b10d1c94c366
amberrevans/pythonclass
/chapter 6/rnums_2.py
1,816
4.46875
4
#10-13-2020 #program exercise chapter 6 #This program generates a certain amount of random numbers #displays them, adds them, and then averages them #import the random number generator import random #define the main function def main (): #open a file for writing the random numbers random_numbers = open ('ra...
c3428981916f8e602d65833e65ffe7a3631ec902
amberrevans/pythonclass
/chapter 6/file_read.py
443
3.859375
4
#Amber Evans #10-7-2020 #program 6-2 #This program reads and displays the contents #of the phliosophers.txt file. def main(): #open a file named file_write.txt infile = open('philosophers.txt','r') #read the files contents file_contents=infile.read() #close the file infile.close() #print...