blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
a8f58bbaccee37ba773ffa4d414c92748d052fd5
yiswang/LeetCode
/two-sum-ii-input-array-is-sorted/two-sum-ii-input-array-is-sorted.py
2,072
3.859375
4
#!/usr/bin/python # -*- coding: utf-8 -*- ############################################################################### # # Author: Yishan Wang <wangys8807@gmail.com> # File: two-sum-ii-input-array-is-sorted.py # Create Date: 2017-02-09 # Usage: two-sum-ii-input-array-is-sorted.py # Description: # ...
3490ac65deeef61c66b7f060469ade6e59f1a6f3
eryilmazysf/assignments-
/specialmethods.py
518
3.75
4
class book(): def __init__(self,name,author,totalpages,kind): self.name=name self.author=author self.totalpages=totalpages self.book_kind=kind def __str__(self): return "name:{} \nauthor:{} \ntotal_pages:{} \nkind:{}".format(self.name,self.author,self.totalpages,se...
eb8a3bd50ee2c2ea86afc3fcd6c8a467dc8f263f
amenson1983/2-week
/_2_week/Homework_2_week/Algoritmic_tranee_6.py
600
3.8125
4
znamen_ = int(input("Введите конечное число ряда знаменателя (целое):")) nach_chisl = int(input("Введите начальное число ряда числителя (целое):")) kon_chisl = int(input("Введите конечное число ряда числителя (целое):")) shag_chisl = int(input("Введите шаг ряда числителя (целое):")) sum_ = 0 if znamen_ > 0: for x i...
433dfa693d511e7b6b2ca63d1a7e88ea605dec37
jingong171/jingong-homework
/孙林轩/2017310392 孙林轩 py第二次作业/字典.py
395
3.890625
4
cities={ "Beijing":{"Country":"China","Populations":2.173e7,"fact":"Used to be called Beiping"}, "Baotou":{"Country":"China","Populations":2.8777e6,"fact":"Used to be called City of deer"}, "Shanghai": {"Country": "China", "Populations": 2.42e7, "fact": "There is a Disneyland"}, } for keys in cities: pr...
47bf2372e97f97b20d309b3f70c19af904239171
JordSter5/511
/ok.py
212
3.515625
4
response = input('Enter File: ') fhand = open(response) count = 0 for line in fhand: words = line.split() if len(words) == 0 or len(words[0:-1]) == 0 or words[0] != 'From' : continue print(words[2])
ee95bbcb558c41484cbce1a36c08dc43c8c2c7c3
kooshanfilm/Python
/Exercise/max_end3.py
332
4.34375
4
# Given an array of ints length 3, figure out which is larger, # the first or last element in the array, and set all the other elements to be that value. # Return the changed array. # def max_end3(nums): if nums[0] > nums[-1]: return [nums[0]] * 3 else: return [nums[-1]] * 3 print (max_end3...
f77318b267a53148e75bf32c0d564a25c250db34
Zerl1990/python_essentials
/examples/module_1/06_inputs.py
211
4.40625
4
# Input will show a message in the console, and return what the used types # The return value can be store in a variable age = input("What is your age?") # Print the user input print("Your age is: " + age)
29c98c2f10ed618339920526dbbda23535227cb0
ReDI-School/redi-python-intro
/theory/Lesson5-Files/code/file_read_whole.py
152
3.515625
4
# Lesson5: reading all the file at once # source: code/file_read_whole.py f = open('file_for_reading.txt', 'r') text = f.read() print(text) f.close()
05fbd4a0c69570ee04cbec163a0cce43750ec648
Ryc1x/advent-of-code-2018
/day2-inventory-management-system/puzzle1.py
715
3.53125
4
def puzzle1(): f = open('input.txt', 'r') inputs = f.read().strip().split() f.close() totalrep2 = 0 totalrep3 = 0 for s in inputs: # print(s) length = len(s) rep2 = False rep3 = False for c in s: repeats = 0 for i in range(0, length...
65550b4414d2335c67158a764224fb65aebf1afa
LENAYL/pysublime
/intersection_349.py
1,602
3.59375
4
class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ # method 2 if len(nums1) == 0 or len(nums2) == 0: return [] nums1.sort() nums2.sort() l1 ...
280be323a4400ee4df4816cc531808c8c18e6d8d
victorandradee2/Matematica-com-python
/equacao-do-2-grau.py
1,110
3.703125
4
import math equa = (' ============================== EQUAÇÃO DO 2 GRAU ==============================') cores = {'limpa':'\033[m', 'amarelo':'\033[33m'} print('{}{}{}'.format(cores['amarelo'], equa, cores['limpa'])) # OBS : O VALOR DE X É EQUIVALENTE A 1 # EXEMPLO: x² - 5x + 6 = 0 (1² - 5x + 6 = 0) = A B C # t1 = ...
8e5fbf24a8512be68a53839e51cd5fd2c4965cfc
dvdbng/tuenticontest
/c12.py
855
3.546875
4
#!/bin/env python digits = { '0':(1,3,4,5,6,7), '1':(6,7), '2':(1,2,3,5,6), '3':(1,2,3,6,7), '4':(2,4,6,7), '5':(1,2,3,4,7), '6':(1,2,3,4,5,7), '7':(1,6,7), '8':(1,2,3,4,5,6,7), '9':(1,2,3,4,5,7), } def leds(fromtime,totime): diff = [(fromtime[x],totime[x]) for x in range(...
eee963a7b994ed1c0cf0d818ac31140a8fbe2873
Ayushi2811/SDP
/Ayushi/list.py
1,056
4.1875
4
#first list l={'python','c','java'} print(l) #neat list l={'python','c','java'} for i in l: print("A nice programing language is",i) #message list l={'Pink','Blue','Black','White'} for i in l: print("Item in the list is",i) #for loop l={'python','c','java'} for i in l: print(i) ...
f6bdfa8402adda0cb8fe3b01fa9aa6c73f94b3b0
Hsko-Godol/Study
/python/first_book/ch12/practice12-1.py
806
3.53125
4
dc = {'새우깡': 700, '콘치즈': 850, '꼬깔콘': 750} def problem_1(): print("### The result of problem 1 ###") print("Before", dc, sep='\n') dc['홈런볼'] = 900 print('After', dc, sep='\n') def problem_2(): print("### The result of problem 2 ###") print('Before', dc, sep='\n') for i in dc: ...
4222badd8fce763ed03b2499ebf8241511d988cd
rohitaswchoudhary/py_projects
/P2/gui_clock.py
411
3.59375
4
from tkinter import * from tkinter.ttk import * from time import strftime dk = Tk() dk.title("Clock") dk.minsize(width=610,height=110) dk.maxsize(width=600,height=100) label = Label(dk, font=("ds-digital",80),background="black",foreground='purple') label.pack(anchor='center') def time(): string = strftime("%H:%...
950617f695b2a814b050aeef1900e38d2793d2d2
riodementa/Python_Michigan-University
/6_1.py
174
3.734375
4
# Exercise 6.1 import numpy as np cadena = raw_input("Introduce una cadena: ") my_length = len(cadena) while my_length>0: my_length -= 1 print cadena[my_length]
d686cb4cb1d28277713ffd6376edd2c7e7ff4bbc
Pasquale-Silv/Improving_Python
/Hacker Rank Python/QuartilesDiff.py
1,735
3.546875
4
""" n = int(input()) array = list(map(int, input().strip().split())) freq = list(map(int, input().strip().split())) """ array = [6, 12, 8, 10, 20, 16] freq = [5, 4, 3, 2, 1, 5] import statistics as st completeList = [] for i in range(len(array)): for j in range(freq[i]): completeList.append(array[i]) prin...
7a514c80a9b3533b1f315166cda74789766330b0
scalation/data
/code/rolling_window.py
3,668
3.859375
4
import pandas as pd """ rolling_window: A module for displaying daily and weekly predictions from a dataframe on a rolling window basis Functions ---------- daily_rolling_window: def daily_rolling_window(model:str, df: pd.DataFrame, h: int = 14, date:str='date'): weekly_rolling_window: def weekly_r...
31248d27c5afda5b6bde79bf212aba6acd9decb6
ArthurBrito1/MY-SCRIPTS-PYTHON
/Desafios/desafio13.py
240
3.671875
4
temperatura = int(input('informe a temperatura em graus celcius:')) converssão = (temperatura*9/5)+32 print('A temperatura em graus celcius é de {}C \nApós de ser convertida para fharenheit fica {}F'.format(temperatura, converssão))
309928b0e1c9e2c5e85e43b4dec27e6f62c03ac4
stay5sec/bibi_code
/other/Record/多线程/5.0 进程间通信.py
2,934
3.609375
4
# coding:utf-8 # author:Super # 多进程编程中不能再使用线程中的queue '''from queue import Queue''' import time from multiprocessing import Process, Queue, Pool '''参数共享的方式''' # def pro(queue): # queue.put("a") # time.sleep(2) # # # def con(queue): # time.sleep(2) # data = queue.get() # print(dat...
c502687062ab89754f1d89a4549890305168497c
Gowtham-M1729/HackerearthPrograms
/python/basics.py
91
3.515625
4
lett="" lst=list() for i in range(7): lst.append('b') print(lst) print(lett.join(lst))
6824853ea85146f8b7fd8e9c1fb1658fe8169b11
FouedDadi/holbertonschool-higher_level_programming
/0x0B-python-input_output/2-read_lines.py
374
3.984375
4
#!/usr/bin/python3 """ function that read defined lines """ def read_lines(filename="", nb_lines=0): """ handle conditions of reading lines """ number = 0 with open(filename, encoding="UTF8") as myfile: for line in myfile: number = number + 1 if nb_lines <= 0 or nb...
c4db7b0b83cd8439dd205f9cdc360958b42db899
MaxNollet/j2_blk4_eindopdracht_flask
/gaps/genelogic/genepanelreader.py
11,206
3.625
4
from dataclasses import dataclass, field from os import path from re import compile, Pattern from typing import List, Tuple, Dict @dataclass class GenepanelContent: """A class used for storing values. The stored values can be used to fill a database and the class can be used by readers/parsers to st...
422d307a46aa55e955671f973c1858d23aaac944
haya14busa/codeforces
/div2/312/a.py
1,309
3.65625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Lala Land has exactly n apple trees Tree number i is located in a position xi and has ai apples growing on it Obj: wants to collect apples from the apple trees Start: Amr currently stands in x = 0 position ''' def solve(n, xas): minus = sorted([xa for xa in xas i...
a6adfa4021acdb324bceb06b0b6f2846e9495417
jaydendrj/gnistudy
/从入门到实践/9类/Car.py
1,685
3.921875
4
class Car(): def __init__(self,make,model,year): self.make=make self.model=model self.year=year self.odometer_reading = 0 def get_descriptive_name(self): long_name=str(self.year)+" "+self.make+' '+self.model return long_name def read_odometer(self): ...
f60a3bce7ecd964db460e3286c4a9b1d1c67a722
Andxre/Daily-Code-Log
/LinkedList.py
1,228
3.90625
4
''' 1/17/2020 Simple Linked List implementation in python~ ''' class Node(): def __init__(self, val): self.val = val self.next = None class LinkedList: def __init__(self): self.head = None def add(self, data): node = Node(data) if (self.head == None):...
dbae721f4d15cc9909c350e15a0ca692877e26e9
ElSnoMan/auto-engineering-101
/chapters/ch4/vowel_count.py
213
3.78125
4
# 3. Refactored logic from test def count_vowels_in_string(string): vowels = 'aeiou' count = 0 for character in string.lower(): if character in vowels: count += 1 return count
2d9d1279bdea37be71b33c52eb84494c79adcf59
rec/test
/python/multi.py
230
3.515625
4
class Multi(object): ITEMS = (1, 3), (5, 8) def __getitem__(self, i): return self.ITEMS[i[0]][i[1]] def __setitem__(self, i, x): self.ITEMS[i[0]][i[1]] = x def __len__(self): return 2, 2
d7030a0c34426c8a48b88c51adfa66f63e210fbd
QuentinDevPython/McGyver2.0
/mcgyver/game.py
8,414
3.6875
4
""" Import the time Import the module 'pygame' for writing video games Import the other classes 'Maze' and 'Player' to manage the all game Import the file 'config' for the constants. """ import time import pygame from mcgyver.maze import Maze from mcgyver.player import Player import config class Game: """clas...
0af87e3cbf29ca61261f733f0ef85213b0fd577b
krishnabojha/Insight_workshop_Assignment3
/Question4.py
175
4.125
4
########## swape first two character of two string a,b=input("Enter two string separated by space : ").split() print("Output : '{}'" .format((b[:2]+a[2:])+' '+(a[:2]+b[2:])))
cd5adf8834d7784dfa612adc82759089063d7020
vishalsood114/pythonprograms
/command0.py
324
3.515625
4
def command(f): def g(filename): lines = read_lines(filename) lines = [f(line) for line in lines] print_lines(lines) return g def read_lines(filenames): return (line for f in filenames for line in open(f)) def print_lines(lines): for line in lines: print line.strip("\n...
251d732a012a96c171ea96b4be21f0ec1d9b63c1
roberto-uquillas/Python-EPN
/06_while-loop.1.py
224
3.90625
4
# -*- coding: utf-8 -*- """ Created on Sat Oct 19 12:52:45 2019 @author: CEC """ x=input("Enter a number to count to: ") x=int(x) y=1 while y<=x: print(y) y=y+1 if y>x: break
5b3234d123c22a1671c7849b3bfbba8ca427df96
JP9527/Road-to-Dev
/linghu-algorithm-templete-master/令狐老师的算法小抄/sorting.py
2,249
3.796875
4
# sorting # 时间复杂度: # 快速排序(期望复杂度) : O(nlogn) # 归并排序(最坏复杂度) : O(nlogn) # # 空间复杂度: # 快速排序: O(1) # 归并排序: O(n) # quick sort class Solution: def sortIntegers(self, A): self.quickSort(A, 0, len(A)-1) def quickSort(self, A, start, end): if start >= end: return left, right = s...
a0bc499b3a79acef38d684cde119ccba103dd57c
kstdnl/AaDS_1_184_2021
/1.revise1.py
2,537
3.890625
4
#TASK 1 count = 0 text = "The tiger once ranged widely from the Eastern Anatolia Region in the west to the Amur River basin, and in the south from the foothills of the Himalayas to Bali in the Sunda islands." for i in text: if i == 's' or i == 'a': count += 1 print(count) #TASK 2 from math import ...
71fa5357f20a76e77d0fd61622ca8841fda4fad5
moshegplay/moshegplay
/lessons_1/targil6.1.py
183
3.984375
4
if 4 or 5>7: print("good") else: print("bad") if (5+3) > 10 and"man" in "mama" or 100 != 3 and 90<91: print("fa") elif true is false: pass else: print("else")
783c9d8f752320c688c667fce0f956c37a75b0d1
finstalex/blackjack---python
/game.py
1,001
3.75
4
koloda = [6,7,8,9,10,2,3,4,11] * 4 import random random.shuffle(koloda) name=input(str("Введите Ваше имя : ")) print("Поиграем в Блекджек "+name+"?") print ("Правила игры: Нужно набрать 21 очко") count = 0 while True: choice = input("Будете брать карту? да/нет\n") if choice == "да": current = koloda.pop...
7cdb3422d7c78aa6dcf5fc9e4916d349a7b91b6d
rishiDholliwar/WorkoutApp
/WorkoutAnalyzer/generate-model-data.py
2,090
3.546875
4
import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.nonparametric.smoothers_lowess import lowess import os """ This program creates a csv file called exercise-model-data.csv for the workout app to use to train its model. exercise-model-data.csv contains 2 columns. The fi...
6e1ad785a952612ba16702d4921a9240dabd960e
CaMeLCa5e/Dailyfall2015
/test.py
313
3.734375
4
# x = ["5","A","B","C","D","F","A-B","A-C","B-C","C-D","D-F"] x = [ e.strip('"') for e in raw_input().split(',')] # string_input = [c.strip(',').strip("'") for c in raw_input('Enter something: ').split(',')] # string_input = [c.strip(',').strip('"') for c in raw_input('Please enter values').split()] print x
ede5910efc883cb889451dc28ac162105044a10d
GyeongMukLee/Programming-in-Python
/Chapter07-2/2_tuple/tuple-01.py
699
3.625
4
print("\n1. 샘플 튜플 출력") sampleTuple = (4, 3, 9, 1, 3, 6, 3, 3) print(" sampleTuple= ", sampleTuple) print("\n2. 샘플 튜플의 한 요소의 값의 위치") print(" sampleTuple= ", sampleTuple) print(" sampleTuple.index(4) = ", sampleTuple.index(4)) print(" sampleTuple.index(3) = ", sampleTuple.index(3)) print(" sampleTuple.index(1)...
d5ecfd28acc25800c5e0393109c2dcccf42a0860
yy642/Trumps-Tweets
/ERM.py
5,011
3.640625
4
import numpy as np def ridge(w,xTr,yTr,lmbda): """ INPUT: w : d dimensional weight vector xTr : nxd dimensional matrix (each row is an input vector) yTr : n dimensional vector (each entry is a label) lmbda : regression constant (scalar) OUTPUTS: loss : the total los...
5cd54160d59ce9a19a661a8fd2d4b02d5f89e8ea
lincolnjohnny/py4e
/2_Python_Data_Structures/Week_4/example_04.py
133
3.6875
4
# Lists can be sliced using ":" t = [0, 1, 2, 3 , 4, 5, 6, 7, 8, 9, 10] print(t[1:3]) print(t[:4]) print(t[5:]) print(t[:]) print(t)
9729e85e8221dded1cf0753a5361d6f6bd8916f7
Keerti-Gautam/PythonLearning
/Functions/Func.py
612
4.5
4
# Use "def" to create new functions """ The syntax for definition is def func_name(argument1, argument2, ...): statements to be executed These functions can be called by writing the function names. """ def add(x, y): # Can use print "x is {0} and y is {1}".format(x, y), print "Addition is"...
571cad4185c8fdd2c0de7c73242ceba7260214e2
benbendaisy/CommunicationCodes
/python_module/examples/product_of_array_except_self.py
660
3.5625
4
from typing import List class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: if not nums: return -1 zero_set = [x for x in range(len(nums)) if nums[x] == 0] if len(zero_set) > 1: return [0 for x in nums] temp = 1...
50205c05d1f80f0bec76f99143d62899f9025241
UdaySreddy/mobiux-task
/task_mobiUX_2.0.py
9,268
3.796875
4
import csv from datetime import datetime import json date_format = "%b-%Y" def parse_data(file_data): """Parses Data and stores it in proper dictionary :args:\ file_data(list of string lines from file) :returns:\ sales_data(parsed and stored data in form of dictionary) """ ite...
ae578f9b121e006c1f309697c3a74afab90224f5
sidtrip/hello_world
/CS106A/week6/fin_proj/wordguess/word_guess.py
1,338
4.375
4
""" File: word_guess.py ------------------- Fill in this comment. """ import random LEXICON_FILE = "Lexicon.txt" # File to read word list from INITIAL_GUESSES = 8 # Initial number of guesses player starts with def play_game(secret_word): """ Add your code (remember to delete the "pass" belo...
7ec753fdebce80799237ecf10c95f4c2487acb6e
Team-AiK/TT-Thinking-Training
/Week03/hong/1.py
311
3.671875
4
def getMinSum(A,B): answer = 0 size=len(A) while size > 0: num1=min(A) A.remove(num1) num2=max(B) B.remove(num2) size-=1 answer+=num1*num2 return answer #아래 코드는 출력을 위한 테스트 코드입니다. print(getMinSum([1,2],[3,4]))
b52a4712373a5da97c786d67830728dd99940068
joshie-k/exercism-practice
/python/matrix/matrix.py
783
3.6875
4
import unittest class Matrix: def __init__(self, matrix_string): rows = matrix_string.split('\n') row_len = len(rows) col_len = len(rows[0].split(' ')) self.matrix = [[0 for i in range(col_len)]for j in range(row_len)] for i, row in enumerate(rows): values = row....
bb47dc8dc70060e648d65009cd4427c03ad56d2b
hyo-eun-kim/algorithm-study
/ch08/kio/ch8_3_kio.py
1,503
3.984375
4
''' Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? ''' from typing import * from copy import copy from collections import deque class ListNode: def __init__(sel...
1602000a994e44f7714d5de895137eee7fb12950
kirillsa/brainbasket_savikrepo
/brainbasket_savikrepo/Pr.set6.py
2,174
3.6875
4
# -*- coding: utf-8 -*- #Savitskiy Kirill #Problem set 3 # #Problem 1 def f(x): import math return 10*math.e**(math.log(0.5)/5.27 * x) def rediationExposure(start, stop, step): sum = 0 while start<stop: sum += f(start)*step start += step return sum # print (rediationEx...
91b54079555a21d7df62bb4daba55fe8c07c9f69
kimhjong/class2-team3
/20171611_김현지_assignment2.py
349
3.9375
4
n = int(input("Enter a number: ")) + +while n!= -1: + if n>0: + fact=1 + for i in range(1,n+1): + fact=fact*i + print(n,"!=",fact) + elif n==0: + print("0! = 1") + elif n<-1: + print("no answer") + + n = int(input("Enter a nu...
6b2a6869c276bb716048d19b1556c38019152fab
Mukulphougat/Python
/functions/revision while loops.py
1,390
3.9375
4
# Printing Even numbers using while loop x = 0 while x <= 10: x += 2 print(x) # Using continue statement current_number = 0 while current_number < 10: current_number += 1 if current_number % 2 == 0: continue print(current_number) # Some more while loop print("LOOPS:") y = 1 while y <= 100: ...
86c3dba6fedf002f7942d6f52e7f1c4c7b1fd7c9
Debjit337/Python
/7.Tuple.py
1,934
4.46875
4
''' Python Tuple: 1. Tuple nonchange hai, aur list changeable hai. iska systax () 2. Tuple me values na change kar pane ki wajah se isme is tarike ke koi bhi methods nahi milte hai. 3. Single value wale tuple me value ke sath ek comma dena jaruri hai otherwiese wo ek stirng ya int value hi hoga. 4. List ke jaise h...
1aa79d2605d1be643167509b0b7a88dbaaff3e2d
pooriazmn/KHAFAN_BOT
/a_star.py
2,867
3.65625
4
def add(dic, key, value): dic[key] = value class Node(object): def __init__(self, parent=None, position=None): self.parent = parent self.position = position self.g = 0 self.h = 0 def __eq__(self, other): return self.position == other.position def __hash__(se...
58e74588f9e56b546847a93ef9abbfbd307c3233
Pragyanshu-rai/p_rai
/even.py
126
3.84375
4
x=int(input("enter the number")) i=0 a=0 while(x!=0): a=x%10 if (a%2==0): i+=a x//=10 print(i)
461b258d769e810d81ed609c75aec6b17cac0bec
karbekk/Python_Data_Structures
/Interview/LC/Trees/236_Lowest_Common_Ancestor_of_a_Binary_Tree.py
1,029
3.671875
4
class NewNode(object): def __init__(self, value): self.val = value self.left = None self.right = None a = NewNode(3) b = NewNode(6) c = NewNode(4) d = NewNode(9) e = NewNode(7) a.left = b a.right = c b.left = d b.right = e class Solution(object): def lowestCommonAncestor(self, root...
2ebe6272c47eaa317b86d2489e036f89a9775592
Veraph/LeetCode_Practice
/cyc/tree/BST/108.py
1,180
4.0625
4
# 108.py -- Convert Sorted Array to Binary Search Tree ''' Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1. Ex...
d16d77746d4cfe60225ea00f1008983a882ef648
mike1130/boot-camp
/week-04/week-04-02.py
1,282
4.15625
4
# Tuesday: For Loops # for num in range(5) : # keyword temp Variable keyword function ending colon # writing your first for loop using range for num in range(5): print('Value: {}'.format(num)) # providing the start, stop, and step for the range function for num in range(2,...
3f94255761f5d9b6a36a882c63822774b91ad920
LucasKetelhut/cursoPython
/desafios/desafio075.py
650
3.953125
4
n1=int(input('Digite o 1º número: ')) n2=int(input('Digite o 2º número: ')) n3=int(input('Digite o 3º número: ')) n4=int(input('Digite o 4º número: ')) tupla=(n1,n2,n3,n4) print(f'Você digitou os números: {tupla}') if 9 in tupla: print(f'O valor 9 apareceu {tupla.count(9)} vez(es)') else: print('O valor 9 não ...
3467bc193aa07ce428377a8ed8543b15f3a1e0b8
Dwomok/python
/get_name.py
99
3.90625
4
# Ask of user's name in python name = raw_input( 'what is your name?: ') print( 'You are' , name )
f6f9ebed50e52d8653e16dc851b67a7d5d897cdd
edsoncpsilva/Curso-Python
/exec06.py
629
3.96875
4
print() print('-'*80) #obtem dados do funcionario nome_func = input('Nome do Funcionario..: ') salario = int(input('Digita Salario Bruto.: ')) pc_desconto = int(input('Digita % de Desconto.: ')) #calcular salario liquido salario_liquido = (salario - ((salario * pc_desconto)/100)) vl_desconto = ((salario * pc_descont...
6019c9db0a71e23883100fbad5bb28bcc73c7f81
Billiardist94/Billiardist94
/Two largest numbers.py
938
4
4
n = int(input('Введите число > 2: ')) # Вводим количество чисел в списке(>2) lis = [] # Создаем пустой список while len(lis) != n: if n > 2: lis.append(int(input('Введите число в список: '))) # Заполняем список числами, количество чисел равно n else: print('Введено число <= 2') brea...
dd848606c2d3690a58b55afcf70015906d1327eb
Ibramicheal/Onemonth
/Onemonth/tip.py
607
4.21875
4
# this calculator is going to determines the perecentage of a tip. # gets bills from custome bill = float(input("What is your bill? ").replace("£"," ")) print("bill") # calculates the options for tips. tip_one = 0.15 * bill tip_two = 0.18 * bill tip_three = 0.20 * bill # prints out the options avaible. print(f"You bil...
c93218bd652f5da26c651247cc37913a371f5236
fe-sts/curso_em_video
/Python 3 - Mundo 1/2. Usando módulos do Python/Aula 008.py
313
3.859375
4
#from math import sqrt #num = int(input('Digite um numero: ')) #raiz = sqrt(num) #print('A raiz quadrada de {} é: {:.2f}'.format(num, raiz)) #import random #num = random.randint(1, 10) #Randomizar um numero de 1 a 10 #print(num) #import emoji #print(emoji.emojize('Olá, mundo :sunglasses:', use_alises=True))
c50d3267b78fabfb1d19d484ab5d5513b8976109
shashankvishwakarma/Python-Basic
/JSONExample.py
539
3.65625
4
book = {} book['tom'] = { 'name': 'tom', 'address': '1 red street, NY', 'phone': '74185263' } book['bob'] = { 'name': 'bob', 'address': '1 green street, NY', 'phone': '963852741' } import json s = json.dumps(book) print(s) with open('book.json', 'w') as file: file.write(s) with open("boo...
5e14095f183d548844db70810f1c578f9c2ce35d
nehajagadeesh/stock_order_matching_sytem
/tests/test_stock_model.py
3,945
3.515625
4
from stock_model import Stock from order_model import Order import unittest class StockTest(unittest.TestCase): def setUp(self): pass def test_insert_ascending_order(self): order_list = [ Order("#3 9:45 XAM sell 100 240.10".split(" ")), Order("#2 9:40 XAM sell 100 245...
7f5df2d015c513da572cb406441b843a1d549972
manjeet008/Basic_Programs-Recommended-
/AUGMENTED_OPERATOR.py
144
4.09375
4
#AUGMENTED OPERATOR input1=int(input("ENTER ANY NUMBER HERE.... ")) input1+=10 print("ADDING 10 TO IT ....") print("IT BECOMES... ",input1)
22b766db4565e7fa5c545b6a992376423e9002c5
devesh-bhushan/python-assignments
/concepts/tester.py
429
4.03125
4
""" using decorator function in factorial """ def decorator(facto): d= {} def logic(n): if n not in d: d[n] = facto(n) return d[n] return logic @ decorator def facto(n): if n == 1 or n == 0: return 1 else: return n * facto(n-1) res = facto num = int(...
ee945326827a65692f738dce88072c076ab1042c
asperaa/back_to_grind
/bactracking/39. Combination Sum.py
713
3.59375
4
"""We are the captains of our ships, and we stay 'till the end. We see our stories through. """ """39. Combination Sum """ class Solution: def combinationSum(self, nums, target): n = len(nums) self.total_length = n self.ans = [] self.target = target self.helper(nums, [...
0611bd86aec6cc76d417356c5cf9cf88828238c9
meganzg/Competition-Answers
/CodeQuest2017 - Practice/Prob11.py
578
3.609375
4
f = open(__file__.split(".")[-2] + ".in.txt") ncases = int(f.readline().strip()) key = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" for i in range(ncases): text = f.readline().strip() final = "" for word in text.split(): fword = word word = list(filter(str.isalpha, word)) #print(word) for w,...
71e860c9a2b5caf326cd1d3de048b0d1783428e8
Jsevillamol/AIMA
/search/problems/test_problem.py
1,023
3.953125
4
# -*- coding: utf-8 -*- from problems.problem import Problem class Test_problem(Problem): """ Problem for testing. The initial state is 0. Actions are sum 1, sum 2 or sum 3. The goal is reaching a certain number, """ def __init__(self, goal = 21): self.goal_state = goal self.i...
cc9aad138da71d82d8de55f02c4784948f89e567
gudduarnav/ImageProcessingPython
/ImageProcessing/LiveStreamVideo/Video/old/videograyframes.py
916
3.703125
4
# Read a Video stream from file and stream it on screen in Grayscale format import cv2 # Set the Video Filename vidFile = "demo.mp4" # Open the Video File v = cv2.VideoCapture(vidFile) # Check if the file can be opened successfully if(v.isOpened() == "False"): print("ERROR: Cannot open the Video File") quit...
bfcd8a482db150138e53a2fc957bc1bdd5c8f66e
VamsiMohanRamineedi/Algorithms
/349. Intersection of two arrays.py
481
3.6875
4
# Intersection of two arrays: Time: O(m+n), space:O(m) class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: result = [] hash_map_nums1 = {} for num in nums1: if num not in hash_map_nums1: hash_map_nums1[num] = 1 for num ...
35ad15bb061ea9fc9ac4d33d45d7b1adab5a6809
anilsaini06/python
/l.py
172
4.09375
4
print ("what is your age?") age = int(input()) if age<18: print("you cannot drive") elif age ==18: print("we will think about you") else: print("you can drive")
6d5ea5a36d1608288e0503db8598e572a9ae3429
sakurasyaron/educative-ds-and-algos
/StringProcessing/palindrome_permutation.py
568
3.828125
4
def is_palin_perm(input_str): input_str = input_str.replace(" ", "") input_str = input_str.lower() d = dict() for i in input_str: if i in d: d[i] += 1 else: d[i] = 1 odd_count = 0 for k, v in d.items(): if v%2 != 0 and odd_count == 0: o...
786c02c6392619a0f3314621d11c31cc07de1539
pihu480/more-exercise
/factorial.py
88
3.921875
4
i=int(input("enter tha number")) f=1 while i>0: f=f*i i=i-1 print("factorial",f)
50eb6623a6aabd9a9c9d1d1cd6809a7ee4574d4f
feng1o/python_1
/文件/pickling.py
679
3.71875
4
#!/usr/bin/python # Filename: pickling.py import pickle # the name of the file where we will store the object shoplistfile = 'shoplist.data' # the list of things to buy shoplist = ['apple','mango','carrot'] shoplist1= ['name','age','sex'] # Write to the file f = open(shoplistfile,'wb') pickle.dump(shopl...
c82f723057a489b6a9d21494071338f8481aa76c
armansujoyan/codefights
/The Journey Begins/checkPalindrome.py
282
3.5625
4
def checkPalindrome(inputString): # In order to solve this problem we # will use Python's Extended Slice # For more information see https://docs.python.org/2.3/whatsnew/section-slices.html if inputString == inputString[::-1]: return True return False
f2fd5b0e455c2b7ca6a2ac654d2ade0a28d8a489
lucaderi/sgr
/2021/Pini/Client.py
962
3.609375
4
class Client: """Represents a wireless client seen in that envirement Inputs: - bssid(str) the MAC address of the wireless client - ssid set of the network names (of the APs) """ def __init__(self, bssid): self.bssid = bssid self.requested_ssid = set() def add_new_req...
53ae502ad523bd6cd23e8b3b0f1422ff05a716bf
lucaschen198311/Python
/fundamentals/extras/TDD.py
3,458
3.96875
4
import unittest def reverseList(input): return input[::-1] def isPalindrome(input): for i in range(0,len(input)//2): if input[i] != input[len(input)- 1 -i]: return False return True def factorial(n): if n<1: return if n ==1: return n return n*factorial(n-1...
8bc3f20acb694177404d1722cc8ea5348e4ab85d
pranaysingh25/Facial-Keypoint-Detection
/models.py
1,790
3.578125
4
# define the convolutional neural network architecture import torch import torch.nn as nn import torch.nn.functional as F # can use the below import should you choose to initialize the weights of your Net import torch.nn.init as I class Net(nn.Module): def __init__(self): super(Net, self).__init__() ...
670c49d5fb55308d44d18d645dbe7b9beb685f26
nkwarrior84/Statistical-coding
/encryption.py
1,860
4.4375
4
''' An English text needs to be encrypted using the following encryption scheme. First, the spaces are removed from the text. Let L be the length of this text. Then, characters are written into a grid, whose rows and columns have the following constraints: floor(root(L)) < row < column < ceil(root(...
c129f135bdc0cd94047a9dc887f310ce673c6522
thedog2/dadadsdwadadad
/часть 2(week2)/koordinatnue chetverti.py
135
3.734375
4
x1=int(input()) y1=int(input()) x2=int(input()) y2=int(input()) if x1*x2>0 and y1*y2>0: print('Yes') else: print('No')
40037ac32edd672a48aa75d40a1a968bd8fe3c97
sourlows/pyagricola
/src/player/family_member.py
628
3.8125
4
__author__ = 'djw' class FamilyMember(object): """ A single family member and his current state """ def __init__(self, is_adult=False): self.is_adult = is_adult self.currently_working = False @property def food_cost(self): """ :return: The number of food this unit requ...
87987b3bcb41b671f3eac7367e32ceb737bdf208
omdeshmukh20/Python-3-Programming
/Even Factor.py
206
4.0625
4
#Discription: Even factor program #Date: 09/07/21 #Author : Om Deshmukh x = int(input("Enter any number")) print("The even factors of",x,"are:") for i in range(2, x + 2): if x % i == 0: print(i)
d1eadafd170e7f8e5fcdd099bc29dc4a06337888
SinglePIXL/CSM10P
/Homework/randomNumbersReadWrite.py
1,699
3.953125
4
# Alec # randomNumbersReadWrite.py # 10-2-19 # Ver 2.1 # A program that writes a series of random numbers to a file. # Each random number should be in the range of 1 through 100. # The user specifies how many random numbers the file will hold. import random def main(): outfile = open('randomNumbers.txt','w') ...
e4a29712471031057df356f78a09aa1bf1ed28da
prajwal60/ListQuestions
/learning/BasicQuestions/Qsn73.py
285
4.1875
4
# Write a Python program to calculate midpoints of a line x1 = int(input('Enter value of x1 ')) x2 = int(input('Enter value of x2 ')) y1 = int(input('Enter value of y1 ')) y2 = int(input('Enter value of y2 ')) x = (x1+x2)/2 y= (y1+y2)/2 print(f'The mid point is ({int(x)},{int(y)})')
f6ee182153c8c4e488cf232aaa824b0b44bc6eff
NavTheRaj/python_codes
/loop.py
86
3.625
4
for num in range (1,6,2): print(num) for x in range(1,8): print(x)
dc36e0402d7e9253ebb1b70ee76df105e7ff625d
Carvanlo/Python-Crash-Course
/Chapter 10/learning_c.py
226
3.765625
4
filename = 'learning_python.txt' with open(filename) as file_object: lines = file_object.readlines() file_string = '' for line in lines: file_string += line.rstrip() file_string.replace('python', 'c') print(file_string)
ba90f3ff508957195195c7f5bdbef694b608d90b
DivyaMaddipudi/NPTEL_Pyhton
/Programming Assignments/week-3/practice1.py
195
3.8125
4
def descending(l): li = [] for i in l: li = li + [i] x = l x.sort(reverse = True) if li == x: return True else: return False print(descending([]))
ac62b22d0de999d532fffb9dbd80cbc95f4e77fb
ianlai/Note-Python
/algo/tree/_0314_BinaryTreeVerticalOrderTraversal.py
1,350
3.703125
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: # DFS with sorting [O(N + WlogW + WHlogH), 80%] def verticalOrder(self, root: TreeNode) -> List[Lis...
23d4866bd2d524ad80704aa68d958c2050dc5b5e
GustavoJatene/practice
/029.py
195
3.65625
4
vel = int(input("Informe a velocidade do carro: ")) if vel <= 80: print("Dentro do limite permitido") else: mul = (vel-80)*7 print("Deverá pagar multa no valor de: {}R$".format(mul))
50556888317ba4b3502a2d915aca31803285b383
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
/students/ian_letourneau/Lesson02/fizz_buzz.py
526
4.5
4
## Ian Letourneau ## 4/25/2018 ## A script to list numbers and replace all multiples of 3 and/or 5 with various strings def fizz_buzz(): """A function that prints numbers in range 1-100 inclusive. If number is divisible by 3, print "Fizz" If number is divisible by 5, print "Buzz" If number is divisible by bo...
d727324b20758b00bb745be414e585baf732ffbb
EstherAmponsaa/cssi
/cssi-labs (copy)/python/labs/word-frequency-counter/starter-code/wordfreq_starter.py
1,186
4.125
4
def read_process_data(): with open('third_party/jane-eyre.txt') as f: # the following line # - joins each line in the file into one big string # - removes all newlines and carriage returns # - converts everything to lowercase content = ' '.join(f.readlines()).replace('\n','...
d9acf0b20e3941cb5b529f80e253e10d00b97433
2ptO/code-garage
/icake/q2.py
1,060
4.5
4
# Given a list of integers, find the highest product you # can get from three of the integers. def get_highest_product_of_three(nums): # Can't calculate highest product of 3 with less than 3 numbers if len(nums) < 3: raise ValueError("Expected a minimum of 3 numbers") highest_product_of_three ...
3fbf94406da7d036b3d2e4411c772a63ad53313a
Blitzdude/advent-of-code-2020
/tutorials/python_sets.py
1,498
4.25
4
# https://pythonspot.com/python-set/ exampleSet = set(["Postcard", "Radio", "Telegram"]) print(exampleSet) # Sets cannot contains multiples. Any doubles are removed exampleSet = set(["Postcard", "Radio", "Telegram", "Postcard"]) print(exampleSet) # Above is old notation, Use simple notation in python 3 simpleSet = ...
8b73e28dcaa92c356ba1f8d4433816a598610d5a
XOR0831/speech-recognition-fcs
/1-Data Gathering & Preparation/audio_segmentation.py
7,271
3.546875
4
# import dependencies from pydub import AudioSegment from pydub.silence import split_on_silence import os import speech_recognition as sr import datetime # use the audio file as the audio source for recognition r = sr.Recognizer() # file path to original data path = "...
2814a3bb6ff9806fe03cd3934c5b3a5dcaccf062
hamzaansarics/Python-
/star args Operator.py
1,563
4.09375
4
# def total(a,b): ///// Simple Function ////////// # return a+b # print(total(10,22)) # print(total(10,12,12)) //// Genrating Error Because Input is Extra than Parameters /// # /////////////// *args Operator ///////////// # n=int(input("Enter a value")) # b=int(input("Enter b value")) # c=int(input("Enter...
7c107a6f871acb68be870aad8b3bcb7f284a2384
jones3kd/Cracking_The_Coding_Interview
/ch2/2.3.py
708
3.859375
4
""" Problem 2.3 implement an algorithm to delete a node in the middle of a singly linked list given acces only to that node. """ from linked_list import LinkedList def delete_mid_node(middle_node): if middle_node is None: return 0 if middle_node.next is not None: middle_node.value = middle_...
d703841bd6da03a0888a11e775e3e9b355f904dd
kefirzhang/algorithms
/leetcode/python/easy/p203_removeElements.py
797
3.65625
4
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def removeElements(self, head: ListNode, value: int) -> ListNode: pre_head = back_head = ListNode(None) pre_head.next = head while pre_head.next is ...
9b82ef0076be12130ad77c0d10e7d1cd39c0c8af
kristiluu/Student-Gradebook
/College/main.py
4,877
4
4
# Kristi Luu from student import Student, IntlStudent, StudentEmployee class StudentRecord(Student): '''This is the StudentRecord class''' def __init__(self): '''The constructor for StudentRecord class. It has 2 variables: list of countries for International students and dictionary of students...