content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# coding=utf-8 """ Manages a UDP socket and does two things: 1. Retrieve incoming messages from DCS and update :py:class:`esst.core.status.status` 2. Sends command to the DCS application via the socket """
""" Manages a UDP socket and does two things: 1. Retrieve incoming messages from DCS and update :py:class:`esst.core.status.status` 2. Sends command to the DCS application via the socket """
''' Find missing no. in array. ''' def missingNo(arr): n = len(arr) sumOfArr = 0 for num in range(0,n): sumOfArr = sumOfArr + arr[num] sumOfNno = (n * (n+1)) // 2 missNumber = sumOfNno - sumOfArr print(missNumber) arr = [3,0,1] missingNo(arr)
""" Find missing no. in array. """ def missing_no(arr): n = len(arr) sum_of_arr = 0 for num in range(0, n): sum_of_arr = sumOfArr + arr[num] sum_of_nno = n * (n + 1) // 2 miss_number = sumOfNno - sumOfArr print(missNumber) arr = [3, 0, 1] missing_no(arr)
a = "python" b = "is" c = "excellent" d = a[0] + c[0] + a[len(a)-1] + b print(d)
a = 'python' b = 'is' c = 'excellent' d = a[0] + c[0] + a[len(a) - 1] + b print(d)
# weekdays buttons WEEKDAY_BUTTON = 'timetable_%(weekday)s_button' TIMETABLE_BUTTON = 'timetable_%(attendance)s_%(week_parity)s_%(weekday)s_button' # parameters buttons NAME = 'name_button' MAILING = 'mailing_parameters_button' ATTENDANCE = 'attendance_button' COURSES = 'courses_parameters_button' PARAMETERS_RETURN = ...
weekday_button = 'timetable_%(weekday)s_button' timetable_button = 'timetable_%(attendance)s_%(week_parity)s_%(weekday)s_button' name = 'name_button' mailing = 'mailing_parameters_button' attendance = 'attendance_button' courses = 'courses_parameters_button' parameters_return = 'return_parameters_button' exit_parameter...
class SearchParams(object): def __init__(self): self.maxTweets = 0 def set_username(self, username): self.username = username return self def set_since(self, since): self.since = since return self def set_until(self, until): self.until = until r...
class Searchparams(object): def __init__(self): self.maxTweets = 0 def set_username(self, username): self.username = username return self def set_since(self, since): self.since = since return self def set_until(self, until): self.until = until ...
x = int(input("Please enter any number!")) if x >= 0: print( "Positive") else: print( "Negative")
x = int(input('Please enter any number!')) if x >= 0: print('Positive') else: print('Negative')
# IF # In this program, we check if the number is positive or negative or zero and # display an appropriate message # Flow Control x=7 if x>10: print("x is big.") elif x > 0: print("x is small.") else: print("x is not positive.") # Array # Variabel array genap = [14,24,56,80] ganjil = ...
x = 7 if x > 10: print('x is big.') elif x > 0: print('x is small.') else: print('x is not positive.') genap = [14, 24, 56, 80] ganjil = [13, 55, 73, 23] nap = 0 jil = 0 for val in genap: nap = nap + val for val in ganjil: jil = jil + val print('Ini adalah bilangan Genap', nap) print('Ini ad...
# Remember that everything in python is # pass by reference if __name__ == '__main__': a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] print('First four: ', a[:4]) # same as a[0:4] # -ve list index starts at position 1 print('Last four: ', a[-4:]) print('Middle two: ', a[3:-3]) # when used in...
if __name__ == '__main__': a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] print('First four: ', a[:4]) print('Last four: ', a[-4:]) print('Middle two: ', a[3:-3]) print('Before : ', a) a[2:7] = [99, 22, 14] print('After : ', a) b = a[:] assert b is not a b = a a[:] = [100, 101,...
## This script contains useful functions to generate a html page given a ## blog post txt file. It also creates meta data for the blog posts to be ## used to make summaries. ## Input should be a txt file of specific format def read_file(infile): metadata = [] post = [] with open(infile, 'r') as f: ...
def read_file(infile): metadata = [] post = [] with open(infile, 'r') as f: for line in f: if line[0] == '#': metadata.append(line.strip('\n')) else: post.append(line) return {'metadata': metadata, 'post': post} def get_title(metadata): ...
#!/usr/bin/env python """ check out chapter 2 of cam """
""" check out chapter 2 of cam """
#!/usr/bin/env python3 #chmod +x hello.py #It will insert space and newline in preset print ("Hello", "World!")
print('Hello', 'World!')
"""Django Asana integration project""" # :copyright: (c) 2017-2021 by Stephen Bywater. # :license: MIT, see LICENSE for more details. VERSION = (1, 4, 8) __version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:]) __author__ = 'Steve Bywater' __contact__ = 'steve@regionalhelpwanted.com' __homepage__ = 'htt...
"""Django Asana integration project""" version = (1, 4, 8) __version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:]) __author__ = 'Steve Bywater' __contact__ = 'steve@regionalhelpwanted.com' __homepage__ = 'https://github.com/sbywater/django-asana' __docformat__ = 'restructuredtext' __license__ = 'MIT' defa...
def final_pos(): x = y = 0 with open("input.txt") as inp: while True: instr = inp.readline() try: cmd, val = instr.split() except ValueError: break else: if cmd == "forward": x += int(val...
def final_pos(): x = y = 0 with open('input.txt') as inp: while True: instr = inp.readline() try: (cmd, val) = instr.split() except ValueError: break else: if cmd == 'forward': x += int(va...
class zoo: def __init__(self,stock,cuidadores,animales): pass class cuidador: def __init__(self,animales,vacaciones): pass class animal: def __init__(self,dieta): pass class vacaciones: def __init__(self): pass class comida: def __init__(self,dieta): pass clas...
class Zoo: def __init__(self, stock, cuidadores, animales): pass class Cuidador: def __init__(self, animales, vacaciones): pass class Animal: def __init__(self, dieta): pass class Vacaciones: def __init__(self): pass class Comida: def __init__(self, dieta): ...
PROLOGUE = '''module smcauth(clk, rst, g_input, e_input, o); input clk; input [255:0] e_input; input [255:0] g_input; output o; input rst; ''' EPILOGUE = 'endmodule\n' OR_CIRCUIT = ''' OR {} ( .A({}), .B({}), .Z({}) ); ''' AND_CIRCUIT = ''' ANDN {} ( .A({}), .B({}), .Z({}) )...
prologue = 'module smcauth(clk, rst, g_input, e_input, o);\n input clk;\n input [255:0] e_input;\n input [255:0] g_input;\n output o;\n input rst;\n' epilogue = 'endmodule\n' or_circuit = '\n OR {} (\n .A({}),\n .B({}),\n .Z({})\n );\n' and_circuit = '\n ANDN {} (\n .A({}),\n .B({}),\n .Z({})\...
SINGLE_MATCHING_ITEM = """ <rss version="2.0"> <channel> <item> <title>testshow S02E03 720p</title> <link>testlink</link> </item> </channel> </rss> """ SINGLE_ITEM_CAPITALISATION = """ <rss version="2.0"> <channel> <item> <title>TestShow S02E03 72...
single_matching_item = '\n<rss version="2.0">\n <channel>\n <item>\n <title>testshow S02E03 720p</title>\n <link>testlink</link>\n </item>\n </channel>\n</rss>\n' single_item_capitalisation = '\n<rss version="2.0">\n <channel>\n <item>\n <title>TestShow S02...
""" Loop control version 1.1.10.20 Copyright (c) 2020 Shahibur Rahaman Licensed under MIT """ # Pass # Continue # break # A runner is practicing in a stadium and the coach is giving orders. t = 180 for i in range(t, 1, -1): t = t - 5 if t > 150: print("Time:", t, "| Do another lap.") continue if t > 120: ...
""" Loop control version 1.1.10.20 Copyright (c) 2020 Shahibur Rahaman Licensed under MIT """ t = 180 for i in range(t, 1, -1): t = t - 5 if t > 150: print('Time:', t, '| Do another lap.') continue if t > 120: print('Time:', t, '| You are improving your laptime!') pass i...
""" Profile ../profile-datasets-py/div83/040.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div83/040.py" self["Q"] = numpy.array([ 1.890026, 2.119776, 2.622053, 3.246729, 3.667537, 4.216342, 4.862296, 5.531749, ...
""" Profile ../profile-datasets-py/div83/040.py file automaticaly created by prof_gen.py script """ self['ID'] = '../profile-datasets-py/div83/040.py' self['Q'] = numpy.array([1.890026, 2.119776, 2.622053, 3.246729, 3.667537, 4.216342, 4.862296, 5.531749, 6.100783, 6.376119, 6.376069, 6.30519, 6.187932, 5.9...
class Base(object): def __init__(self, *args, **kwargs): pass def dispose(self, *args, **kwargs): pass def prepare(self, *args, **kwargs): pass def prepare_page(self, *args, **kwargs): pass def cleanup(self, *args, **kwargs): pass
class Base(object): def __init__(self, *args, **kwargs): pass def dispose(self, *args, **kwargs): pass def prepare(self, *args, **kwargs): pass def prepare_page(self, *args, **kwargs): pass def cleanup(self, *args, **kwargs): pass
"""Creates the train class""" class Train: """ Each train in the metro is an instance of the Train class. Methods: __init__: creates a new train in the station """ def __init__(self): self.cars = None self.board_rate = 8 self.pop = None self.travelers_exiting = ...
"""Creates the train class""" class Train: """ Each train in the metro is an instance of the Train class. Methods: __init__: creates a new train in the station """ def __init__(self): self.cars = None self.board_rate = 8 self.pop = None self.travelers_exiting = ...
n1 = float(input("Write the average of the first student ")) n2 = float(input("Write the average of the second student ")) m = (n1+n2)/2 print("The average of the two students is {}".format(m))
n1 = float(input('Write the average of the first student ')) n2 = float(input('Write the average of the second student ')) m = (n1 + n2) / 2 print('The average of the two students is {}'.format(m))
""" https://www.codewars.com/kata/52742f58faf5485cae000b9a/train/python Given an int that is a number of seconds, return a string. If int is 0, return 'now'. Otherwise, return string in an ordered combination of years, days, hours, minutes, and seconds. Examples: format_duration(62) # returns "1 minute and 2 secon...
""" https://www.codewars.com/kata/52742f58faf5485cae000b9a/train/python Given an int that is a number of seconds, return a string. If int is 0, return 'now'. Otherwise, return string in an ordered combination of years, days, hours, minutes, and seconds. Examples: format_duration(62) # returns "1 minute and 2 secon...
""" Takes BUY/SELL/HOLD decision on stocks based on some metrics """ def decision(ticker): pass
""" Takes BUY/SELL/HOLD decision on stocks based on some metrics """ def decision(ticker): pass
""" Module containing LinkedList class and Node class. """ class LinkedList(): """ Class to generate and modify linked list. """ def __init__(self, arg=None): self.head = None if arg is not None: if hasattr(arg, '__iter__') and not isinstance(arg, str): for ...
""" Module containing LinkedList class and Node class. """ class Linkedlist: """ Class to generate and modify linked list. """ def __init__(self, arg=None): self.head = None if arg is not None: if hasattr(arg, '__iter__') and (not isinstance(arg, str)): for ...
# -*- coding: utf-8 -*- # Copyright (c) 2014, Elvis Tombini <elvis@mapom.me> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDE...
wlconf = 'wlister.conf' wlprefix = 'wlister.log_prefix' wlaction = 'wlister.default_action' wlmaxpost = 'wlister.max_post_read' wlmaxpost_value = 2048 class Wlconfig(object): def __init__(self, request, log): options = request.get_options() self.log = log if WLCONF in options: ...
# This programs aasks for your name and says hello print('Hello world!') print('What is your name?') #Ask for their name myName = input() print('It is good to meet you, ' + myName) print('The lenght of your name is : ') print(len(myName)) print('What is your age?') #Ask for their age yourAge = input() print('You wil...
print('Hello world!') print('What is your name?') my_name = input() print('It is good to meet you, ' + myName) print('The lenght of your name is : ') print(len(myName)) print('What is your age?') your_age = input() print('You will be ' + str(int(yourAge) + 1) + ' in a year.')
# coding=utf8 """all possible exceptions""" class LilacException(Exception): """There was an ambiguous exception that occurred while handling lilac process""" pass class SourceDirectoryNotFound(LilacException): """Source directory was not found""" pass class ParseException(LilacException): ...
"""all possible exceptions""" class Lilacexception(Exception): """There was an ambiguous exception that occurred while handling lilac process""" pass class Sourcedirectorynotfound(LilacException): """Source directory was not found""" pass class Parseexception(LilacException): """There was an ...
# project/tests/test_ping.py def test_ping(test_app): response = test_app.get("/ping") assert response.status_code == 200 assert response.json() == {"environment": "dev", "ping": "pong!", "testing": True}
def test_ping(test_app): response = test_app.get('/ping') assert response.status_code == 200 assert response.json() == {'environment': 'dev', 'ping': 'pong!', 'testing': True}
#!/usr/bin/env python # coding=utf-8 __version__ = "2.1.4"
__version__ = '2.1.4'
label_name = [] with open("label_name.txt",encoding='utf-8') as file: for line in file.readlines(): line = line.strip() name = (line.split('-')[-1]) if name.count('|') > 0: name = name.split('|')[-1] print(name) label_name.append((name)) for item in label_name:...
label_name = [] with open('label_name.txt', encoding='utf-8') as file: for line in file.readlines(): line = line.strip() name = line.split('-')[-1] if name.count('|') > 0: name = name.split('|')[-1] print(name) label_name.append(name) for item in label_name: w...
class Library(object): def __init__(self): self.dictionary = { "Micah": ["Judgement on Samaria and Judah", "Reason for the judgement", "Judgement on wicked leaders", "Messianic Kingdom", "Birth of the Messiah", "Indictment 1, 2", "Promise of salvation"] } def get(self, b...
class Library(object): def __init__(self): self.dictionary = {'Micah': ['Judgement on Samaria and Judah', 'Reason for the judgement', 'Judgement on wicked leaders', 'Messianic Kingdom', 'Birth of the Messiah', 'Indictment 1, 2', 'Promise of salvation']} def get(self, book): return self.diction...
def split_full_name(string: str) -> list: """Takes a full name and splits it into first and last. Parameters ---------- string : str The full name to be parsed. Returns ------- list The first and the last name. """ return string.split(" ") # Test it out. print(s...
def split_full_name(string: str) -> list: """Takes a full name and splits it into first and last. Parameters ---------- string : str The full name to be parsed. Returns ------- list The first and the last name. """ return string.split(' ') print(split_full_name(stri...
AESEncryptParam = "Key (32 Hex characters)" S_BOX = ( 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0...
aes_encrypt_param = 'Key (32 Hex characters)' s_box = (99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 1...
# -*- coding: utf-8 -*- """ Top-level package for Los Angeles CDP instance backend. """ __author__ = "Matt Webster" __version__ = "1.0.0" def get_module_version() -> str: return __version__
""" Top-level package for Los Angeles CDP instance backend. """ __author__ = 'Matt Webster' __version__ = '1.0.0' def get_module_version() -> str: return __version__
### Sherlock and The Beast - Solution def findDecentNumber(n): temp = n while temp > 0: if temp%3 == 0: break else: temp -= 5 if temp < 0: return -1 final_str = "" rep_count = temp // 3 while rep_count: final_str += "555" rep_count...
def find_decent_number(n): temp = n while temp > 0: if temp % 3 == 0: break else: temp -= 5 if temp < 0: return -1 final_str = '' rep_count = temp // 3 while rep_count: final_str += '555' rep_count -= 1 rep_count = (n - temp) //...
#!/bin/env python3 class Car: ''' A car description ''' NUMBER_OF_WHEELS = 4 # Class variable. def __init__(self, name): self.name = name self.distance = 0 def drive(self, distance): ''' incrises distance ''' self.distance += distance def reverse(distance): ...
class Car: """ A car description """ number_of_wheels = 4 def __init__(self, name): self.name = name self.distance = 0 def drive(self, distance): """ incrises distance """ self.distance += distance def reverse(distance): """ Class method """ print('...
# LeetCode 953. Verifying an Alien Dictionary `E` # 1sk | 97% | 22' # A~0v21 class Solution: def isAlienSorted(self, words: List[str], order: str) -> bool: dic = {c: i for i, c in enumerate(order)} def cmp(s1, s2): for i in range(min(len(s1), len(s2))): if s1[i] != s2[i...
class Solution: def is_alien_sorted(self, words: List[str], order: str) -> bool: dic = {c: i for (i, c) in enumerate(order)} def cmp(s1, s2): for i in range(min(len(s1), len(s2))): if s1[i] != s2[i]: return dic[s1[i]] <= dic[s2[i]] return...
def beautifulTriplets(d, arr): t = 0 for i in range(len(arr)): if arr[i] + d in arr and arr[i] + 2*d in arr: t += 1 return t
def beautiful_triplets(d, arr): t = 0 for i in range(len(arr)): if arr[i] + d in arr and arr[i] + 2 * d in arr: t += 1 return t
prime_numbers = [True for x in range(1001)] prime_numbers[1] = False for i in range(2, 1001): for j in range(2*i, 1001, i): prime_numbers[j] = False input() count = 0 for i in map(int, input().split()): if prime_numbers[i] is True: count += 1 print(count)
prime_numbers = [True for x in range(1001)] prime_numbers[1] = False for i in range(2, 1001): for j in range(2 * i, 1001, i): prime_numbers[j] = False input() count = 0 for i in map(int, input().split()): if prime_numbers[i] is True: count += 1 print(count)
def intersection(right=[], left=[]): return list(set(right).intersection(set(left))) def union(right=[], left=[]): return list(set(right).union(set(left))) def union(right=[], left=[]): return list(set(right).difference(set(left))) # not have in left
def intersection(right=[], left=[]): return list(set(right).intersection(set(left))) def union(right=[], left=[]): return list(set(right).union(set(left))) def union(right=[], left=[]): return list(set(right).difference(set(left)))
class Book: """The Book object contains all the information about a book""" def __init__(self, title, author, date, genre): """Object constructor :param title: title of the Book :type title: str :param author: author of the book :type author: str :param data: the date at which the book has been p...
class Book: """The Book object contains all the information about a book""" def __init__(self, title, author, date, genre): """Object constructor :param title: title of the Book :type title: str :param author: author of the book :type author: str :param data: the date at which the bo...
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
class Evaluatedfunctions(dict): """ Evaluated functions. """ def __init__(self, evaluated_functions): self.update(evaluated_functions) @property def deployment_id(self): """ :return: The deployment id this request belongs to. """ return self['deployment_...
"""Workspace rules (Nixpkgs)""" load("@bazel_skylib//lib:dicts.bzl", "dicts") load( "@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_package", ) def haskell_nixpkgs_package( name, attribute_path, nix_file_deps = [], repositories = {}, build_file_content = None, ...
"""Workspace rules (Nixpkgs)""" load('@bazel_skylib//lib:dicts.bzl', 'dicts') load('@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl', 'nixpkgs_package') def haskell_nixpkgs_package(name, attribute_path, nix_file_deps=[], repositories={}, build_file_content=None, build_file=None, **kwargs): """Load a single haskell pa...
{ "target_defaults": { "cflags" : ["-Wall", "-Wextra", "-Wno-unused-parameter"], "include_dirs": ["<!(node -e \"require('..')\")", "<!(node -e \"require('nan')\")",] }, "targets": [ { "target_name" : "primeNumbers", "sources" : [ "cpp/primeNumbers.cpp" ], "target_conditions": [ ...
{'target_defaults': {'cflags': ['-Wall', '-Wextra', '-Wno-unused-parameter'], 'include_dirs': ['<!(node -e "require(\'..\')")', '<!(node -e "require(\'nan\')")']}, 'targets': [{'target_name': 'primeNumbers', 'sources': ['cpp/primeNumbers.cpp'], 'target_conditions': [['OS=="mac"', {'xcode_settings': {'GCC_ENABLE_CPP_EXC...
line = input() a, b = line.split() a = int(a) b = int(b) if a < b: print(a, b) else: print(b, a) """nums = [int(i) for i in input().split()] print(f"{min(nums)} {max(nums)}")"""
line = input() (a, b) = line.split() a = int(a) b = int(b) if a < b: print(a, b) else: print(b, a) 'nums = [int(i) for i in input().split()]\nprint(f"{min(nums)} {max(nums)}")'
#!/usr/bin/python3 # -*- coding: utf-8 -*- def main(): print(add(5,10)) print(add(5)) print(add(5,6)) print(add(x=5, y=2)) # print(add(x=5, 2)) # Error we need to use the both with name if you use the first one as named argument print(add(5,y=2)) print(1,2,3,4,5, sep=" - ") def add(x, y=3): total = ...
def main(): print(add(5, 10)) print(add(5)) print(add(5, 6)) print(add(x=5, y=2)) print(add(5, y=2)) print(1, 2, 3, 4, 5, sep=' - ') def add(x, y=3): total = x + y return total if __name__ == '__main__': main()
"""Created by sgoswami on 7/3/17.""" """Given two binary strings, return their sum (also a binary string). For example, a = \"11\" b = \"1\" Return \"100\".""" class Solution(object): def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ return bi...
"""Created by sgoswami on 7/3/17.""" 'Given two binary strings, return their sum (also a binary string).\nFor example,\na = "11"\nb = "1"\nReturn "100".' class Solution(object): def add_binary(self, a, b): """ :type a: str :type b: str :rtype: str """ return bin(int...
# 59. Spiral Matrix II # O(n) time | O(n) space class Solution: def fillMatrix(self, spiralMatrix: [[int]], startIter: int, endIter: int, runningValue=1) -> None: if startIter > endIter: return for index in range(startIter, endIter + 1): spiralMatrix[startIter][inde...
class Solution: def fill_matrix(self, spiralMatrix: [[int]], startIter: int, endIter: int, runningValue=1) -> None: if startIter > endIter: return for index in range(startIter, endIter + 1): spiralMatrix[startIter][index] = runningValue running_value += 1 ...
""" Space = O(1) Time = O(n log n) """ class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: ans = 0 intervals.sort(key=lambda a: (a[0], -a[1])) end = 0 for i, j in intervals: if j > end: ans += 1 end = max(end...
""" Space = O(1) Time = O(n log n) """ class Solution: def remove_covered_intervals(self, intervals: List[List[int]]) -> int: ans = 0 intervals.sort(key=lambda a: (a[0], -a[1])) end = 0 for (i, j) in intervals: if j > end: ans += 1 end = max(...
AgentID = str """ Assigned by Kentik """ TestID = str """ Assigned by Kentik """ Threshold = float """ latency and jitter in milliseconds, packet_loss in percent (0-100) """ MetricValue = float """ latency and jitter in milliseconds, packet_loss in percent (0-100) """
agent_id = str ' Assigned by Kentik ' test_id = str ' Assigned by Kentik ' threshold = float ' latency and jitter in milliseconds, packet_loss in percent (0-100) ' metric_value = float ' latency and jitter in milliseconds, packet_loss in percent (0-100) '
#!/usr/bin/python3 class VectorFeeder: def __init__(self, vectors, words, cursor=0): self.data = vectors self.cursor = cursor self.words = words print('len words', len(self.words), 'len data', len(self.data)) def get_next_batch(self, size): batch = self.data[self.cursor:...
class Vectorfeeder: def __init__(self, vectors, words, cursor=0): self.data = vectors self.cursor = cursor self.words = words print('len words', len(self.words), 'len data', len(self.data)) def get_next_batch(self, size): batch = self.data[self.cursor:self.cursor + size...
expected_output = { "instance": { "default": { "vrf": { "VRF1": { "address_family": { "vpnv4 unicast RD 100:100": { "default_vrf": "VRF1", "prefixes": { ...
expected_output = {'instance': {'default': {'vrf': {'VRF1': {'address_family': {'vpnv4 unicast RD 100:100': {'default_vrf': 'VRF1', 'prefixes': {'10.229.11.11/32': {'available_path': '1', 'best_path': '1', 'index': {1: {'gateway': '0.0.0.0', 'inaccessible': False, 'localpref': 100, 'metric': 0, 'next_hop': '0.0.0.0', '...
n=6 x=1 for i in range(1,n+1): for j in range(i,0,-1): ch=chr(ord('Z')-j+1) print(ch,end="") x=x+1 print() for i in range(n,0,-1): for j in range(i,0,-1): ch=chr(ord('Z')-j+1) print(ch,end="") x=x+1 print()
n = 6 x = 1 for i in range(1, n + 1): for j in range(i, 0, -1): ch = chr(ord('Z') - j + 1) print(ch, end='') x = x + 1 print() for i in range(n, 0, -1): for j in range(i, 0, -1): ch = chr(ord('Z') - j + 1) print(ch, end='') x = x + 1 print()
name1_1_0_0_0_0_0 = None name1_1_0_0_0_0_1 = None name1_1_0_0_0_0_2 = None name1_1_0_0_0_0_3 = None name1_1_0_0_0_0_4 = None
name1_1_0_0_0_0_0 = None name1_1_0_0_0_0_1 = None name1_1_0_0_0_0_2 = None name1_1_0_0_0_0_3 = None name1_1_0_0_0_0_4 = None
def soma(*args): total = 0 for n in args: total += n return total print(__name__) print(soma()) print(soma(1)) print(soma(1, 2)) print(soma(1, 2, 5))
def soma(*args): total = 0 for n in args: total += n return total print(__name__) print(soma()) print(soma(1)) print(soma(1, 2)) print(soma(1, 2, 5))
infty = 999999 def whitespace(words, i, j): return (L-(j-i)-sum([len(word) for word in words[i:j+1]])) def cost(words,i,j): total_char_length = sum([len(word) for word in words[i:j+1]]) if total_char_length > L-(j-i): return infty if j==len(words)-1: return 0 return whitespace(w...
infty = 999999 def whitespace(words, i, j): return L - (j - i) - sum([len(word) for word in words[i:j + 1]]) def cost(words, i, j): total_char_length = sum([len(word) for word in words[i:j + 1]]) if total_char_length > L - (j - i): return infty if j == len(words) - 1: return 0 retu...
class MinStack: # Update Min every pop (Accepted), O(1) push, pop, top, min def __init__(self): self.stack = [] self.min = None def push(self, val: int) -> None: if self.stack: self.min = min(self.min, val) self.stack.append((val, self.min)) else: ...
class Minstack: def __init__(self): self.stack = [] self.min = None def push(self, val: int) -> None: if self.stack: self.min = min(self.min, val) self.stack.append((val, self.min)) else: self.min = val self.stack.append((val, sel...
# -*- coding: utf-8 -*- """ Created on Mon Feb 24 13:09:04 2020 @author: 766810 """ tab = [] loop = 'loop' # tab will hold all Kaprekar numbers found # loop is just for better wording def asc(n): # puts the number's digits in ascending... return int(''.join(sorted(str(n)))) def desc(n): ...
""" Created on Mon Feb 24 13:09:04 2020 @author: 766810 """ tab = [] loop = 'loop' def asc(n): return int(''.join(sorted(str(n)))) def desc(n): return int(''.join(sorted(str(n))[::-1])) n = input('Specify a number: ') try: n = int(n) except: print('\nInvalid number specified!!!\nAssuming n = 2020.') ...
def main(): try: with open('cat_200_300.jpg', 'rb') as fs1: data = fs1.read() print(type(data)) with open('cat1.jpg', 'wb') as fs2: fs2.write(data) except FileNotFoundError as e: print(e) if __name__ == '__main__': main()
def main(): try: with open('cat_200_300.jpg', 'rb') as fs1: data = fs1.read() print(type(data)) with open('cat1.jpg', 'wb') as fs2: fs2.write(data) except FileNotFoundError as e: print(e) if __name__ == '__main__': main()
#!/usr/bin/env python3 class Point: def __init__(self, x, y, t, err): """ This class represents a gaze point @param x: @param y: @param t: @param err: """ self.error = err self.timestamp = t self.coord = [] self.coord.append(x) self.coord.append(y) def at(self, k...
class Point: def __init__(self, x, y, t, err): """ This class represents a gaze point @param x: @param y: @param t: @param err: """ self.error = err self.timestamp = t self.coord = [] self.coord.append(x) self.coord.append(y) def at(self...
""" *AbstractProperty* """ __all__ = ["AbstractProperty"] class AbstractProperty: pass
""" *AbstractProperty* """ __all__ = ['AbstractProperty'] class Abstractproperty: pass
# -*- coding: utf-8 -*- """Conventions for data, coordinate and attribute names.""" measurement_type = 'measurement' peak_coord = 'peak' """Index coordinate denoting passband peaks of the FPI.""" number_of_peaks = 'npeaks' """Number of passband peaks included in a given image.""" setpoint_coord = 'setpoint_index' ...
"""Conventions for data, coordinate and attribute names.""" measurement_type = 'measurement' peak_coord = 'peak' 'Index coordinate denoting passband peaks of the FPI.' number_of_peaks = 'npeaks' 'Number of passband peaks included in a given image.' setpoint_coord = 'setpoint_index' 'Coordinate denoting the the setpoint...
while True: a = input() if a == '-1': break L = list(map(int, a.split()))[:-1] cnt = 0 for i in L: if i*2 in L: cnt += 1 print(cnt)
while True: a = input() if a == '-1': break l = list(map(int, a.split()))[:-1] cnt = 0 for i in L: if i * 2 in L: cnt += 1 print(cnt)
# -*- coding: utf-8 -*- __all__=['glottal', 'phonation', 'articulation', 'prosody', 'replearning']
__all__ = ['glottal', 'phonation', 'articulation', 'prosody', 'replearning']
# creating a function to calculate the density. def calc_density(mass, volume): # arithmetic calculation to determine the density. density = mass / volume density = round(density, 2) # returning the value of the density. return density # receiving input from the user regarding the mass ...
def calc_density(mass, volume): density = mass / volume density = round(density, 2) return density mass = float(input('Enter the mass of the substance in grams please: ')) volume = float(input('Enter the volume of the substance please: ')) print('The density of the object is:', calc_density(mass, volume), '...
class documentmodel: def getDocuments(self): document_tokens1 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy." document_tokens2 = "At last, China seems serious about confronting an endemic problem: domestic violence and corr...
class Documentmodel: def get_documents(self): document_tokens1 = 'China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy.' document_tokens2 = 'At last, China seems serious about confronting an endemic problem: domestic violence and cor...
# For internal use. Please do not modify this file. def setup(): return def extra_make_option(): return ""
def setup(): return def extra_make_option(): return ''
def collatz(number): if number%2==0: number=number//2 else: number=3*number+1 print(number) return number print('enter an integer') num=int(input()) a=0 a=collatz(num) while a!=1: a=collatz(a)
def collatz(number): if number % 2 == 0: number = number // 2 else: number = 3 * number + 1 print(number) return number print('enter an integer') num = int(input()) a = 0 a = collatz(num) while a != 1: a = collatz(a)
# CONVERSION OF UNITS # Python 3 # Using Jupyter Notebook # If using Visual Studio then change .ipynb to .py # This program aims to convert units from miles to km and from km to ft. # 1 inch = 2.54 cm, 1 km = 1000m, 1 m = 100 cm, 12 inches = 1 ft, 1 mile = 5280 ft # ------- Start ------- # Known Standard Units of Co...
in_to_cm = 2.54 km_to_m = 1000 m_to_cm = 100 in_to_ft = 1 / 12 mi_to_ft = 5280 num = float(input('Enter your number (in miles): ')) mi_to_ft = num * miToFt in_to_ft = miToFt * (1 / inToFt) in_to_cm = inToFt * inToCm m_to_cm = inToCm * (1 / mToCm) km_to_m = mToCm * (1 / kmToM) print() print(num, ' mile(s) is', miToFt, '...
'''constants.py Various constants that are utilized in different modules across the whole program''' #Unicode characters for suits SUITS = [ '\u2660', '\u2663', '\u2665', '\u2666' ] #A calculation value and a face value for the cards VALUE_PAIRS = [ (1, 'A'), (2, '2'), (3, '3'), (4, '4...
"""constants.py Various constants that are utilized in different modules across the whole program""" suits = ['♠', '♣', '♥', '♦'] value_pairs = [(1, 'A'), (2, '2'), (3, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9'), (10, '10'), (11, 'J'), (12, 'Q'), (13, 'K')] black = (0, 0, 0) white = (255, 255, 255...
def is_overlap(arr1, arr2): if arr2[0] <= arr1[0] <= arr2[1]: return True if arr2[0] <= arr1[1] <= arr2[1]: return True if arr1[0] <= arr2[0] <= arr1[1]: return True if arr1[0] <= arr2[1] <= arr1[1]: return True return False def merge_2_arrays(arr1, arr2): l = ...
def is_overlap(arr1, arr2): if arr2[0] <= arr1[0] <= arr2[1]: return True if arr2[0] <= arr1[1] <= arr2[1]: return True if arr1[0] <= arr2[0] <= arr1[1]: return True if arr1[0] <= arr2[1] <= arr1[1]: return True return False def merge_2_arrays(arr1, arr2): l = mi...
def fib(n): if n == 1 or n == 2: return 1 else: return fib(n - 1) + fib(n - 2) def fib3(n): if n == 1 or n == 2 or n == 3: return 1 else: return fib3(n - 1) + fib3(n - 2) + fib3(n - 3) def fib_mult(n): if n == 1: return 1 if n == 2: return 2 ...
def fib(n): if n == 1 or n == 2: return 1 else: return fib(n - 1) + fib(n - 2) def fib3(n): if n == 1 or n == 2 or n == 3: return 1 else: return fib3(n - 1) + fib3(n - 2) + fib3(n - 3) def fib_mult(n): if n == 1: return 1 if n == 2: return 2 ...
"""Given a linked list of co-ordinates where adjacent points either form a vertical line or a horizontal line. Delete points from the linked list which are in the middle of a horizontal or vertical line.""" """Input: (0,10)->(1,10)->(5,10)->(7,10) | (7,...
"""Given a linked list of co-ordinates where adjacent points either form a vertical line or a horizontal line. Delete points from the linked list which are in the middle of a horizontal or vertical line.""" 'Input: (0,10)->(1,10)->(5,10)->(7,10)\n |\n (7,...
""" ========== Exceptions ========== Module containing framework-wide exception definitions. Exceptions for particular subsystems are defined in their respective modules. """ class VivariumError(Exception): """Generic exception raised for errors in ``vivarium`` simulations.""" pass
""" ========== Exceptions ========== Module containing framework-wide exception definitions. Exceptions for particular subsystems are defined in their respective modules. """ class Vivariumerror(Exception): """Generic exception raised for errors in ``vivarium`` simulations.""" pass
""" Python program to find the n'th number in the tribonacci series Tribonacci series is a generalization of the Fibonacci sequence, in which the current term is the sum of the previous three terms. """ def find_tribonacci(n): dp = [0] * n dp[0] = 0 dp[1] = 0 dp[2] = 1 # Compute the sum of the pre...
""" Python program to find the n'th number in the tribonacci series Tribonacci series is a generalization of the Fibonacci sequence, in which the current term is the sum of the previous three terms. """ def find_tribonacci(n): dp = [0] * n dp[0] = 0 dp[1] = 0 dp[2] = 1 for i in range(3, n): ...
__author__ = 'Dmitriy Korsakov' def main(): pass
__author__ = 'Dmitriy Korsakov' def main(): pass
# Python - 3.4.3 def problem(a): try: return float(a) * 50 + 6 except: return 'Error'
def problem(a): try: return float(a) * 50 + 6 except: return 'Error'
""" bluew.daemon ~~~~~~~~~~~~~~~~~ This module provides a Daemon object that tries its best to keep connections alive, and has the ability to reproduce certain steps when a reconnection is needed. :copyright: (c) 2017 by Ahmed Alsharif. :license: MIT, see LICENSE for more details. """ def daemonize(func): """ ...
""" bluew.daemon ~~~~~~~~~~~~~~~~~ This module provides a Daemon object that tries its best to keep connections alive, and has the ability to reproduce certain steps when a reconnection is needed. :copyright: (c) 2017 by Ahmed Alsharif. :license: MIT, see LICENSE for more details. """ def daemonize(func): """ ...
# current = -4.036304473876953 def convert(time): pos = True if time >= 0 else False time = abs(time) time_hours = time/3600 time_h = int(time_hours) time_remaining = time_hours - time_h time_m = int(time_remaining*60) time_sec = time_remaining - time_m/60 time_s = int(time_se...
def convert(time): pos = True if time >= 0 else False time = abs(time) time_hours = time / 3600 time_h = int(time_hours) time_remaining = time_hours - time_h time_m = int(time_remaining * 60) time_sec = time_remaining - time_m / 60 time_s = int(time_sec * 3600) time_format = f'{time_...
""" Define redistricting.management as a Python package. This file serves the purpose of defining a Python package for this folder. It is intentionally left empty. This file is part of The Public Mapping Project https://github.com/PublicMapping/ License: Copyright 2010-2012 Micah Altman, Michael McDonald Li...
""" Define redistricting.management as a Python package. This file serves the purpose of defining a Python package for this folder. It is intentionally left empty. This file is part of The Public Mapping Project https://github.com/PublicMapping/ License: Copyright 2010-2012 Micah Altman, Michael McDonald Li...
def composite_value(value): if ';' in value: items = [] first = True for tmp in value.split(';'): if not first and tmp.startswith(' '): tmp = tmp[1:] items.append(tmp) first = False else: items = [value] return items
def composite_value(value): if ';' in value: items = [] first = True for tmp in value.split(';'): if not first and tmp.startswith(' '): tmp = tmp[1:] items.append(tmp) first = False else: items = [value] return items
# MIT License # (C) Copyright 2021 Hewlett Packard Enterprise Development LP. # # actionLog : Get Action/Audit Logs def get_audit_log( self, start_time: int, end_time: int, limit: int, log_level: int = 1, ne_pk: str = None, username: str = None, ) -> list: """Get audit log details filt...
def get_audit_log(self, start_time: int, end_time: int, limit: int, log_level: int=1, ne_pk: str=None, username: str=None) -> list: """Get audit log details filtered by specified query parameters .. list-table:: :header-rows: 1 * - Swagger Section - Method - Endpoint ...
#!/usr/bin/env python # iGoBot - a GO game playing robot # # ############################## # # GO stone board coordinates # # ############################## # # Project website: http://www.springwald.de/hi/igobot # # Licensed under MIT License (MIT) # # Copyright (c) 2018 Daniel Springwald...
class Board: _released = False empty = 0 black = 1 white = 2 _board_size = 0 _fields = [] _13x13_x_min = 735 _13x13_x_max = 3350 _13x13_y_min = 100 _13x13_y_max = 2890 _9x9_x_min = 1120 _9x9_x_max = 2940 _9x9_y_min = 560 _9x9_y_max = 2400 stepper_min_x = 0 ...
def compare(a: int, b: int): printNums(a, b) if a > b: msg = "a > b" a += 1 elif a < b: msg = "a < b" b += 1 else: msg = "a == b" a += 1 b += 1 print(msg) printNums(a, b) print() def printNums(a, b): print(f"{a = }, {b = }") def main(): for a in range(1, 4): for b in range(1, 4): compare...
def compare(a: int, b: int): print_nums(a, b) if a > b: msg = 'a > b' a += 1 elif a < b: msg = 'a < b' b += 1 else: msg = 'a == b' a += 1 b += 1 print(msg) print_nums(a, b) print() def print_nums(a, b): print(f'a = {a!r}, b = {b!r}...
#!/usr/bin/env python """quicksort.py: Program to implement quicksort""" __author__ = 'Rohit Sinha' def quick_sort(alist): quick_sort_helper(alist, 0, len(alist) - 1) def quick_sort_helper(alist, start, end): if start < end: pivot = partition(alist, start, end) quick_sort_helper(alist, sta...
"""quicksort.py: Program to implement quicksort""" __author__ = 'Rohit Sinha' def quick_sort(alist): quick_sort_helper(alist, 0, len(alist) - 1) def quick_sort_helper(alist, start, end): if start < end: pivot = partition(alist, start, end) quick_sort_helper(alist, start, pivot - 1) qui...
latest_block_redis_key = "latest_block_from_chain" latest_block_hash_redis_key = "latest_blockhash_from_chain" most_recent_indexed_block_redis_key = "most_recently_indexed_block_from_db" most_recent_indexed_block_hash_redis_key = "most_recently_indexed_block_hash_from_db" most_recent_indexed_ipld_block_redis_key = "mos...
latest_block_redis_key = 'latest_block_from_chain' latest_block_hash_redis_key = 'latest_blockhash_from_chain' most_recent_indexed_block_redis_key = 'most_recently_indexed_block_from_db' most_recent_indexed_block_hash_redis_key = 'most_recently_indexed_block_hash_from_db' most_recent_indexed_ipld_block_redis_key = 'mos...
a = 'abcdefghijklmnopqrstuvwxyz' b = 'pvwdgazxubqfsnrhocitlkeymj' trans = str.maketrans(b, a) src = 'Wxgcg txgcg ui p ixgff, txgcg ui p epm. I gyhgwt mrl lig txg ixgff wrsspnd tr irfkg txui hcrvfgs, nre, hfgpig tcm liunz txg crt13 ra "ixgff" tr gntgc ngyt fgkgf.' print(src.translate(trans))
a = 'abcdefghijklmnopqrstuvwxyz' b = 'pvwdgazxubqfsnrhocitlkeymj' trans = str.maketrans(b, a) src = 'Wxgcg txgcg ui p ixgff, txgcg ui p epm. I gyhgwt mrl lig txg ixgff wrsspnd tr irfkg txui hcrvfgs, nre, hfgpig tcm liunz txg crt13 ra "ixgff" tr gntgc ngyt fgkgf.' print(src.translate(trans))
def get_level_1_news(): news1 = 'Stars Wars movie filming is canceled due to high electrical energy used. Turns out' \ 'those lasers don\'t power themselves' news2 = 'Pink Floyd Tour canceled after first show used up the whole energy city had for' \ 'the whole month. The band says they\...
def get_level_1_news(): news1 = "Stars Wars movie filming is canceled due to high electrical energy used. Turns outthose lasers don't power themselves" news2 = "Pink Floyd Tour canceled after first show used up the whole energy city had forthe whole month. The band says they'll be happy to play on the dark side...
user_num = int(input("which number would you like to check?")) def devisible_by_both(): if user_num %3 == 0 and user_num %5 == 0: print("your number is divisible by both") else: print("your number is not divisible by both")
user_num = int(input('which number would you like to check?')) def devisible_by_both(): if user_num % 3 == 0 and user_num % 5 == 0: print('your number is divisible by both') else: print('your number is not divisible by both')
class PyQtSociusError(Exception): pass class WrongInputFileTypeError(PyQtSociusError): __module__ = 'pyqtsocius' def __init__(self, input_file: str, expected_file_extension: str, extra_message: str = None): self.file = input_file self.file_ext = '.' + input_file.split('.')[-1] s...
class Pyqtsociuserror(Exception): pass class Wronginputfiletypeerror(PyQtSociusError): __module__ = 'pyqtsocius' def __init__(self, input_file: str, expected_file_extension: str, extra_message: str=None): self.file = input_file self.file_ext = '.' + input_file.split('.')[-1] self.e...
base_rf.fit(X_train, y_train) under_rf.fit(X_train, y_train) over_rf.fit(X_train, y_train) plot_roc_and_precision_recall_curves([ ("original", base_rf), ("undersampling", under_rf), ("oversampling", over_rf), ])
base_rf.fit(X_train, y_train) under_rf.fit(X_train, y_train) over_rf.fit(X_train, y_train) plot_roc_and_precision_recall_curves([('original', base_rf), ('undersampling', under_rf), ('oversampling', over_rf)])
# The view that is shown for normal use of this app # Button name for front page SUPERUSER_SETTINGS_VIEW = 'twitterapp.views.site_setup'
superuser_settings_view = 'twitterapp.views.site_setup'
class TrieNode: def __init__(self): self.children = {} self.is_word = False self.word = str class Trie: def __init__(self): self.root = TrieNode() def add_word(self, word): node = self.root for c in word: if c not in node.children: ...
class Trienode: def __init__(self): self.children = {} self.is_word = False self.word = str class Trie: def __init__(self): self.root = trie_node() def add_word(self, word): node = self.root for c in word: if c not in node.children: ...
class MoonBoard(): """ Class that encapsulates Moonboard layout info for a specific year. :param year_layout: Year in which this board layout was published :type year_layout: int :param image: Path to the image file for this board layout :type image: str :param rows: Number of rows of the...
class Moonboard: """ Class that encapsulates Moonboard layout info for a specific year. :param year_layout: Year in which this board layout was published :type year_layout: int :param image: Path to the image file for this board layout :type image: str :param rows: Number of rows of the boa...
'''Write a Python program to empty a variable without destroying it. Sample data: n=20 d = {"x":200} Expected Output : 0 {}''' n = 20 d = {"x":200} print(type(n)()) print(type(d)())
"""Write a Python program to empty a variable without destroying it. Sample data: n=20 d = {"x":200} Expected Output : 0 {}""" n = 20 d = {'x': 200} print(type(n)()) print(type(d)())
{ "name": "Module Wordpess Mysql", "author": "Tedezed", "version": "0.1", "frontend": "wordpress", "backend": "mysql", "check_app": True, "update_app_password": True, "update_secret": True, "executable": False, }
{'name': 'Module Wordpess Mysql', 'author': 'Tedezed', 'version': '0.1', 'frontend': 'wordpress', 'backend': 'mysql', 'check_app': True, 'update_app_password': True, 'update_secret': True, 'executable': False}
""" @author : udisinghania @date : 24/12/2018 """ string1 = input() string2 = input() a = 0 if len(string1)!=len(string2): print("Strings are of different length") else: for i in range (len(string1)): if string1[i]!=string2[i]: a+=1 print(a)
""" @author : udisinghania @date : 24/12/2018 """ string1 = input() string2 = input() a = 0 if len(string1) != len(string2): print('Strings are of different length') else: for i in range(len(string1)): if string1[i] != string2[i]: a += 1 print(a)
"""Minimize_sum_Of_array!!!, CodeWars Kata, level 7.""" def minimize_sum(arr): """Minimize sum of array. Find pairs of to multiply then add the product of those multiples to find the minimum possible sum input = integers, in a list output = integer, the minimum sum of those products ex: minS...
"""Minimize_sum_Of_array!!!, CodeWars Kata, level 7.""" def minimize_sum(arr): """Minimize sum of array. Find pairs of to multiply then add the product of those multiples to find the minimum possible sum input = integers, in a list output = integer, the minimum sum of those products ex: minSu...
# Copyright (c) 2011-2020 Eric Froemling # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish,...
points = {} boxes = {} boxes['area_of_interest_bounds'] = (0.4687647786, 2.320345088, -3.219423694) + (0.0, 0.0, 0.0) + (21.34898078, 10.25529817, 14.67298352) points['ffa_spawn1'] = (-5.828122667, 2.301094498, -3.445694701) + (1.0, 1.0, 2.682935578) points['ffa_spawn2'] = (6.496252674, 2.397778847, -3.573241388) + (1....
#!/usr/bin/python # -*- utf-8 -*- class Solution: # @param nums, a list of integer # @param k, num of steps # @return nothing, please modify the nums list in-place. def rotate(self, nums, k): copy = [e for e in nums] l = len(nums) k = l - k % l for i in range(l): ...
class Solution: def rotate(self, nums, k): copy = [e for e in nums] l = len(nums) k = l - k % l for i in range(l): nums[i] = copy[(k + i) % l] def rotate2(self, nums, k): if not nums: return l = len(nums) for i in range(k % l): ...