blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string |
|---|---|---|---|---|---|---|
c5b282c0e2dd1cc489376c4112cb3ae28d839b76 | jzuver/QueryParser | /main.py | 2,046 | 3.734375 | 4 |
from parserFunctions import *
import data
import os.path as path
def main():
print("enter: help \n or load data and begin query")
keepRunning = True
# loop to allow for as many queries as desired, will run until user types quit
while keepRunning:
# get user input
userInput = input(... |
5e5e9906b5d17791a55540d08255dabfe2e8d1d0 | Meghana86/CodeInPlace | /Assignment2/Assignment2/nimm.py | 1,681 | 4.125 | 4 | """
File: nimm.py
-------------------------
Add your comments here.
"""
"""
def main():
NO_OF_STONES=20
player_no=1
while NO_OF_STONES>0:
print("There are "+ str(NO_OF_STONES) + " stones left")
remove=int(input("Player "+ str(player_no)+" would you like to remove 1 or 2 stones? "))
... |
806412b31ef178089ec348de67c75a6a1b2a6ea0 | larissalages/code-selection | /numbers.py | 349 | 3.90625 | 4 | def print_numbers():
str_result = ""
for i in range(100):
if (i % 3 == 0 and i % 5 == 0):
print "ThreeFive"
str_result += "ThreeFive\n"
elif (i % 3 == 0):
print "Three"
str_result += "Three\n"
elif (i % 5 == 0):
print "Five"
str_result += "Five\n"
else:
print str(i)
str_result += str... |
15a2e353efb571af76e5652543a50937243167f2 | Hedgehuug/python_30 | /day2/exercise.py | 1,047 | 4.4375 | 4 | """
Generate a sequence using the function range that
returns the following.
[-100, -90, -80, -70, -60, -50, -40, -30, -20, -10, 0,
10, 20, 30, 40, 50, 60, 70, 80, 90]
"""
sequence_one = list(range(-100,91,10))
print(sequence_one)
"""
Generate the previous sequence but in this case in
the opposite way.
"""
sequence_r... |
195429afd6dc06f0d0844708380beaff9bc318e7 | codud0954/megait_python_20201116 | /02_condition/quiz03/quiz03_3.py | 169 | 3.84375 | 4 | bmi = int(input("bmi 수치를 입력하세요: "))
if bmi <= 10:
print("정상")
elif bmi <= 20:
print("과체중")
elif bmi > 20:
print("비만")
|
cc99de424e99d00b7b5d7a4633f08226bd556053 | RahulGusai/data-structures | /python/problem-solving/rotateMatrix.py | 1,911 | 4 | 4 | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the matrixRotation function below.
def matrixRotation(matrix, r):
rows = len(matrix)
columns = len(matrix[0])
ret = False
count = 0
n = 0
while( n<rows):
if( ret==False):
rotations = (colum... |
a87bb2695dccd8706d6076eb64afa3b4af478ec5 | Vagacoder/Codesignal | /python/InterviewPractice/Array01FirstDuplicate.py | 1,796 | 3.578125 | 4 | #
# * Interview Practice, Arrays 01, First Duplicate
# * Easy
# * Given an array a that contains only numbers in the range from 1 to a.length,
# * find the first duplicate number for which the second occurrence has the minimal
# * index. In other words, if there are more than 1 duplicated numbers, return
# * the nu... |
7fcdc1d0d73870adcb0c932c5dd3603eb0603629 | grahamrichard/COMP-123-fall-16 | /PycharmProjects/Sept26/inclass.py | 2,785 | 3.625 | 4 | # Part 1
x = 25
y = 30
s = 'boolean'
print(x <= y) #True
print(x + 5 > y) #False
print(x % 2 == 0) #False
print(s > 'bodwaddle') #True
print(len(s) ==7) #True
print('e' in s) #True
print('c' in s) #False
print('boo' in s) #True
print(True == ... |
2b3fa8f41d16606779e3aaa843392c764d24abbd | JUNE001/offer-python | /KMP.py | 417 | 3.546875 | 4 | # coding=utf-8
#通过计算,返回子串T的next数组
def get_next(T):
i = 1#后缀
j = 0#前缀
a = []
a.append(0)
while i < len(T):#T[0]表示T的长度
print(i)
if j == 0 or T[i-1] == T[j-1]:
i += 1
j += 1
a.append(j)
else:
j = a[j-1]
return ... |
955ca7dd7b1b52cf158b31ee88d1a21104074d94 | linshizuowei/LeetCode | /paralle_link.py | 974 | 3.8125 | 4 | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if not head or not head.next:... |
eec9b1554a50bfc6f4d90f716b08219e17476e70 | vijayroykargwal/Infy-FP | /DSA/Day5/src/Excer21.py | 1,281 | 4.125 | 4 | #DSA-Exer-21
'''
Created on Mar 19, 2019
@author: vijay.pal01
'''
def merge_sort(num_list):
# Remove pass and write the logic here to return the sorted list
low = 0
high = len(num_list)-1
if(low==high):
return num_list
else:
mid = len(num_list)//2
l_list = ... |
a4f0554cef3427981f1bd8257d1bda7b3830718a | vitorczz1/Curso-Python-MIT | /Parte 2/p1_1.py | 255 | 3.671875 | 4 | interest_rate = 1 #100%
out = 2 #tempo
if (interest_rate != 0):
aux = 0
while (out <= 2):
out = out * (1 + interest_rate)
aux = aux + 1
out = aux
print(out)
if (interest_rate == 0):
out = ("NEVER")
print(out) |
014f45e0e6c70dd98473bf7f18f137bca360eb4e | s87217647/PyCharm_Projects | /ShangAn/FindKthLargest.py | 792 | 3.640625 | 4 | from typing import List
class FindKthLargest:
def findKthLargest(self, nums: List[int], k: int) -> int:
return self.quickSelect(nums, 0, len(nums) - 1, k)
def quickSelect(self, nums, lo, hi, k):
if lo >= hi:
return
mid = self.partition(nums, lo, hi, k)
if mid == len(... |
30a47bf110dcc34794a0e12c4345760ec22637c1 | ApostolosZezos/Year9DesignCS-PythonAZ | /TakingInputInt.py | 329 | 4.09375 | 4 | #Input
#Assignment Statement
r = input("What is the radius: ")
r = int(r)
#Casting is the process of changing type
#Strings - collections of characters
#int - integers
#float - numbers with decimals
h = input("What is the height: ")
h = int(h)
#Process
sa = (2 * (3.14) * r * h) + (2 * (3.14) * (r * r))
#Output
pr... |
4009867376493414193a52c15975866f6d903a60 | haruyasu/improve_python | /divisor_prime.py | 925 | 3.96875 | 4 | # coding: utf-8
# divisor 約数列挙
def make_divisor_list(num):
if num < 1:
return []
elif num == 1:
return [1]
else:
divisor_list = []
divisor_list.append(1)
for i in range(2, num // 2 + 1):
if num % i == 0:
divisor_list.append(i)
div... |
5f8f0fa483539e3a36cc5c98ba79dac23a4bcd21 | JonSolo1417/Python | /fundamentals/fundamentals/basic_functions_2.py | 877 | 3.734375 | 4 | def countdown(num):
arr=[]
for x in range(num,-1,-1):
arr.append(x)
return arr
print(countdown(5))
def printAndReturn(num1,num2):
print (num1)
return num2
x =printAndReturn(5,10)
print("This is x: " + str(x))
def firstPlusLength(arr):
return arr[0] + len(arr)
sum = firstPlusLength([1... |
1e69e23061cc17cbdc47fcf6a1c203260bcd2d4a | Saipraneeth1001/webcrawler | /mark6/general.py | 1,426 | 3.625 | 4 | # what this file basically consists of is functions to add the obtained data into the file
# functions to delete the files
# function to create the project directory
import os
def create_project(directory):
if not os.path.exists(directory):
print("creating directory" + directory)
os.makedirs(dire... |
d93401a8edaf55d6c1993cf0f057f7d0ed606abc | xuyinhao/test_study | /4dict/4dict_test.py | 893 | 3.84375 | 4 | #字典 dict 映射mapping
#1.创建字典
# dstr={'a':'1','b':'2','c':'3'}
# print(dstr['b'])
#
# dstr1=[('name','gab'),('age',24)]
# ndstr1=dict(dstr1)
# print(ndstr1)
#
# dstr2=dict(name='gg',age=23)
# print(dstr2)
#2.基本字典操作
# print(len(dstr2)) #len(d) 键值对个数
# print(dstr2['name']) #特定键 对应的value
# dstr2['sex']='man... |
cb768ad889997bbbe64f2a40605d12ced6b4dd52 | ChengHsinHan/myOwnPrograms | /CodeWars/Python/8 kyu/#253 Sum without highest and lowest number.py | 646 | 3.53125 | 4 | # Task
# Sum all the numbers of a given array ( cq. list ), except the highest and the
# lowest element ( by value, not by index! ).
#
# The highest or lowest element respectively is a single element at each edge,
# even if there are more than one with the same value.
#
# Mind the input validation.
#
# Example
# { 6, 2... |
7c655519c6ae9eef41c00977e057cf577c24d028 | Dzhano/Python-projects | /nested_loops/cinema_tickets.py | 905 | 3.796875 | 4 | all_seats = 0
student_seats = 0
standard_seats = 0
kid_seats = 0
movie_name = input()
while movie_name != "Finish":
taken_seats = 0
counter = 0
seats = int(input())
type_seat = input()
while type_seat != "End":
counter += 1
all_seats += 1
taken_seats += 1
if type_seat... |
ecabf9541e40a6b20b598e5c8b45cca26d24cb14 | Code360In/oracle-july20 | /day_02/labs/lab_01_participant_solutions.py | 3,407 | 3.703125 | 4 | From Suvarchala Alamur to Everyone: 11:43 AM
Hi Purushotam
N=(1,2,3,4,5,6,7,8,9,10)
for i in N:
print(5, "X", i, "=", 5*i)
o/p for the above code came as
5 X 1 = 5
5 X 2 = 10
5 X 3 = 15
5 X 4 = 20
5 X 5 = 25
5 X 6 = 30
5 X 7 = 35
5 X 8 = 40
5 X 9 = 45
5 X 10 = 50
From Saumya Tripathi to Me: (Pr... |
f09e0df6ab73916b90887a566dc1bab89a824f1a | indraastra/nn-ocr | /archive/cjk_utils.py | 718 | 3.609375 | 4 | import random
CJK_START = 0x4E00
CJK_END = 0x9FD5
numbers = '零一二三四五六七八九'
def random_glyph():
'''Returns a character in the unified CJK range.'''
return chr(random.randrange(CJK_START, CJK_END))
def random_decimal_glyph():
'''Returns a single-digit number.'''
return random.choice(numbers)
def glyphs... |
ebcec35b39afe7d90de1fdb240dc2513c7c79f0f | AvengerDima/Python_Homeworks | /Homework_1(1-6).py | 2,419 | 4.125 | 4 | import math
#Задача №1
print("Задача №1 \n Задание: Найти результат выражения для произвольных значений a,b,c: a + b * ( c / 2 ) \n Решение:")
a = 2
b = 4
c = 6
decision = a + b * (c / 2)
print(" a = %d; b = %d; c = %d; \n a + b * (c / 2) = %d \n" % (a, b, c, decision))
#-----------------------------------------------... |
7537ac2ffd73eed82b7d30e07ff3370098575a5e | wiput1999/PrePro60-Python | /Onsite/Week1/percent_f.py | 233 | 3.78125 | 4 | """ %d """
def main():
""" Display string """
text = float(input())
print("|%.2f|" %(text))
print("|+%.2f|" %(text))
print("|%10.2f|" %(text))
print("|%-10.2f|" %(text))
print("|%010.2f|" %(text))
main()
|
b9bdbd13dbf7d3ab93e1447b550ea321dbffaf40 | cooldld/learning_python_4th | /ch25_class_tree2.py | 614 | 4.0625 | 4 | class C2: pass
class C3: pass
class C1(C2, C3):
def setname(self, who):
self.name = who #对特殊参数self做赋值操作,可以把属性添加到实例中
print('I1 = C1()')
I1 = C1()
'''
error!!!
AttributeError: 'C1' object has no attribute 'name'
print('I1.name =', I1.name)
'''
print("I1.setname('bob')")
I1.setname('bob')
print('I1.name =... |
cbd4017e7a093e11d5ee99d82429ef42ad450fae | zzq5271137/learn_python | /18-装饰器/07-wraps.py | 1,798 | 4.125 | 4 | """
wraps装饰器
"""
from functools import wraps
def greet(func):
def wrapper(*args, **kwargs):
print('func start execute')
func(*args, **kwargs)
print('func end execute')
return wrapper
"""
下面的代码, 在add()函数上加上@greet装饰器, 等价于以下这种写法:
def add(x, y):
print('%d + %d = %d' % (x, y... |
8c966bb63a0fd3c19e92806e89c4d9c25948948c | Darshonik/saturday_python | /ideone_hUGooX.py | 233 | 3.71875 | 4 | for i in range(1,4):
for j in range(2,i-1,-1):
print(" "),
for k in range(0,(2*i-1),+1):
print("*"),
print
for i in range(2,0,-1):
for j in range(2,i-1,-1):
print(" "),
for k in range(0,(2*i-1),+1):
print("*"),
print |
7a5f54322d24fccdac558d61be0ace5ad8b2c513 | ChandrashekharIyer/MovieRec-2.0 | /rate.py | 3,491 | 3.546875 | 4 | from Tkinter import *
import csv
import time
import tkMessageBox
import operator
import recom
'''rating'''
def csv_to_list(csv_file, delimiter=','):
"""
Reads in a CSV file and returns the contents as list,
where every row is stored as a sublist, and each element
in the sublist represents 1 cell in t... |
790fdcc6b026f61abdd7145c4b18ff94211114c9 | alixoallen/todos.py | /dissecando numero.py | 286 | 3.96875 | 4 | numero=int(input('qual o numero vai digitar ?'))
u=numero//1%10
d=numero//10%10
c=numero//100%10
m=numero//1000%10
print('sua unidade é de {}'.format(u))
print('sua dezena é de {:.0f}'.format(d))
print('sua centena é de {:.0f}'.format(c))
print('seu milhar é de {:.0f}'.format(m))
|
c0e3411d9f998d99eff349aaf124106506997f42 | peterashwell/python-dpath | /dpath.py | 2,008 | 3.9375 | 4 | def dpath(dikt):
"""Helper to create a DPath that is nice to read e.g. dpath(my_dict)['a', 'b']
:param dikt: Dictionary to wrap in DPath
:return: A DPath object
"""
return DPath(dikt)
class DPath:
"""dpath is a tool for navigating multidimensional map structures easily
>>> from pprint imp... |
800fb7229f9882a24f22e6ad53b3327075d504ca | ksilberbauer/coderdojo-python | /exercises/ex3.py | 600 | 4.3125 | 4 | secret_word = input("Enter a secret word:")
guess = ""
guessed_letters = ""
correct_letters = ""
emergency_break = 0 # you'll thank me later ;)
# TODO: the goal is to ask the user to guess each letter in the secret_word, one at a time
for letter in secret_word:
while guess is not letter and emergency_break < 100:... |
fd75c7d25279ae736c29af155608b17c4f9294cb | alextickle/zelle-exercises | /ch9/vball.py | 2,825 | 3.921875 | 4 | # vball.py
import random
import math
def main():
printIntro()
n, probA, probB = getInputs()
winsA, winsB = simNGames(n, probA, probB)
printSummary(winsA, winsB)
def printIntro():
print "This program simulates a game of volleyball between two players A and B"
print "with given serve win probabilities."
def getI... |
13bc33f51ed822bb7e5b4af8dac6cf7d00eda048 | 26XINXIN/leetcode | /212_word_search_2.py | 2,038 | 3.640625 | 4 | class Solution:
def __init__(self):
pass
def findWords(self, board, words):
"""
:type board: List[List[str]]
:type words: List[str]
:rtype: List[str]
"""
self.n = len(board)
if not self.n:
return []
self.m = len(board[0])
... |
010805bbbd7131ffa996d4111f0e0cdc0781a281 | SrikanthreddyR/BasicPythonPrograms | /computing paradox.py | 462 | 3.546875 | 4 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 12:52:23 2019
@author: Admin
"""
n=int(input())
songs_list=input();
songs_list=list(map(int,songs_list.split()))
fav_song_pos=int(input())
fav_song=songs_list[fav_song_pos-1]
#print(fav_song,"fav song")
sorted_list=songs_list.copy()
#print(sorted_list,"cpopied"... |
80e59af89ade57971e7838b66333c0b7858596e4 | nullscc/pythoncode | /print.py | 149 | 3.59375 | 4 | #!/usr/bin/python
A = input("input A:")
B = input("input B:")
print(A)
print(B)
sum = A+B
print(sum)
print('A+B =', A+B)
print('你好,python')
|
872ab905861ad57b2a2e1a55a5126066e2517b43 | BlairBejan/DojoAssignments | /Python/printnames.py | 1,280 | 3.96875 | 4 | def printnames(x):
for i in range(len(x)):
name = ""
for val in x[i].itervalues():
name += val + " "
print name
# printnames([
# {'first_name': 'Michael', 'last_name' : 'Jordan'},
# {'first_name' : 'John', 'last_name' : 'Rosales'},
# {'first_name' : 'Mark', 'last... |
183fb9ae59b0e84ca73aa33a8005c75f41d2ef7d | zpinto/learn-git-with-hack | /problems/problem1/tester1.py | 474 | 3.78125 | 4 | from answer1 import Solution
reverse = Solution().reverse
testcases = [(123, 321), (-123, -321), (120, 21)]
print("Running Unit Tests for Problem 1:\n")
correct_count = 0
for case in testcases:
result = reverse(case[0])
print("Input: " + str(case[0]))
print("Output: " + str(result))
print("Expected... |
311e1318e18feeab6083303d0651ef9482382c2c | dunitian/BaseCode | /python/1.POP/1.base/03.3.elif.py | 422 | 3.6875 | 4 | input_int = int(input("请输入(1-7)"))
# if后面的:,tab格式,else if 现在是elif
if input_int == 1:
print("星期一")
elif input_int == 2:
print("星期二")
elif input_int == 3:
print("星期三")
elif input_int == 4:
print("星期四")
elif input_int == 5:
print("星期五")
elif input_int == 6:
print("星期六")
elif input_int == 7:
pr... |
0495d51899205b08c72438547135b25804c31dd9 | s10th24b/DNN_study | /practice/16_StackedRNNWithSoftMaxLayer.py | 5,274 | 3.5 | 4 | # 이전 15강 LongLong에서는 RNN이 하나밖에 없었다. 그래서 정확도가 낮았음
# 이제는 RNN을 쌓아서.
# Cell을 추가. MultiRNNCell
import tensorflow as tf
import numpy as np
import pdb
import sys
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
# 하지만, 만약에 엄~청나게 긴 문자열이라면?
sentence = ("if you want to build a ship, don't drum up people together to collect wood... |
52fe7ccdea8a83ad99880d8f7f4c3e2901fa5154 | Uttam1982/PythonTutorial | /14-Python-Advance/06-python-regex/04-Match-Object/01-Match-Methods/01-Match-Object.py | 660 | 4.15625 | 4 | # Match Object Methods and Attributes
#--------------------------------------------------------------------------------------------
# As you’ve seen, most functions and methods in the re module return a match object
# when there’s a successful match. Because a match object is truthy, you can use it
# in a conditiona... |
1c4a158e8eb1b5b46874bd978c995d794fd25b47 | liquse14/MIT-python | /python교육/Code05-11.py | 594 | 3.828125 | 4 | select,answer,numStr,num1,num2=0,0,"",0,0
select= int(input("1.입력한 수식 계산 2.두 수 사이의 합계:"))
if select ==1:
numStr=input("***수식을 입력하세요:")
answer=eval(numStr)
print("%s결과는 %5.1f입니다."%(numStr,answer))
elif select==2:
num1=int(input("***첫번째 숫자를 입력하세요:"))
num2=int(input("***두번째 숫자를 입력하세요:"))
... |
a9a86c29f19171d12fe281254da5ed7a1ec90366 | Kharya3/algo | /merge.py | 814 | 3.578125 | 4 | def merge(a, b, c):
m = len(b)
l = len(c)
cnt = 0
i = j = k = 0
while i < m and j < l:
if b[i] <= c[j]:
a[k] = b[i]
i+=1
else:
a[k] = c[j]
j+=1
cnt+=m-i
k+=1
while j < l:
a[k] = c[j]
j+=1
... |
443041bcbb1ef4e90adf2017114a6279944f5832 | mgokani/RH | /print_pairs.py | 1,140 | 4.1875 | 4 | """@author: Mirav Gokani
Program that prints pairs of numbers that sum up to n
for example: Given list of numbers 4, 1, 3, 5, 2, 6, 8, 7
Print pairs of numbers whose sum equals 8
>>> pairs([4, 1, 3, 5, 2, 6, 8, 7], 8)
array([[1, 7],
[2, 6],
[3, 5]])
"""
import numpy as np
def pairs(arr1, num):
"""Re... |
a2ead2b560d0f1dddae844a9662b019b99daf0a2 | GermanSumus/Algorithms | /largest_prime_factor.py | 708 | 3.890625 | 4 | '''
# 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
'''
def largest_prime(n):
def factors(n):
result = set()
for i in range(1, int(n ** 0.5) + 1):
div, mod = divmod(n, i)
if mod == 0:
result |=... |
f0919c93196cc36c4f2c90b59baf518cb9b11b89 | bennyfungc/PROJECT-LRN2L337 | /MergeInterval/mergepairs.py | 706 | 3.71875 | 4 | # Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
def star... |
28d6aa1032cefd362da7b2091bddc35714c34e46 | sikorskaewelina/Programowanie_w_data_science_podstawy | /zad12.py | 574 | 4.0625 | 4 | """
12. Utworzyć skrypt z interfejsem tekstowym obliczający n-ty element ciągu Fibonacciego
- wykonać zadanie iteracyjnie i rekurencyjnie
"""
def fib_iteracyjny(x):
pwyrazy = (0, 1)
a, b = pwyrazy
while x > 1:
a, b = b, a + b
x -= 1
return x
x = int(input('Podaj, który element ci... |
9d32dc93779baf8f337c064f27fdce4b2e8cfbaf | ACENDER/LeetCode | /A01/830.较大分组的位置.py | 637 | 3.71875 | 4 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @File : 830. 较大分组的位置.py @Time : PyCharm -lqj- 2021-1-5 0005
from typing import List
class Solution:
def largeGroupPositions(self, s: str) -> List[List[int]]:
l = list(s)
res = []
n, num = len(l), 1
for i in range(n):
if... |
9103912693778aa9f55b56f1584831b4127a072b | romanvoiers/Python | /Lists.py | 521 | 4.3125 | 4 | # can be used as an inventory system
friends = ["Mike", "John", "Don", "Roman", "Maria"]
print(friends[1]) # Shows a specific element by index. Goes by 0,1,2....
print("I hate " + friends[2])
print(friends[-1]) # Negatives pick from the back of the list
print(friends[3:5]) # Takes a range. First number inclusive se... |
133df5cf96f8bb3dd7128757702f2e2a62d62584 | smanjil/PigLatinTranslator | /pig_latin.py | 2,580 | 3.984375 | 4 | __author__ = 'ano'
class PigLatin:
def __init__(self):
self.choice = raw_input("Enter \n(1) to translate a single word \n(2) to translate a sentence \n(3) to translate word containing hyphens: ")
if self.choice == '1':
self.plainText = raw_input("\nEnter plaintext word : ")
#print self.plaintext
print s... |
9b0c8380485399bd8bb2e9ad41b9c23bd748d226 | geoffreynyaga/leetcode-challenges-python | /6 move zeros.py | 1,079 | 3.796875 | 4 | """Given an array nums, wriall 0's to tte a function to move he end of it
while maintaining the relative order of the non-zero elements.
Example:
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Note:
You must do this in-place without making a copy of the array.
Minimize the total number of operations."""
class Solution:
... |
c61e0bcb51dd2fa13fcc80123a913b2cce1e4bd4 | esix/competitive-programming | /e-olymp/~contest-9716/D/main.py | 82 | 3.65625 | 4 | #!/usr/bin/env python3
import re
s = input()
print(len(re.findall(r"\w+", s))) |
09892465db18059bbaf2d1b41f9bbc13786130d8 | LichAmnesia/LeetCode | /python/203.py | 937 | 3.734375 | 4 | # -*- coding: utf-8 -*-
# @Author: Lich_Amnesia
# @Email: alwaysxiaop@gmail.com
# @Date: 2016-09-18 23:12:39
# @Last Modified time: 2016-09-18 23:19:24
# @FileName: 203.py
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
c... |
964b829c5cae2b5c3dcb192667e05f37350a2940 | JeanDenisD/Projects | /Shark Project/Shark Project final.py | 8,013 | 3.578125 | 4 | # Problem Definition:
## Deduce TOP-10 Manufacturers by Fuel Efficiency for given year
"""import pandas as pd
year=int(input('Enter the year: '))
def acquisition():
df=pd.read_csv('/Users/jidekickpush/Documents/GitHub/0323_2020DATAPAR/Labs/vehicles/vehicles.csv')
return df
def wrangle(df):
global year
... |
84d8a425d38392d5382503e38699dba396d9dc52 | humachine/AlgoLearning | /leetcode/Done/474_OnesAndZeros.py | 1,961 | 3.578125 | 4 | #https://leetcode.com/problems/ones-and-zeroes/
'''Given an array of binary strings and m, n - where m & represent the number of
zeros and 1s you have respectively, what is the maximum number of strings you
can build from the array.
Inp: ["10", "0001", "111001", "1", "0"], m = 5, n = 3
Out: 4 (With 5 zeros and 3 ones,... |
fe83d42057da0a9517d187e5b7767860538b0e72 | zuhaalfaraj/Introduction-to-Algorithms | /3. Heap/heapSort.py | 877 | 3.515625 | 4 | import numpy as np
def max_heapify(arr,n,i):
node = i
left = 2*i+1
right = 2*i+2
larg= node
if left<n and arr[left]> arr[node]:
larg= left
if right<n and arr[right]> arr[larg]:
larg = right
if larg != i:
arr[i], arr[larg] = arr[larg], arr[i]
max_heapify(arr... |
f260c93a83b5d8f790a7c7ad690aab8414728027 | Spinnerka/Python-Coursera-Assignments | /Ex10_DistributionByHour.py | 1,019 | 4.0625 | 4 | # 10.2 Write a program to read through the mbox-short.txt and figure out the
# distribution by hour of the day for each of the messages. You can pull the
# hour out from the 'From ' line by finding the time and then splitting the
# string a second time using a colon.
# From stephen.marquard@uct.ac.za Sat Jan... |
d2bba48c2511f61e020915b9b61c7b34b60a0713 | Sauvikk/practice_questions | /Level8/Black Shapes.py | 1,390 | 3.78125 | 4 | # Given N * M field of O's and X's, where O=white, X=black
# Return the number of black shapes. A black shape consists of one or more adjacent X's (diagonals not included)
#
# Example:
#
# OOOXOOO
# OOXXOXO
# OXOOOXO
#
# answer is 3 shapes are :
# (i) X
# X X
# (ii)
# X
# (iii)
# X
# X
# Not... |
55428f2141b836e5de94d1d9c272118ce368c9ca | Khittyroar/Proyecto | /untitled0.py | 4,696 | 3.65625 | 4 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 4 13:37:56 2020
@author: fhwx
"""
class Producto:
def __init__(A,Nombre,CodigoProducto,Marca,Precio,Cantidad,CantidadEstanteria,Vendidos):
A.Nom = Nombre
A.Precio = Precio
A.Cant = Cantidad
A.Vendidos = V... |
2e11af93dff02e3816d782b3926efed048c60906 | jasonluocesc/CS_E3190 | /P6/coins/coins.py | 1,298 | 3.796875 | 4 | # coding: utf-8
from solution import get_coins
import sys
def read_data_from_file(filename):
"""Read problem instance from file. No error handling!
Parameters
----------
filename : str
Returns
-------
target_value : int
The amount we need to make change for using the differen... |
70fa819a607da8c4d717a3a5b4e9e552a81d68c2 | BrandonSersion/fizzbuzz_using_helper_function | /fizzbuzz.py | 503 | 3.671875 | 4 | def fizz_buzz(fizz, buzz, limit):
def divisible_by(iterator, divisor):
if iterator % divisor == 0:
return True
for i in range(0, limit):
if divisible_by(i, fizz*buzz):
yield "FizzBuzz"
elif divisible_by(i, fizz):
yield "Fizz"
elif divis... |
e1c75cc3f5319af615ff7822e93b2a5e3a4aba2c | Alexklai92/micro_projects | /text_alignment_on_width.py | 1,818 | 3.53125 | 4 | text = [
"sdajdksa lksjad kja djkas djkasjd asjkd aksjkdajsd sad as das sdas s",
"asdasd asdsad asdasd das ss d asdasd",
"asdasd jkajs jjkk; csnsdan nasdnasd ksadjiksa jsado",
"sdahdjash hasd asd jhajsdha sjdhsjahd sjd as jdhasdsh ajh h",
"dsahjdsah jjh jh kasjd k u uk suk usku ksu",
"sdasd sad ... |
69dd38e2a4c252eb51549ced7e16c203f3bc23c9 | dmitry741/geekbrains_python | /Python1/lesson3/hw03_normal.py | 3,998 | 4.1875 | 4 | # Задание-1:
# Напишите функцию, возвращающую ряд Фибоначчи с n-элемента до m-элемента.
# Первыми элементами ряда считать цифры 1 1
def fibonacci(n, m):
''' функция возвращает ряд Фибоначчи с n-элемента до m-элемента.
'''
a1, a2 = 1, 1
f = a1 + a2
while f <= m:
if f >= n:
... |
a0f28c9b043afa73347c84e931be1a4c792d1f3e | ZhengLiangliang1996/Leetcode_ML_Daily | /contest/weekcontest99/GroupsSpecialEquivalentString.py | 927 | 3.6875 | 4 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2022 liangliang <liangliang@Liangliangs-MacBook-Air.local>
#
# Distributed under terms of the MIT license.
class Solution(object):
def numSpecialEquivGroups(self, words):
"""
:type words: List[str]
:rtype: int
... |
1be572d6c2eb71886d19365b5c9893bdb70b715c | JoshCWegner/Python-Programming | /all_about_me.py | 651 | 4.21875 | 4 |
my_favorite_food = input("What is your favorite food?")
what_I_like_to_watch = input("What show or shows do you like to watch?")
what_is_your_favorite_team = input("Do you have a team you like to watch?")
do_you_have_any_kids = input("Do you have any kids?")
if do_you_have_any_kids == "yes":
what_are_their_names... |
e56ad4ab00d2ff186e6052d54744c54c74b7f819 | ks-99/forsk2019 | /week5/day3/breadbasket.py | 1,827 | 3.65625 | 4 | """
Code Challenge:
dataset: BreadBasket_DMS.csv
Q1. In this code challenge, you are given a dataset which has data and time wise transaction on a bakery retail store.
1. Draw the pie chart of top 15 selling items.
2. Find the associations of items where min support should be 0.0025, min_confidence=0.2, min_lift=3.
3.... |
99fc9aa060e3dbd515ad792def701eaee8a1fae9 | Vamsi027/RegressionModels | /polynomial_regression.py | 779 | 3.859375 | 4 | # Importing libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#importing dataset
dataset=pd.read_csv('')#Enter the csv file
X=dataset.iloc[:,1:2].values
Y=dataset.iloc[:,2].values
#Fitting polynomial regression to the dataset
from sklearn.preprocessing import PolynomialFeatures
polynomi... |
127a890c1c87c1ca1d7794607f23a325643b4a85 | michaelRobinson84/Sandbox | /password_check.py | 264 | 4.3125 | 4 | MINIMUM_LENGTH = 8
password = input("Please enter a password, minimum length 8 characters: ")
while len(password) < 8:
print("Password is too short!")
password = input("Please enter a password, minimum length 8 characters: ")
print(len(password) * "*")
|
df9cabefb53ec647e6c357de731362a92280d8bc | sharedrepo2021/AWS_Python | /Diptangsu/my_dict.py | 2,367 | 4.03125 | 4 | import json
if __name__ == "__main__":
my_dict = {}
option_dict = {
1: 'display my_dict',
2: 'Exit',
3: 'Add an item to the dictionary',
4: 'Remove specific item dictionary',
5: 'Make a copy of the dictionary',
6: 'Remove all items from the dictionary',
7... |
59ef2f5ea040e653694dfece4d77a9726d4967a9 | mipopov/Y.Praktice | /Sprint4/Solutions/TaskA.py | 589 | 3.578125 | 4 | # class Node:
# def __init__(self, value, left=None, right=None):
# self.value = value
# self.right = right
# self.left = left
#
def solution(node, max_elem= float("-inf")) -> int:
if node.value > max_elem:
max_elem = node.value
if node.left:
max_elem = solution(nod... |
e78df9292490d69d8b95312a8273794c2084386e | amandathedev/Python-Fundamentals | /01_python_fundamentals/01_02_seconds_years.py | 253 | 3.75 | 4 | '''
From the previous example, move your calculation of how many seconds in a year to a python executable script.
'''
year = 0
minute = 60
hour = minute * 60
day = hour * 24
year = day * 365
print("There are " + str(year) + " seconds in one year.")
|
9510db5357d6bf064518326f72191514e7636a39 | DvidGs/Python-A-Z | /7 - Estructuras de datos: Conjuntos/ejercicio 5.py | 322 | 3.796875 | 4 | # Ejercicio 5
# Dado un conjunto, crea un programa que nos devuelva el caracter con menor valor ASCII. Debes hacerlo sin
# recurrir a la función min().
valor = {1, 2, "A", "E", "@"}
min = 9999
for i in valor:
if ord(str(i)) < min:
min = ord(str(i))
print("El caracter con menor valor ASCII es: ", chr(min)... |
f0fd37e4cf9b5325a73d04edd896bd17d4b76844 | Spiridd/python | /stepic/sum_decomposition.py | 203 | 3.609375 | 4 | n = int(input())
terms = []
term = 1
while n > 0:
if n-term > term or n == term:
n -= term
terms.append(term)
term += 1
print(len(terms))
[print(term, end=' ') for term in terms]
|
77158902938c70aef7ac824a85ae744cc09cf4ca | lxngoddess5321/python-files-backup | /100例/036.py | 265 | 3.859375 | 4 | import math
def IsPrime(x):
if x == 2:
flag = 1
elif x==1:
flag = 0
else:
# y = int(math.sqrt(x))
y=x//2
for i in range(2,y+1):
if x%i == 0:
flag = 0
break
else:
flag = 1
return flag
for i in range(1,100):
if IsPrime(i):
print(i) |
19b29d3e0150e5367e8abe4bae8bbc6f8bcf2798 | qicst23/LeetCode-pythonSolu | /013 Roman to Integer.py | 830 | 3.859375 | 4 | """
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
"""
__author__ = 'Danyang'
roman2int = {
"I": 1,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000
}
class Solution:
def romanToInt(self, s):
""... |
29f51ca06d5205729fc201f43f5cdfac0011ce0a | Raid55/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/tests/6-max_integer_test.py | 972 | 3.765625 | 4 | #!/usr/bin/python3
"""Unittest for max_integer([..])
"""
import unittest
max_integer = __import__('6-max_integer').max_integer
class TestMaxInteger(unittest.TestCase):
"""
el Test class
"""
def test_standard(self):
""" norm test
"""
self.assertEqual(max_integer([1,6, 100, 4... |
58336ca676c76301a34135a686a661c0b374b50e | Anupya/leetcode | /medium/q98 validateBST.py | 896 | 4.15625 | 4 | # Given the root of a binary tree, determine if it is a valid binary search tree (BST).
# 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:
def isValidBSTModif... |
39e2dda8ca36f9bc5f84c8bf440e63d4dde52c34 | Kanchi-Chitaliya/Socket-Programming | /client_udp.py | 2,963 | 3.671875 | 4 | from socket import *
import os
import sys
class Client():
def __init__(self,serverName,serverPort):
self.serverName = serverName
self.serverPort = serverPort
self.clientSocket = socket(AF_INET, SOCK_DGRAM)
self.clientSocket.bind(('',15098))
def create_socket(se... |
040c6f857aefd17cde3fef8e8e224bb07a966253 | Aitd1/learnPython | /函数/逆向参数传入.py | 370 | 3.65625 | 4 | #列表,元组
def test(name,age,sex):
print('我的名字叫:'+name+',我的年龄有:'+age+',我的性别是:'+sex)
list=('谢君','27','男')
test(*list)
#字典
def test1(name,age,sex):
print('我的名字叫:' + name + ',我的年龄有:' + age + ',我的性别是:' + sex)
dictinfo={'name':'谢君','age':'27','sex':'男'}
test1(**dictinfo) |
2c3083e216cb5a7add519fe420ffd44f54a441b2 | greatislee/python_demo | /inherit.py | 711 | 3.71875 | 4 | #!/usr/bin/env python
# coding=utf-8
class Hero:
'''
英雄类
'''
def __init__(self,name):
print "Hero.__init__"
self.name = name
def show(self):
print "Hero.showMe"
print self.name
class agility(Hero):
'''
敏捷类
'''
def __init__(self,name,speed):
... |
8202281123db123b0f303bd69ec8a166d58f5597 | rafaelgoncalvesmatos/estudandopython | /Curiosidade/curiosidade06.py | 219 | 3.8125 | 4 | #!/usr/bin/python
# Fucando em condicoes dentro de variaveis
x = range(1,11)
x1 = 1
for x in x :
print "Valor de x agora e ",x
print "Valor de x1 e ",x1
x1 = x1 + 1
for x1 in x1 :
print x1,' * ', " = ",x1 * x
|
d3bf66423fc5868fbce776c7866032d8eb289951 | cuihee/LearnPython | /Day01/c0111.py | 559 | 4 | 4 |
"""
列表的嵌套是什么
操作列表的方式
"""
# str
print('\x0a')
print("我叫 %s 今年 %d 岁!" % ('小明', 10))
# list
l1 = ['Google', 'Runoob', 1997, 2000]
print("原始列表 : ", l1)
del l1[2]
print("删除第三个元素 : ", l1)
# 嵌套
l2 = [1, l1]
print(l2[1][0])
# 元组
t1 = (10,) # 不加逗号视括号为运算符,所以没有逗号的t1是int
t2 = 'a',
print(type(t1), type(t2))
# 访问和列表一样 用切片
# 删除... |
a590dd527ab8577d5a44e78a0702ab1b4d9ad51b | Courage-GL/FileCode | /Python/month02/day04/file.py | 382 | 3.609375 | 4 | """
os模块 文件处理小函数
"""
import os
# 获取文件大小 bytes
# print(os.path.getsize("./笔记.txt"))
# 获取目录下的内容
print(os.listdir("/home/tarena"))
# 判断文件是否存在 True False
print(os.path.exists("./04.txt"))
# 判断一个文件是否为普通文件 True False
print(os.path.isfile("./4.txt"))
# 删除文件
# os.remove("笔记.txt")
|
282b9d1c205857616919d8cf4db387f4fb07e206 | r7asmu7s/art_of_doing_python | /02_basic_data_types/04_more_strings.py | 433 | 3.75 | 4 | full_name = '\tJohnny\nsmith'
print(full_name)
first_name = 'mike'
last_name = 'eramo'
full_name = first_name + ' ' + last_name
print(full_name.title())
print(first_name.upper() + ' ' + last_name.upper())
print(4 + 2)
print('4' + '2')
message = 'Hello, how are you doing today? What is going on at home?'
message = me... |
4d67a0c7c448b79fa22c89c6a5a5f68251c12109 | Eduardo271087/python-udemy-activities | /section-5/while.py | 593 | 4.125 | 4 | # El else se usa cuando termina el ciclo, excepto cuando se hac break
iteracion = 1
while iteracion <= 0:
iteracion += 1
print('Estoy iterando, van = ', iteracion)
else:
print('Imprimo esto porque se terminó y es el else')
iteracion = 1
while iteracion <= 3:
iteracion += 1
print('Estoy iterando, van = ', ite... |
3b4b369b7f8429ee6c3c1f767a395ddf7e0b5dbd | shyamww/Implementation-of-Physical-and-Datalink-layers-in-TCP-IP-Protocol | /physical.py | 573 | 3.890625 | 4 | def encode(data):
enc_data = ""
#blank string
for bit in data:
#change 0 to 1 and -1
if bit == "0":
enc_data += "1-1"
#change 1 to -1 and 1
else:
enc_data += "-11"
return enc_data
def decode(data):
bit_data = ""
#blank string
for i in ... |
0dbb2484cedf4f9ca38b38517d84f23b11c27b10 | skskdmsdl/python-study | /02. Operator/3.1 function.py | 1,587 | 4.03125 | 4 | # 랜덤 함수
from random import *
print(random()) # 0.0 ~ 1.0 미만의 임의의 값 생성
print(random() * 10) # 0.0 ~ 10.0 미만의 임의의 값 생성
print(int(random() * 10)) # 0 ~ 10 미만의 임의의 값 생성
print(int(random() * 10)) # 0 ~ 10 미만의 임의의 값 생성
print(int(random() * 10) + 1) # 1 ~ 10 미만의 임의의 값 생성
print(int(random() * 10) + 1) # 1 ~ 10 미만의 임의의 값 생성
... |
6d3c71e00d760076c9a381746b8d90c9e360abc8 | Aasthaengg/IBMdataset | /Python_codes/p03109/s974406861.py | 220 | 3.515625 | 4 | s = list(input().split('/'))
s = [int(ss) for ss in s]
if s[0] < 2019:
print("Heisei")
elif s[0] == 2019:
if s[1] < 4 or (s[1] == 4 and s[2] <= 30):
print("Heisei")
else:
print("TBD")
else:
print("TBD")
|
e45cfc2c6c63948f5bcd4f9138b8e57b0ddf4846 | ignaziocapuano/workbook_ex | /cap5/ex_111.py | 281 | 4.1875 | 4 | #reverse sorted order
list=[]
num=int(input("Inserisci primo elemento della List: "))
while num!=0:
list.append(num)
num = int(input("Inserisci numero da aggiungere alla List(0 per interrompere): "))
list.sort(reverse=True)
for i in range(len(list)):
print(list[i]) |
ad66410871a614f869dd462d4abfd3961ed3414c | G-J-Morais-DEV/tarm | /folgatarm/app/funcionario/folga.py | 2,476 | 4.03125 | 4 | # -*- coding: utf-8 -*-
from datetime import date,datetime,timedelta
from datetime import *
week = ['Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado', 'Domingo']
time = ["Tarde", "Noite", "Madrugada", "Manhã"]
days_of_Month = [31,28,31,30,31,30,31,31,30,31,30,31]
folga = {}
hj = ... |
e65f31d0528c252ed18c49635bbf706dbe3d1a0d | falecomlara/CursoEmVideo | /ex049 - tabuada com for.py | 243 | 3.84375 | 4 | #tabuada usando o laco (feito no exercicio 9)
titulo = 'GERADOR DE TABUADAS'
x=len(titulo)
print('='*x)
print(titulo)
print('='*x)
num = int(input('Digite um número: '))
for c in range(1,11):
print('{} x {} = {}'.format(num,c,(num*c)))
|
22d831ac21d59292e7f02ebb0787354173a51e5b | LanderU/PruebasPython | /Entregas/Ejercicio1.py | 345 | 3.609375 | 4 | #!/usr/bin/env python
# -*- coding: UTF-8 -*
# Abrimos el fichero
archivo = open("ficheronumero","r")
# Leemos la primera linea
numero = archivo.readline()
# Cerramos el archivo
archivo.close()
# Casteamos el numero para mostrarlo como un String
str(numero)
# Mostramos el valor por pantalla
print ("El contenido del a... |
d0076f805a61189b5315ee5e0ec2086ec4d93312 | victorvg17/HackerRank | /python/set-union-intersection.py | 339 | 3.78125 | 4 | # Enter your code here. Read input from STDIN. Print output to STDOUT
if __name__ == "__main__":
n = int(input())
n_st = set(input().split(" "))
b = int(input())
b_st = set(input().split(" "))
all_st = n_st.union(b_st)
both_st = n_st.intersection(b_st)
our_st = all_st.difference(both_st)
... |
3761b612fb3c78573c416827c70a43623a530809 | pankaj890/Python | /1. Python - Basics/OOPS/inheritance_constructor.py | 784 | 3.84375 | 4 | class A:
# Super constructor
def __init__(self):
print('In A init')
def feature1(self):
print('feature 1 running')
def feature2(self):
print('feature 2 running')
class B(A):
# Child constructor
def __init__(self):
super().__init__()
... |
be8e7e8e69118eae97342f0a66e7a069bf49480f | kshirsagarsiddharth/Algorithms_and_Data_Structures | /Graphs/TopologicalSort.py | 2,410 | 3.875 | 4 | from collections import defaultdict
class Graph:
def __init__(self,vertices):
self.graph = defaultdict(list)
self.vertices = vertices
self.visited_list = defaultdict()
self.output_stack = []
def add_edge(self,From,To):
self.graph[From].append(To)
se... |
c4495da1458cfafc8fe4ed1234e282ac7fc7f30d | fefefefe/skat | /skat.py | 3,305 | 4 | 4 | # card game Skat
"""
features so far:
hands out the cards
calculates the Jacks' factor
suit code is:
0 == diamonds
1 == hearts
2 == spades
3 == clubs
rank code is:
0 == 7
1 == 8
2 == 9
3 == 10
4 == Jack
5 == Queen
6 == King
7 == Ace
"""
import random
# variable declarations
hand0 = [] # the players hand
hand1 = [... |
a7e8671661c0465e8870a97f3304004288678caf | lmgty/leetcode | /21.py | 539 | 3.796875 | 4 | # -*- coding: UTF-8 -*-
class Solution:
def generateParenthesis(self, n):
res = []
s = ''
self.recursion(s, res, n, n)
return res
def recursion(self, s, res, left, right):
if left == right == 0:
res.append(s)
if left > 0:
self.recursion(s ... |
432e8934862db7c1b13179582e64077b940e0eba | shane-jeon/shane_practice_classes | /prac_classes.py | 4,768 | 4.21875 | 4 | """
Build a base class called AbstractPokemon that contains the following methods:
- __init__(self, name, lv=5)
- eat
- drink
- sleep
Build a Charmander class that inherits from the AbstractPokemon class that allows you to do the following:
- give it a nickname
- level up
- attack
- omnivore
Build a Charizard class t... |
f78816f51b411871f479260af4fcbe480a950e79 | chickey96/python_practice | /basic_algorithms.py | 488 | 3.859375 | 4 | def sum_list(list):
sum = 0
for num in list:
sum += num
print(sum)
return sum
# number_list = [1, 2, 3]
# sum_list(number_list)
# number_list.append(-4)
# sum_list(number_list)
# does not handle punctuation or capitalization at the moment
def reverse_words(sentence):
words = sentence.split(" ")
answe... |
9e8cb08932a1b801d2b0bf44ddfa9f5f6aa93cbc | bricewge/adventofcode | /01-1.py | 216 | 3.515625 | 4 | #!/usr/bin/env python3
import sys
puzzle = sys.argv[1]
prev = None
total = 0
for i in puzzle:
if prev == i:
total += int(i)
prev = i
if puzzle[-1] == puzzle[0]:
total += int(i)
print(total)
|
6e4eb5723d4940133221c230f128a6c6066cc60d | balamosh/yandex_contests | /algorithm_training/1.0/04_lection/A/solution.py | 189 | 3.59375 | 4 | size = int(input())
synonyms = {}
for _ in range(size):
first, second = input().split()
synonyms[first] = second
synonyms[second] = first
word = input()
print(synonyms[word])
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.