blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
c16ce6014486eef6c7c83a79976f1e7cfc80e696 | jpignata/adventofcode | /2020/13/solve.py | 694 | 3.65625 | 4 | import sys
from itertools import count
def find_bus(start, buses):
for minute in count(start):
for _, bus in buses:
if minute % bus == 0:
return bus * (minute - start)
def find_pattern(buses):
start, step = 1, 1
for offset, bus in buses:
for minute in count(s... |
4cd49ab4d1482795096f65d5768fe221f35dcdea | jpignata/adventofcode | /2015/02/solve.py | 682 | 3.59375 | 4 | import sys
import operator
from collections import namedtuple
from functools import reduce
Box = namedtuple("Box", ["l", "w", "h"])
def sides(box):
return [box.l * box.w, box.w * box.h, box.h * box.l]
def area(box):
return reduce(lambda x, y: (2 * y) + x, sides(box), 0)
def volume(box):
return reduce... |
bf1203a60ff3bea547ecd2aa8369fc1a3d32cc17 | netoarmando/python-playground | /database.py | 3,092 | 3.671875 | 4 | # Copyright (C) 2021 Armando Neto <code@armandoneto.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This prog... |
3e10e0b37766c4d25199db821d80afaf22363de4 | CodeCyphers/Password-Gens | /Password Gen v.5.py | 1,043 | 4.3125 | 4 | #Importing the random module and the string module, used for the actual randomization
import random
import string
# Defines the function for all ascii random and allows an argument to be passed to it
def random_ascii(stringLength=1000):
#Specifies characters that will be randomized in the string
characte... |
591e65f65e91e499de279135ba972f8f6f46ae4a | gbb365/leetcode | /Problemset/remove-linked-list-elements/remove-linked-list-elements.py | 1,452 | 3.65625 | 4 |
# @Title: 移除链表元素 (Remove Linked List Elements)
# @Author: 15218859676
# @Date: 2020-08-19 16:05:01
# @Runtime: 72 ms
# @Memory: 19.6 MB
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def removeE... |
e70857b27c460760172b32cb75824f844460bac5 | Wolph20/project1 | /truetable.py | 4,209 | 3.78125 | 4 | from conversion import Conversion
import numpy as np
# This function replace postfix expression by each binary case of each column, for ex. ab+ convert to 00+ in the first column and so one for the others.
def Bin_sustitution(posfix, operands, bin_value):
bin_expr = posfix
for i, j in enumerate(operan... |
d7a52df3b714275b4b389de615e81f7fa6eb82af | ergaziz/python-study | /02objects/objects.py | 2,232 | 3.828125 | 4 | def is_same_object(a, b):
"""Checks object references
Args:
a: first object
b: second object
Returns:
True if the parameters are the same object,
False if they represent different objects
"""
# id() gives reference point of the variable.
# int is immutable objec... |
16e9f5e87fd588f548f1f2f9dc61412ea7171b73 | ergaziz/python-study | /05iterables/iterators.py | 1,506 | 4.0625 | 4 | def playwithiterators():
iterable = ["lorem","ipsun","dolor","??"]
iterator = iter(iterable)
next(iterator)
next(iterator)
next(iterator)
next(iterator)
next(iterator) # bang here, StopIteration exception
# ### Summary
# #### Comprehensions
# - Comprehensions are concise syntax for de... |
f21d9bb922aa5909c41f25d7b75c89a3758bc748 | nimitpatel26/python-data-structures | /data_structures/queues/circular_queue.py | 924 | 3.75 | 4 |
class CircularQueue:
def __init__(self, capacity):
self.front = -1
self.back = -1
self.queue = [None] * capacity
self.capacity = capacity
self.length = 0
def enqueue(self, item):
if self.length == self.capacity:
return
if self.length == 0:
... |
5a35f1fb1ce5d3cc57a38d358063a34cd6e8f39d | nimitpatel26/python-data-structures | /algorithms/sorting/quick_sort.py | 628 | 3.6875 | 4 |
class QuickSort:
def __init__(self, a, comp):
self.a = a
self.comp = comp
def sort(self):
self.quick_sort(0, len(self.a) - 1)
print(self.a)
def quick_sort(self, start, end):
if start >= end:
return
marker = start
for i in range(start,... |
8c07cf3317592334f564f25f5d8393ca31e8e677 | collab-uniba/pySOreputation | /parallel_version/parallel/rep_scores.py | 493 | 3.734375 | 4 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 27 10:16:59 2019
@author: Roberto Bellarosa
"""
# This class provide the reputation scores values
class Score:
def __init__(self):
return
quest_up = 10 # question is voted up: +10
ans_up = 10 # answer is voted up: +10
ans_accepted = 15 # a... |
25cebac622ac8d63ffbc88fe8d4fd32a2508608e | todd-trowbridge/Tamagotchi | /cuddlypet.py | 492 | 3.515625 | 4 | from pet import Pet
class CuddlyPet(Pet):
def __init__(self, name):
super().__init__(name)
self.hunger += 2
def cuddle(self, other_pet):
other_pet.get_love()
def be_alive(self):
self.fullness -= self.hunger
self.happiness -= self.mopiness/2
for toy in self.toys:
self.happiness... |
5302fd2e6f4b9449c14c3aca88bcf9d6754263bd | Zafeerahamad/competitive-coding | /rating.py | 270 | 3.65625 | 4 | anjali=[int(i) for i in input().split()]
maya=[int(j) for j in input().split()]
anjali_point=0
maya_point=0
for i in range(3):
if anjali[i]>maya[i]:
anjali_point+=1
elif anjali[i]<maya[i]:
maya_point+=1
print(anjali_point,maya_point)
|
3d1fd03f3236f97a7ff454511499b4c59ddac24c | brunilda-sa/PythonPractice | /List_Less_Than_Ten.py | 294 | 4.09375 | 4 | '''
Created on Jul. 23, 2019
@author: Brunilda
'''
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
number = input(f'Enter a number among this list {a}: ')
less_than = [a[i] for i in range(len(a)) if a[i] < int(number)]
print(f'The new list containing numbers less than {number} is {less_than}') |
9a7a080bbb92930335a3c22fe9a67bcd65d00e51 | Teghfo/MapsaBootCamp | /DesignPatters/Strategy1.py | 1,083 | 3.6875 | 4 | from abc import ABC, abstractmethod
class Context:
def __init__(self, **kwargs):
self.nameList = []
self.methods = []
for name, impl in kwargs.items():
setattr(self, name, impl)
self.nameList.append(name)
def context_interface(self):
for name in self.na... |
cc246aaecafa90b5bd30c89d93724b636723722f | vtemian/uni-west | /first_year/ca/hw5/convertor_IEEE754.py | 2,860 | 4 | 4 | #!/bin/python
import sys
def decimal_to_binary(number):
binary = ""
reminder = number % 2
while number > 0:
number = number / 2
binary += str(reminder)
reminder = number % 2
return binary[::-1]
def compute_mantisa(decimal):
mantisa = ""
number = float("0.%s" % decim... |
afbf00f646f3e20e8ac707ee0b40271f291e6871 | psydeolite/liner | /draw.py | 2,681 | 3.59375 | 4 | from display import *
def get_eqnvals(x0,y0,x1,y1):
m=(y1-y0)/(x1-x0)
b=y0-m*x0
dy=y1-y0
dx=x1-x0
A=dy
B=-1*dx
C=b*dx
ret=[]
ret.append(A)
ret.append(B)
ret.append(C)
ret.append(m)
return ret
def leppard(x,y,eqn):
A=eqn[0]
B=eqn[1]
C=eqn[2]
return A*... |
e721a9ec9b71a2d49cf6bfa558feddf93dc2c4d5 | JashanPruthi/TicTacToe | /tictactoe.py | 4,532 | 3.90625 | 4 | """
Tic Tac Toe Player
"""
import math
import copy
X = "X"
O = "O"
EMPTY = None
def initial_state():
"""
Returns starting state of the board.
"""
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]]
def player(board):
"""
Returns player who h... |
3b0137cf64c803c64e096bc6dc0e6419b25df351 | AasthaMehtaTech/LeetCodeProblems | /322_coinchange.py | 2,544 | 3.5 | 4 | #smart short
class Solution:
def coinChange(self,c,a):
c.sort(reverse=True)
n,r=len(c),a+1
def dfs(x,t,cnt_until_now):
nonlocal r
if cn+math.ceil(t/c[x])>=r:return
if t%c[x]==0:
r=cnt_until_now+t//c[x]
return
if ... |
35e9872c7d72e25a609d17b7d03ed1aa5de3716e | dddxing/create-pdf-with-python-fpdf2 | /part_1.py | 765 | 3.625 | 4 | from fpdf import FPDF
# create FPDF object
# Layout ('P','L')
# Unit ('mm', 'cm', 'in')
# format ('A3', 'A4' (default), 'A5', 'Letter', 'Legal', (100,150))
pdf = FPDF('P', 'mm', 'Letter')
# Add a page
pdf.add_page()
# specify font
# fonts ('times', 'courier', 'helvetica', 'symbol', 'zpfdingbats')
# 'B' (bold), 'U' (... |
a6b62b38102421ba79285889d730b1ea8e0b4ea0 | Gurvisingh111/Scrabble | /test_v2.py | 3,232 | 4.1875 | 4 | from scr_code_v2 import *
# Entering a valid word returns True
def test_case1():
print('"Cabbage" is a valid word so it returns True')
assert check_if_exists('cabbage') == True
# Entering an invalid word returns False
def test_case2():
print('"sfksdfji" is not a valid word, so it return... |
16a09fc45b8884075064bd718c60be3624c293fc | AlgoHeaven/Algorithm_Study | /Quartiles/ljh.py | 424 | 3.609375 | 4 | n = int(input())
q = list(map(int,input().split()))
q = sorted(q)
def find_median(qlist):
if len(qlist)%2!=0:
return qlist[len(qlist)//2]
else:
return (qlist[(len(qlist)//2)-1] + qlist[len(qlist)//2])/2
q1 = find_median(q[:len(q)//2])
q2 = find_median(q)
if n%2!=0:
q3 = find_median(q[(len(... |
c591fd18d52cbb7d300dff950603c50465273ba1 | AlgoHeaven/Algorithm_Study | /Kangaroo/ljh.py | 264 | 3.5625 | 4 | x1V1X2V2 = input().split()
x1 = int(x1V1X2V2[0])
v1 = int(x1V1X2V2[1])
x2 = int(x1V1X2V2[2])
v2 = int(x1V1X2V2[3])
def kangaroo(x1, v1, x2, v2):
if v2>=v1: return "NO"
if (x1-x2)%(v2-v1)==0: return "YES"
else: return "NO"
print(kangaroo(x1,v1,x2,v2))
|
7015e5343a00cf2273e8833220e693d2dc01b61d | shanto268/CrateAnalysis | /HistoMaker2D_original.py | 4,363 | 3.5 | 4 | """
A module for plotting 2-d histograms of various numeric quantities
"""
__author__="Igor Volobouev (i.volobouev@ttu.edu)"
__version__="0.2"
__date__ ="June 25 2020"
import matplotlib.pyplot as plt
import numpy as np
from AbsAnalysisModule import AbsAnalysisModule
class HistoMaker2D(AbsAnalysisModule):
"""
... |
340131a305e72ee92e0e6fc38c2318e9c3fc26bb | ankitmaini/PythonScripts | /AutoNumbering.py | 1,232 | 4.09375 | 4 | # INITIAL DESCRIPTION
# Suppose you have a word document or a random piece of text and you want to add a numbering/bullets or any marker to each line of the text.
# This short python program can help you do that immediately with a click. Just copy the text by using Ctrl+C or (Mac-CTRL+C) and run
# this program. And th... |
18ed145b624c52cb948b91be92c89dc29cf2f3f6 | tejasdevalapur/Wand_Pptx | /watermark_pptx.py | 5,359 | 3.578125 | 4 | import os,glob
import wand
from wand.image import Image
from pptx import Presentation
from pptx.util import Inches
""" summary_line
Keyword arguments: create_ppt,slides,add_images
argument -- description-array_of_images,titles-subtitles,ppt_name,path
Return: This function takes an array of ppt_images,titles-subti... |
b50df084f5e88399c5131dd347400d9beb97e611 | Diadochokinetic/DataScienceTools | /dstools/preprocessing/Bucketizer.py | 7,126 | 3.9375 | 4 | import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin
class Bucketizer(TransformerMixin):
"""
The Bucketizer puts numeric features into bins. The binned feature can either replace the original feature or can be created additionally. You can bin all numeric features, pass a list of ... |
048d1331930dd3a136956a6697932a8610f2b507 | LinkMarco/PrototypeClustering | /src/preprocessing/synonyms.py | 7,712 | 3.5 | 4 | import csv
from preprocessing.preprocess import PreprocessBase
"""
Marco Link
"""
class SimpleSynonyms(PreprocessBase):
"""
Class for replacing words with its specified synonyms.
The synonyms has to be defined in a file.
An entry in the file specifies the word which should be replaced followed by the... |
1343d17a43b6debb8bae151f8c5c16ccb50aae72 | LinkMarco/PrototypeClustering | /src/output/category_creation.py | 5,801 | 3.546875 | 4 | from abc import ABCMeta, abstractmethod
import pyodbc
"""
Marco Link
"""
class CategoryCreator(metaclass=ABCMeta):
"""Base Class for classes which will create categories for a specific dataset."""
def __init__(self, path):
self._path = path
@abstractmethod
def create_categories(self):
... |
7779f6e12102a60a1a32cc985bfc13fa5c126104 | NaifeiPan/oop-assignment-NaifeiPan | /src/main.py | 591 | 3.578125 | 4 | from usReader import Country
from stateReader import State
from countyReader import County
print("Which dataset are you interested in?")
print("For country level COVID-19 data, enter 1")
print("For state level COVID-19 data, enter 2")
print("For county level COVID-19 data, enter 3")
val = input("Enter your value: ") ... |
53d170f39c86b8189200ad9b012a6697002b9629 | ewdillard/4-new-turtle-methods- | /main.py | 1,991 | 3.828125 | 4 | #https://realpython.com/beginners-guide-python-turtle/?__cf_chl_jschl_tk__=4873864d673ca5883fb35235a166394c9c7b2968-1607106358-0-AaW5lNpA4KW5T8S6Y1_jBA8e2R2iYh28U5V7UdqLmcXCswGzvegnCWnpl0kzcEKCIiygN27MrCvdAyDTMTQz3Lr-AZtWAM91filqr-UQPnqFLyBroh4HBkyllhAaqublYtVdYjisWdAlL9294UL8LqjM26esH0PEDyMz8wfw6Felofe0ui27rIvhPJF8h6o... |
9de9a1ac24839d66fb8359607ed755fcb4f542f8 | bristol-seds/bristol-seds.github.io | /_tools/magic-ring-binder/distance.py | 1,258 | 3.578125 | 4 | # Distances and things
from geopy import distance
def gc(first, last):
f = (first["latitude"], first["longitude"])
l = (last["latitude"], last["longitude"])
return distance.great_circle(f, l).kilometers
# Calculates the distance the flight traveled by summing the distance
# between telemetry points
# Fl... |
919aaca3d9c3094067a4778a1f95fa04cbcfbcab | DRogalsky/sideScrollerShooter | /ship.py | 1,529 | 3.890625 | 4 | import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
"""A class to manaage the ship."""
def __init__(self, ss_game):
"""Initialize the ship and set its starting position."""
super().__init__()
self.screen = ss_game.screen
self.settings = ss_game.settings
s... |
c206995855f9fbfacdcfc528fe767f67d67999b8 | bianca-campos/pythonExercises | /Chapter7-BiancaCampos.py | 2,471 | 4.40625 | 4 | # exercise 1
# Write a program to read through a file and print the contents of the file (line by line)
# all in upper case. Executing the program will look as follows:
# python shout.py
# Enter a file name: mbox-short.txt
# FROM STEPHEN.MARQUARD@UCT.AC.ZA SAT JAN 5 09:14:16 2008
# RETURN-PATH: <POSTMASTER@COLLAB.SAKA... |
b14bf2b4bc4ca6290426f0af5b396007c3a5f237 | FlavioFS/UFC-Subjects | /Data Mining/Teaching Samples/for.py | 162 | 4.03125 | 4 | for letra in "Python":
print "Letra atual ", letra
frutas = ["banana", "manga", "goiaba"]
for index in range(len(frutas)):
print "Fruta atual: ", frutas(index) |
3d1a7f382edb9d5a00aca6d3b73abd629fda052e | GormNobodoran/GildedRose-Kata-python | /python/Domain/quality.py | 584 | 3.5625 | 4 | # -*- coding: utf-8 -*-
class Quality:
__INCREASING_FACTOR = 1
__DECREASING_FACTOR = 1
__MIN_QUALITY = 0
__MAX_QUALITY = 50
def __init__(self, quality):
self.quality = quality
def increase(self) -> None:
if self.quality < self.__MAX_QUALITY:
self.quality = self.qua... |
8190e93e3ebeee84cb80e3c5551f0e6437593f3e | Basava1514/Python-training | /bigger num func.py | 279 | 4.375 | 4 | """Write the above solution in a function which takes take numbers and return the bigger number
[topic covered: function]"""
a = int(input("enter the number"))
b = int(input("enter the number"))
def largest(x,y):
c = max(x,y)
print(c," is the largest.")
largest(a,b)
|
f320949e5c2a9962eed2f01b13980a51e5882bba | qixiangyang/DSA | /Leetcode/51-100/00070_climbing_stairs.py | 1,490 | 3.59375 | 4 | import functools
"""
Description:
Author:qxy
Date: 2019-06-09 16:30
File: 00070_climbing_stairs
"""
"""
假设你正在爬楼梯。需要 n 阶你才能到达楼顶。
每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?
注意:给定 n 是一个正整数。
示例 1:
输入: 2
输出: 2
解释: 有两种方法可以爬到楼顶。
1. 1 阶 + 1 阶
2. 2 阶
示例 2:
输入: 3
输出: 3
解释: 有三种方法可以爬到楼顶。
1. 1 阶 + 1 阶 + 1 阶
2. 1 阶 + 2 阶
3. 2... |
8c7aeaf865b405b4041233a89c014a9d577988dd | qixiangyang/DSA | /Algorithm/Sort/merge_sort.py | 763 | 3.859375 | 4 | """
Description:
Author:qxy
Date: 2019-07-03 17:29
File: merge_sort
"""
def merge_sort(list_data):
data_len = len(list_data)
if data_len < 2:
return list_data
mid = int(data_len/2)
left = merge_sort(list_data[:mid])
right = merge_sort(list_data[mid:])
print(left, right)
retur... |
4b309a74cd57b9e8a53271c057fb822c50b2d48d | qixiangyang/DSA | /Algorithm/DP/find_coins.py | 1,027 | 3.875 | 4 | from typing import List
from functools import lru_cache
"""
例子来源:
https://labuladong.gitbook.io/algo/di-ling-zhang-bi-du-xi-lie/dong-tai-gui-hua-xiang-jie-jin-jie
动态规划解题套路框架
"""
"""
理解:
首先是穷举所有可能的结果,在结果中寻找最优解
"""
def coin_change(coins: List[int], amount: int):
@lru_cache()
def dp(n):
# base case
... |
39ef6eab7c2e1bff4e7ef97e609fa4d4aa51f873 | qixiangyang/DSA | /Leetcode/1-50/00002_add_two_numbers.py | 2,063 | 3.984375 | 4 | """
https://leetcode.com/problems/add-two-numbers/
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not con... |
8ff3fa43303899655535b6546dd733b953284615 | mt114ran/CompetitionProgramming | /AtCoder_2019D.py | 1,159 | 3.8125 | 4 | # 2019A問題
# 長さNの整数列がサーバーに保管されている。つい先ほどまで、この列には1からNまでの整数が1個ずつ含まれていた。
# しかし、たった今発生したトラブルにより、列のいずれか1個の要素が別の1以上N以下の整数に書き換えられた可能性がある。
# あるいは、何の書き換えも発生しなかったかもしれない。
# トラブル発生後の整数列A1,…,ANが与えられる。
# これを読み込み、書き換えが発生していたかを判定し、発生していた場合にはどの整数がどの整数に書き換えられたかを報告するプログラムを作成せよ。
# 書き換えが発生していなかった場合、Correct と出力せよ。
N = int(input("データ数を入力してくださ... |
d1d3a9e2d59c05dd25d150360399499d31bc2106 | hakan7822/Projet3Macgyver | /class_Character.py | 1,622 | 3.734375 | 4 | """Pygame importation."""
import pygame
from pygame.locals import *
from class_Coordinates import *
class MacGyver:
"""
Description.
A class to define the attributes of Macgyver.
"""
def __init__(self):
"""Constructor. Sets blank coordinates and 'player.png' as sprite."""
self.co... |
77b7e00b87998453f9e6b809256df2462d523aff | JaKoZpl/python_lab | /laba5/1.py | 760 | 4.28125 | 4 |
# Номер 1
print("Введіть розмірність масиву: ")
size = int(input())
i = 0
list = []
final_list = []
print("Введіть елементи масиву: ")
while i < size:
i += 1
list.append(input())
print("Початковий масив: " + str(list))
for item in list[::2]:
final_list += item
print("Фінальний масив: " + str(final_list)... |
70ac6db8006855aebe14eca7a648a099af80d2a7 | JaKoZpl/python_lab | /laba4/1.py | 235 | 3.921875 | 4 | print("Введіть x (дісьне число): ")
x = float(input())
print("Введіть y (дісьне число): ")
y = float(input())
def sum_two_digits(x, y):
return pow(x, 2) + pow(y, 2)
print(sum_two_digits(x, y))
|
97b35b50a6c873f9430029fb15f223bdaf57b15e | chetancae4/tkinter-practice | /tut.18.py | 453 | 3.921875 | 4 | #create a gui window which takes as input width and height
#and upon clicking apply it should be able to change its size accordingly
from tkinter import *
def update():
print("updating the gui")
root.geometry(f"{width.get()}x{height.get()}")
root=Tk()
width=StringVar()
height=StringVar()
Entry(root,t... |
3625a54a7211c1c98caea0e858a7d3b91367b310 | chetancae4/tkinter-practice | /tut.16.py | 483 | 3.578125 | 4 | from tkinter import *
i=0
root=Tk()
root.geometry("455x233")
root.title("List box tutorial")
def add():
global i #means modification of i is allowed inside the function
lbx.insert(ACTIVE,f"{i}") # active means wereever our pointer is there the new value get added above it
i+=1
lbx=Listbox(r... |
a0e339c0954d179a25d62b05e24751ea95d08215 | annaoskarson/aoc2020 | /aoc2020-18.py | 2,779 | 3.53125 | 4 | #!/usr/bin/python3
import re
with open('aoc2020-18-input.txt', 'r') as f:
homework = f.read().strip().split('\n')
#homework = ['2 * 3 + (4 * 5)','5 + (8 * 3 + 9 + 3 * 4 * 3)','5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))','((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2']
#homework = ['1 + 2 * 3 + 4 * 5 + 6']
#homewo... |
5309aeddb40a7a7d5da0c622abc866c2ccbf0de1 | ClaudeJang/MAIN | /Python/BAEKJOON/backjoon_10872_팩토리얼.py | 459 | 3.703125 | 4 | '''
0보다 크거나 같은 정수 N이 주어진다. 이때, N!을 출력하는 프로그램을 작성하시오.
첫째 줄에 정수 N(0 ≤ N ≤ 12)가 주어진다.
첫째 줄에 N!을 출력한다.
'''
N = int(input()) # 12
# 12! = 1 * 2 * 3...*12
if N ==0:
result = 1
else:
list = []
# print(list)
result = 1
for i in range(1,N+1,1):
list.append(i)
# print(list)
for j in list:
... |
a4667f4e05a674b7ef8037faa638e7976b4c6c61 | DeMarcoHeath/avito_grabber | /range_checker.py | 4,235 | 3.703125 | 4 | #!/usr/bin/python
# -*- coding: utf-8
class CheckResult:
def __init__(self, coincides):
self.coincides = coincides
self.hor_location = 0
self.ver_location = 0
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
class Line:
def __init__(self, p1, p2):
... |
78fb3d6b9d1c8f80f3cc47d06e2ae89e6a3afb12 | junleqian/ThematicReviews | /BinaryTree/basics/traverals/preorder_iteration.py | 559 | 4.1875 | 4 | """
Given a binary tree, traverse the tree in preorder with no recursion.
"""
def preorderTraversal(root):
# initialize a stack
s = []
# push the root
s.append(root)
# while stack is not empty
while len(s) != 0:
# pop a node from the stack
node = s.pop()
# print the tra... |
3f08ad49052cebf0f2a1d2fbd0bea0b5a1f28b9b | akbarmurtaza/Python-chatbot-test | /chatbot.py | 1,828 | 3.5625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 30 17:42:42 2018
@author:
"""
def main():
print("Hello ! Welcome to tech support chatbot! Enter your query for an answer :")
print("Press 1 For Querying")
print("Press 2 To Exit")
while(1):
choice= input("Enter choice(From 1/2):")
if choi... |
f1ac7828fb0ad77fe49d3878e97dc1dcdbb13e84 | jackhong6/PHYS210 | /jackhong_assignment_3/array_stats.py | 2,163 | 3.875 | 4 | import numpy as np
# Create a 1D array of size 100 with numbers drawn uniformly from the interval [0,1)
a = np.random.random(100)
print(a)
# Calculate the mean of the elements of a
mean = np.sum(a) / a.size
# My calculated mean and the numpy mean agree. This is what I would expect.
print("My calculated mean: " + str(... |
7aef66da5eed0afc26a8b236ad7e2251db3f5910 | jackhong6/PHYS210 | /jackhong_assignment_7/monte_carlo1.py | 2,443 | 3.828125 | 4 | # PHYS 210 Assignment 7, Part 2: Monte Carlo methods
# Jack Hong, 30935134
# September 29, 2016
import numpy as np
def unit_circle_area1(n):
# Use the monte carlo method to calculate the area of a quarter of a circle
# This function uses two arrays to store the x and y coordinates.
x = np.random.random((n... |
acbb3848a6d91a932d16b2fbb3bca60f6f896a98 | jackhong6/PHYS210 | /jackhong_assignment_11/dictionaries.py | 412 | 3.90625 | 4 | # PHYS 210, Assignment 11: Part 1 - Dictionaries
# Jack Hong, 30935134
# October 13, 2016
def concatenate(a,b,c):
# Return a new dictionary by concatenating dictionaries a,b,c
concat_dict = a.copy()
concat_dict.update(b)
concat_dict.update(c)
return concat_dict
def exists(d,s):
# Return True i... |
491ae098e0694166851dc5780c6d0b4999030a25 | SidJain1412/Statistics | /Programs/StandardDeviation.py | 472 | 3.921875 | 4 | # Given an array of integers, calculate and print the standard deviation
# Your answer should be in decimal form, rounded to 1 decimal place
# Sample Input
# 5
# 10 40 30 50 20
# Sample Output
# 14.1
n = int(input())
numbers = list(map(int, input().split()))
# Finding mean
mean = sum(numbers) / n
# Calculating su... |
ef280f77fb6fabb3a7e642e86461c50da64c53b8 | dabaker6/Udacity-Intro-To-Data-Science | /Gradient Descent.py | 1,071 | 3.5625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 17 14:13:49 2017
@author: bakerda
"""
import numpy
import pandas
def compute_cost(features, values, theta):
"""
Compute the cost of a list of parameters, theta, given a list of features
(input data points) and values (output data points).
... |
91e1fbd10b260d621aa5a3f63ac02ad143863b59 | mounirdzdz/France-IOI | /Niveau 2/3 – Chaînes de caractères/2 - Chaînes complètes/b - Petites fiches et gros travail.py | 238 | 3.734375 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
titres = [None] * 6
auteurs = [None] * 6
for loop in range(6):
auteurs[loop] = input()
titres[loop] = input()
for loop in range(6):
print(titres[loop])
print(auteurs[loop])
|
1c38e0bfc8cd53a32b39a9942d13ac8e46a54f10 | mounirdzdz/France-IOI | /Niveau 3/4 – Opérations avancées sur les chaînes de caractères/1 - Tris/f - Lire ou ne pas lire, telle est (à nouveau) la question.py | 375 | 3.59375 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
nbLivres = int(input())
titresLivres = [None] * nbLivres
count = 0
for loop in range(nbLivres):
titresLivres[loop] = input()
count += 1
if loop == 0:
print(titresLivres[loop])
count = 0
elif titresLivres[loop] > titresLivres[loop - count... |
ee6ce29ceae5fd07d971efcec9ff47a4f09fb7bd | mounirdzdz/France-IOI | /Niveau 2/4 – Fonctions/10 - Distance euclidienne.py | 253 | 3.90625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from math import *
def distance_euclidienne(x1, y1, x2, y2):
return sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
print(distance_euclidienne(float(input()), float(input()), float(input()), float(input())))
|
934abb827f30773c494df27838da827433f3003a | mounirdzdz/France-IOI | /Niveau 3/4 – Opérations avancées sur les chaînes de caractères/1 - Tris/d - Trier des livres.py | 233 | 3.640625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
nbLivres = int(input())
titresLivres = [None] * nbLivres
for loop in range(nbLivres):
titresLivres[loop] = input()
titresLivres.sort()
for titre in titresLivres:
print(titre)
|
115e9ad44d18169b869384bdf2af5eabb7146c3f | mounirdzdz/France-IOI | /Niveau 2/3 – Chaînes de caractères/4 - Caractères/test.py | 297 | 3.890625 | 4 | nbNombre = int(input())
for loop in range(nbNombre):
num = int(input())
if num > 0:
print('+', end="")
else:
print('-', end="")
if num > 100:
print('>>>')
elif num > 50:
print('>')
elif num > 10:
print('>')
else:
print()
|
c6e6c1f6920d8ea90d4a2cbdcae33e36e4fdd53e | PariffinAxe/Week_3_Homework | /app/models/player.py | 911 | 3.75 | 4 | import random
class Player():
def __init__(self, player, choice=""):
self.player = player
self.choice = choice if choice != "" else random.choice(["Rock", "Paper", "Scissors", "Lizard", "Spock"])
if self.choice == "Scissors":
self.score = -2
self.method_1 = "Cuts"
... |
ca1194788df147969a9d486e1d801aab6b5854f6 | liuhuyydy/python_study | /basic/Hello_world.py | 1,315 | 4.28125 | 4 | #print函数为python显示函数,python3为关键字print加括号打印内容
#打印字符串(字符串:就是一系列字符。在python中用引号括起来的都是字符串,其中引号包括双引号和单引号)
print("Hello Python World")
#输出:Hello Python World
#print可以打印多个字符串,每个字符串用逗号隔开,打印结果会用空格隔开;
print("我","是","中","国","人")
#输出:我 是 中 国 人
#打印数字
print(123)
#输出:123
#变量,变量是指在程序运行时其值可以改变的量,变量的功能就是存储数据,
# Pyhton是动态语言(弱类型语言),所以不必像... |
2e9ff1457bb51e1a9e3bc3581ab6f99a5d541719 | andrestbr/price_tracker | /book_deals_db.py | 13,159 | 3.5 | 4 | """ A class that can be used to represent a database of book deals """
import pandas as pd
import numpy as np
from datetime import datetime
from pandas import DataFrame, Series
from book import Book
from book_db import BookDatabase
from book_prices_db import BookPricesDatabase
from amazon_product_page import AmazonP... |
198d4c775e10f67ae1c82b365a1281ce8604be3e | KatzeLiu/Python_100Days | /Day5/Prime.py | 203 | 3.828125 | 4 | import math
for num in range(1, 101):
is_prime = True
for factor in range(2, int(math.sqrt(num)) + 1):
if num % factor == 0:
is_prime = False
break
if is_prime:
print(num, end = ' ')
|
d2149781f54759bc221325571a969302a1f51162 | stephenplace/Disco_zoo_analysis | /Disco_functions.py | 2,042 | 3.609375 | 4 | import random
def list_two_animal_positions(animal_1,animal_2):
choices = []
for i in range(len(animal_1)):
Set1 = set(animal_1[i])
for j in range(len(animal_2)):
Set2 = set(animal_2[j])
if bool(Set1 & Set2) == False:
choices.append([i,j])
r... |
0b1c6de697f8797b5a3a679e128ca6d1d1e0e13a | jotagarciaz/Graphics-and-VR | /practica 3/tk_alfombra_sierpinski.py | 2,120 | 3.859375 | 4 | #editar, original en https://stackoverflow.com/questions/33970499/python-tkinter-coding-a-sierpinski-triangle-in-an-objective-orientated-method
import tkinter as tk
import math
class MainWindow(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self.title("Fractal")
self.width = 512
... |
7cb7e1c7bbeda5adf2952e9a74fd63dbfa6ababe | jotagarciaz/Graphics-and-VR | /practica 4/tk_lsystem.py | 4,577 | 3.859375 | 4 | import turtle
import tkinter as tk
from tkinter import ttk
import copy
import math
#X->F-[[X]+X]+F[+FX]-X
#F->FF
#w=X
#n=5
#alpha=90
#angle=22.5
class Aplicacion(tk.Tk):
def __init__(self):
self.ventana1=tk.Tk()
self.height = 512
self.width = 1000
self.margin = 20
self.ventana1.geometry('1000x800')
... |
2988135b6c86ff63025010794c2d5e860159d141 | rolika/rpc.py | /rpc.py | 7,146 | 4 | 4 | ### Reverse Polish Calculator
import math
### CLASSES ###
class Stack(list):
""" Object to realize & handle stack
Access to stack only through its methods """
def __init__(self):
""" Init stack as list """
super().__init__()
self.clear_stack()
def clear_stack(self):
... |
6561495ecc816a1c45ae736a1dacad04e4fc4288 | kyj0701/2020_Summer_Pyton | /2020.08/08.10~08.14/08.10/1281.py | 129 | 3.734375 | 4 | digits = str(n)
product = 1
sum = 0
for i in digits:
product = product * int(i)
sum = sum + int(i)
print(product - sum) |
9ee90f53e03f28704507b9520ba60970281c2cd6 | Elias-Yuri-Maximo/bat-game | /batter/game/handle_collisions_action.py | 3,536 | 3.515625 | 4 | import random
import sys
from typing import Text
from game.point import Point
from game import constants
from game.action import Action
class HandleCollisionsAction(Action):
"""A code template for handling collisions. The responsibility of this class of objects is to update the game state when actors col... |
798e90b984c18baece991049f99f47cbae01923a | VinzentM/Character-Distribution | /distribution.py | 2,641 | 4.125 | 4 | """
distribution.py
Author: Vinzent
Credit: Liam
https://github.com/TheBigBlueBlob/Character-Distribution/blob/master/distribution.py
Assignment:
Write and submit a Python program (distribution.py) that computes and displays
the distribution of characters in a given sample of text.
Output of your program sho... |
fe0ef95eff8a81e8a545e8297fcdad1591d21557 | tonberarray/datastructure-and-algrorithm | /线性表操作/链表/魔术师发牌问题.py | 2,590 | 4 | 4 | # 魔术师发牌问题
"""13张黑桃,魔术师发牌时不看牌面,总是能知道牌的点数。
扑克牌事先按照一定顺序排好,开始数牌,
第一张是1(黑桃A),牌面放到桌上,
然后往下数时,最上面的牌放在牌堆最下面,
数到二,牌面为2,放到桌上,
如此循环,直到最后一张13(黑桃K)"""
class Node(object):
"""docstring for Node"""
def __init__(self, val=None):
self.val = val
self.next = None
self.visited = False
class LinkList(object):
"""docstring for... |
899c595ee2e9167275b0063e0d4838ac5ce91c4a | tonberarray/datastructure-and-algrorithm | /线性表操作/链表/链表1.py | 1,468 | 3.921875 | 4 | # 链表实现
class IntNode(object):
"""docstring for IntNode"""
def __init__(self, i, n):
self.item = i
self.next = n
class SLList(object):
"""docstring for SLList"""
def __init__(self, x):
self.__first = IntNode(x, None)
self.__size = 1
def add_first(self, x):
self.__first = IntNode(x, self.__first)
s... |
9f3d3dd8dc91be6f54be30371e3bc5cf4bf0bf8a | tonberarray/datastructure-and-algrorithm | /递归和动态规划/八皇后问题.py | 1,056 | 3.9375 | 4 | # 八皇后问题,递归实现
"""在8×8的国际象棋棋盘上,摆放八个皇后,
并且每一行每一列每一斜线方向只能有一个皇后,
保证皇后不能相互攻击,总共有多少种摆法"""
# def drop_place(pos,status):
# nextY = len(status)
# for i in range( nextY ):
# if abs(status[i] - pos ) in (0, nextY - i ):
# return True
# return False
# def queens(num=8, status=[] ):
# for pos in range(num):
# if not... |
d646f1663f116ae202333a6ea97e577432ea9436 | cosmas28/business-connect-v1 | /app/models/business.py | 6,539 | 3.84375 | 4 | """Demonstrate all business functionalities.
This module provides methods that will enhance the business operations
such as business registration, business updates, deleting business and
view registered businesses.
"""
class Business(object):
"""Illustrate methods to manipulate business data.
Attributes:
... |
62e5aba9892cc360168699a1ebd38c5ce993512f | joszko/Python-Traning | /Image Processing/capturing video/capture.py | 635 | 3.53125 | 4 | import cv2
import time
# reading frames one by one
# cv2.VideoCapture() - first parameter index of camera or file path to the movie file
video = cv2.VideoCapture(0)
a = 1
while True:
a = a +1
# check is boolean
# frame is the first image captured by the camera
check, frame = video.read()
gray = ... |
9b821e42ef00d8f24f7ae7882cd05cdd4a3cc97e | joszko/Python-Traning | /Maps with Folium/Map with markers from txt file.py | 1,073 | 3.578125 | 4 | import folium
import pandas
# creating pandas data frame from txt file
df = pandas.read_csv('.\\Maps with Folium\\Volcanoes-USA.txt')
# creating map
# finding the center location for the map using the values from the input file
# it's equal to average latitude and average longitude
map = folium.Map(location=[df['LAT'... |
abcc1e16fc06d2f2fd2c95a42bcdd6a95e1b362a | gaurav-adhikari/Algorithms-and-Data-structures-using-python | /DeQueuePalindromeChecker.py | 1,011 | 4.25 | 4 | # An implementation of DeQueues for checking either a given word is palindrome or not
# Importing the custom built DeQueue from another module
from DeQueueImplementation import DeQueue
# CheckPalindrome function implementation
def checkPalindrome(myWord):
myQueue = DeQueue()
for char in myWord:
myQ... |
48f7d2953e7020518420de6ba189ddc6f62bc4c7 | stanleysh/wdi_multilinguist | /multilinguist.py | 3,630 | 3.8125 | 4 | import requests
import json
from random import randint
class Multilinguist:
"""This class represents a world traveller who knows
what languages are spoken in each country around the world
and can cobble together a sentence in most of them
(but not very well)
"""
translatr_base_url = "http://bitmakertrans... |
fc3f5209317ce4fa11b2a1ef66ed545e10e93b24 | soniasankpal/code-20211001-soniyasankpal | /soniya_vamstar.py | 1,337 | 3.640625 | 4 | import json
class Data:
def loadData(self):
input_file = open ('person.json')
json_array = json.load(input_file)
return (json_array)
def calculateHealthStatus(self,json_array):
Overweight_people=0
for person in json_array:
BMI=person['WeightKg']/(person['HeightCm']/100)
if(BMI<=18.4):
... |
9114907dd9eb0f350f30d9987b71cf111bbe5285 | Jason003/interview | /Amazon/Path With Maximum Minimum Value.py | 1,850 | 4 | 4 | '''
Given a matrix of integers A with R rows and C columns, find the maximum score of a path starting at [0,0] and ending at [R-1,C-1].
The score of a path is the minimum value in that path. For example, the value of the path 8 → 4 → 5 → 9 is 4.
A path moves some number of times from one visited cell to any neigh... |
e7d25c9943b30c2c157491772e22973d73cb624f | Jason003/interview | /linkedin/Rotate(Reverse) List.py | 1,159 | 3.90625 | 4 | # Definition for singly-linked list.
class ListNode:
def __init__(self, x=None):
self.val = x
self.next = None
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
dummy = ListNode()
dummy.next = head
curr = head
while curr and curr.next:
... |
48f99b88c24deef361af2a6c663a224c57472cd4 | Jason003/interview | /extractCertainNodesFromTree.py | 833 | 3.640625 | 4 | class TreeNode:
def __init__(self, val, selected=False):
self.val = val
self.selected = selected
self.children = []
def __str__(self):
return str(self.val) + ' ' + str(self.children)
def __repr__(self):
return str(self.val) + ' ' + str(self.children)
def getNewTree(r... |
f95a2f7b8024ecadc750a91bed4e9e31f8229979 | Jason003/interview | /smallest common number in n arrays.py | 551 | 3.734375 | 4 | def smallest_common_number(lists):
for l in lists:
l.sort()
n = len(lists)
pointers = [0] * n
while all(pointers[i] < len(lists[i]) for i in range(n)):
mx = max(lists[i][pointers[i]] if pointers[i] < len(lists[i]) else -float('inf') for i in range(n))
flag = True
for i in... |
6ba2f021893c9a83e5ce9f41bae195323095f1ee | Jason003/interview | /linkedin/Merge k Sorted Lists.py | 605 | 3.703125 | 4 | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
heap = [(head.val, i, head) for i, head in enumerate(lists) if head]
dummy = ListNo... |
e25e7f5719a554b5168e2bbdfca9a748b996b1d7 | Jason003/interview | /Amazon/Largest BST Subtree.py | 1,691 | 3.984375 | 4 | '''
Given a binary tree, find the largest subtree which is a Binary Search Tree (BST), where largest means subtree with largest number of nodes in it.
Note:
A subtree must include all of its descendants.
Example:
Input: [10,5,15,1,8,null,7]
10
/ \
5 15
/ \ \
1 8 7
Output: 3
Explanation: The Largest... |
8c712ab7da3a8349575e9cc709d4408d9a8e3f85 | Jason003/interview | /Akuna/shortest path.py | 812 | 3.84375 | 4 | import collections
def shortestPath(edges, start, end):
graph = collections.defaultdict(set)
for i, j in edges:
graph[i].add(j)
dq = collections.deque([start])
prev = {} # record previous node in the shortest path
seen = {start}
while dq:
curr = dq.popleft()
for neigh in ... |
e097c5a54a525c01a032a3bd524cc12f6eb0c697 | Jason003/interview | /linkedin/Best Meeting Point.py | 1,071 | 4.15625 | 4 | '''
A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the group. The distance is calculated using Manhattan Distance, where distance(p1, p2) = |p2.x - p1.x| + |p2.y - p1.y|.
Example:
Input:
1 - 0 - 0... |
253ee498e787d3526ca530363663962650ff0358 | Jason003/interview | /Amazon/Find target word.py | 749 | 3.859375 | 4 | '''
given list of tuples: [("a", "b"), ("b", "c".....] and a target word: "hello", 要 求 判 断 能 否 ⽤ tuples 的 字 母 组 成 target 。 每 个 tuple 只 能 ⽤ ⼀ 次 , tuple ⾥ 两 个 字 母 是 ⼆ 选 ⼀。
'''
import collections
def targetWord(l, word):
ch2idx = collections.defaultdict(set)
for i, t in enumerate(l):
ch2idx[t[0]].add(i)
... |
2019b8fdb525ba2540a93532a60501436a43532c | Jason003/interview | /linkedin/Flatten Nested List Iterator.py | 2,326 | 3.796875 | 4 | import collections
class NestedIterator(object):
def __init__(self, nestedList):
"""
Initialize your data structure here.
:type nestedList: List[NestedInteger]
"""
self.dq = collections.deque(nestedList)
def next(self):
"""
:rtype: int
"""
... |
d897f3e333589badf54375b8f3e08c503776a4bd | Jason003/interview | /databricks/Closest Leaf in a Binary Tree.py | 1,107 | 3.671875 | 4 | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
import collections
class Solution:
def findClosestLeaf(self, root: TreeNode, k: int) -> int:
graph = collections.defaultdict(set)
leaves = set()
... |
9594f297e2eed28f286837cc6fa4a613bf80dd96 | Jason003/interview | /Bloomberg/Word Break II.py | 1,466 | 3.640625 | 4 | '''
There are several ways to improve the naive dfs method:
(1) memo using hashmap (like the one above)
(2) DP
(3) preprocess the string using word break I DP array to determine whether to go on or not
(4) precompute the max length of all words in the dictionary to reduce the number of recursive calls.
These are all go... |
9af31be00a117ddae3fdfc5a3f20a734fd8ece75 | ryan-borthwickhoff/Intro-Database-Management--FALL2018- | /HW5/RH_Reducer_HW5.py | 3,140 | 3.65625 | 4 | #!/usr/bin/python
import sys
wordcount = {}
contain_word= 0
current_word= None
for l in sys.stdin:
l = l.strip() #Removes whitespace around each word
word, count = l.split('\t', 1) #Splits up the word and counts
count = int(count)# Converts each count for the words to an int from an str
if current_word... |
c0bfcf0ade52b6d70fc4d36612e0f4ace983fc0c | samuel-c/SlackBot-2020 | /venv/Lib/site-packages/pyowm/abstractions/linkedlist.py | 2,323 | 4.3125 | 4 | """
Module containing abstractions for defining a linked list data structure
"""
from abc import ABCMeta, abstractmethod
class LinkedList(object):
"""
An abstract class representing a Linked List data structure. Each element
in the list should contain data and a reference to the next element in the
l... |
97e6a12ca66c3681174510ae733cb2aaa961273c | Angela-Mari/CPSC322-Final-Project | /mysklearn/myclassifiers.py | 26,763 | 3.578125 | 4 | import mysklearn.myutils as myutils
import numpy as np
from numpy.random import MT19937
from numpy.random import RandomState, SeedSequence
import math
import operator
import random
import mysklearn.myevaluation as myevaluation
class MySimpleLinearRegressor:
"""Represents a simple linear regressor.
Attributes... |
cb9e33e98eec929f547b6c558f61ff0a0289f631 | egreenfield/soc | /life/main.py | 8,231 | 3.96875 | 4 | from dataclasses import dataclass
from typing import Tuple
import pygame
from pygame.locals import *
CELL_SIDE=10
DRAW_SIDE=CELL_SIDE-4
SCREEN_SIDE=500
#---------------------------------------------------------------------------
#
# Defining your data
#
#----------------------------------------------------------------... |
d6f7e118af80a6cb4cecc22e636a5690bbd7a736 | Tyresius92/rosetta-code | /bottles-o-beer/bottles_o_beer.py | 570 | 3.828125 | 4 | num = 99
no = "No more"
one_bottle = " bottle of beer"
bottles = " bottles of beer"
wall = " on the wall"
take = "Take one down, pass it around"
while num > 0:
print(str(num) + bottles + wall)
print(str(num) + bottles)
print(take)
num -= 1
if num == 1:
print(str(num) + one_bottle + wall + '... |
00181c801ddea1fc79ed8e25a0404a058f7987e9 | akyyev/My_python | /day09_arrays_maps_compress/__init__.py | 306 | 3.796875 | 4 | # Read a 2D list of integers:
NUM_COLUMN = 5
NUM_ROWS = 3
a = [[0]*NUM_COLUMN]*NUM_ROWS
print(a)
NUM_ROWS = int(input().split()[0])
a = [[int(j) for j in input().split()] for i in range(NUM_ROWS)]
c = int(input())
for i in range(len(a)):
for j in range(len(a[i])):
a[i][j] *= c
print(a)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.