content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
""" Classes that represents a manifold. An object that contains information about a collision between two objects. """ class Manifold: """ A manifold representation that gives information about collision of two objects. """ def __init__(self, obj_a, obj_b, penetration, normal): self.obj_a ...
""" Classes that represents a manifold. An object that contains information about a collision between two objects. """ class Manifold: """ A manifold representation that gives information about collision of two objects. """ def __init__(self, obj_a, obj_b, penetration, normal): self.obj_a ...
class Queen: def __init__(self, row, column): if row < 0: raise ValueError("row not positive") if not 0 <= row <= 7: raise ValueError("row not on board") if column < 0: raise ValueError("column not positive") if not 0 <= column <= 7: rai...
class Queen: def __init__(self, row, column): if row < 0: raise value_error('row not positive') if not 0 <= row <= 7: raise value_error('row not on board') if column < 0: raise value_error('column not positive') if not 0 <= column <= 7: ...
class BaseClassAnnotated: def __init__(self, name: str): self.name = name class DerivedClass(BaseClassAnnotated): def __init__(self, name: str): super().__init__(name) self.param = None def get_param(self): return self.param
class Baseclassannotated: def __init__(self, name: str): self.name = name class Derivedclass(BaseClassAnnotated): def __init__(self, name: str): super().__init__(name) self.param = None def get_param(self): return self.param
name = "Baidu" url = "http://m.baidu.com/" clip = "baidu" ua = None if not self.isCheckable(): self.setCheckable(True) self.setChecked(True) if not self.parentWindow().hasSideBar(name): self.parentWindow().addSideBar(name, url, clip, ua) else: self.parentWindow().toggleSideBar(name)
name = 'Baidu' url = 'http://m.baidu.com/' clip = 'baidu' ua = None if not self.isCheckable(): self.setCheckable(True) self.setChecked(True) if not self.parentWindow().hasSideBar(name): self.parentWindow().addSideBar(name, url, clip, ua) else: self.parentWindow().toggleSideBar(name)
""" Profile ../profile-datasets-py/div83/065.py file automaticaly created by prof_gen.py script """ self["ID"] = "../profile-datasets-py/div83/065.py" self["Q"] = numpy.array([ 2.70142300e+00, 3.40702800e+00, 4.79249700e+00, 6.17865200e+00, 6.52696700e+00, 6.52924700e+00, 6.5193...
""" Profile ../profile-datasets-py/div83/065.py file automaticaly created by prof_gen.py script """ self['ID'] = '../profile-datasets-py/div83/065.py' self['Q'] = numpy.array([2.701423, 3.407028, 4.792497, 6.178652, 6.526967, 6.529247, 6.519347, 6.478238, 6.400529, 6.29246, 6.163482, 5.952795, 5.697258, 5.4...
class Solution: def findShortestWay(self, maze, ball, hole): m, n, q, stopped = len(maze), len(maze[0]), [(0, "", ball[0], ball[1])], {(ball[0], ball[1]): [0, ""]} while q: dist, pattern, x, y = heapq.heappop(q) if [x, y] == hole: return pattern fo...
class Solution: def find_shortest_way(self, maze, ball, hole): (m, n, q, stopped) = (len(maze), len(maze[0]), [(0, '', ball[0], ball[1])], {(ball[0], ball[1]): [0, '']}) while q: (dist, pattern, x, y) = heapq.heappop(q) if [x, y] == hole: return pattern ...
#!/usr/bin/env python # Copyright 2017 The Forseti Security Authors. 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 # #...
"""Test instance group managers data.""" fake_api_response1 = [{'kind': 'compute#instanceGroup', 'id': '1532459550555580553', 'creationTimestamp': '2017-05-26T13:56:06.149-07:00', 'name': 'iap-ig', 'description': "This instance group is controlled by Instance Group Manager 'iap-ig'. To modify instances in this group, u...
class HashTable: def __init__(self, len = 4): self._array = [] for i in range(len): self._array.append([]) def hash(self, key): ''' Use python hash function and len to get the index :param key: object :return: number ''' ln = len(sel...
class Hashtable: def __init__(self, len=4): self._array = [] for i in range(len): self._array.append([]) def hash(self, key): """ Use python hash function and len to get the index :param key: object :return: number """ ln = len(self._...
#function for getting the mutational positions and relevant information from VCF file #-------------------------------------------------------------------------------------------------------------------------- def Get_Variant_PositionsMutationScores(VCFpath): """ VCFpath is the variant.vcf file path returns a li...
def get__variant__positions_mutation_scores(VCFpath): """ VCFpath is the variant.vcf file path returns a list with all positions """ (positions, mutations, scores) = ([], [], []) vcf_file = open(VCFpath, 'r') for line in vcf_file: if line[0] != '#': POSITIONS.append(line.split('\...
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def okapi_deps(): maybe( http_archive, "bazel_skylib", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1....
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe') def okapi_deps(): maybe(http_archive, 'bazel_skylib', urls=['https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz', 'https:/...
def main(): data = ("Robin", 10, "chocolates") format_string = "Hello %s. You are currently left with %d %s." print(format_string %data) return 0 if __name__ == '__main__': main()
def main(): data = ('Robin', 10, 'chocolates') format_string = 'Hello %s. You are currently left with %d %s.' print(format_string % data) return 0 if __name__ == '__main__': main()
x = int(input()) y = int(input()) if x > y: a = y b = x if x <= y: a = x b = y a=a+1 while a < b: if a % 5 == 2 or a % 5 == 3: print(a) a = a + 1
x = int(input()) y = int(input()) if x > y: a = y b = x if x <= y: a = x b = y a = a + 1 while a < b: if a % 5 == 2 or a % 5 == 3: print(a) a = a + 1
# flake8: noqa led_grey = b'iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QkZDh80173PwgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAgAElEQVR42u2d228bR57vv30nRYqUZMlWHMcXObJkOx6fjAfwmcBYIEAOdt/maR4GmOf8Ud7dt3mbp32fOVnM4uzsOQNvMAh2Z5ONZwNbtuT4xJYo...
led_grey = b'iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QkZDh80173PwgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAgAElEQVR42u2d228bR57vv30nRYqUZMlWHMcXObJkOx6fjAfwmcBYIEAOdt/maR4GmOf8Ud7dt3mbp32fOVnM4uzsOQNvMAh2Z5ONZwNbtuT4xJYoSrz0bR+s6imWqru...
# signature types SIGHASH_ALL = 1 SIGHASH_NONE = 2 SIGHASH_SINGLE = 3 SIGHASH_FORKID = 0x40 SIGHASH_ANYONECANPAY = 0x80
sighash_all = 1 sighash_none = 2 sighash_single = 3 sighash_forkid = 64 sighash_anyonecanpay = 128
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ roman = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000 } last = 0 ...
class Solution(object): def roman_to_int(self, s): """ :type s: str :rtype: int """ roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} last = 0 ans = 0 for i in s: ans += roman[i] if roman[i] > last: ...
#! /usr/bin/env python3 n, m = map(int, input().split()) if n == 3: print(3, 0) print(3, 1, 2) else: print(0, 2) print(1, 2) print(3, 4)
(n, m) = map(int, input().split()) if n == 3: print(3, 0) print(3, 1, 2) else: print(0, 2) print(1, 2) print(3, 4)
class Solution(object): def isPerfectSquare(self, num): """ :type num: int :rtype: bool """ start = 1 while num > 0: num -= start start += 2 return num == 0
class Solution(object): def is_perfect_square(self, num): """ :type num: int :rtype: bool """ start = 1 while num > 0: num -= start start += 2 return num == 0
# # PySNMP MIB module LIGO-802DOT11-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LIGO-802DOT11-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:07:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ...
# # PySNMP MIB module HH3C-SNMP-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-SNMP-EXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:29:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, single_value_constraint, value_size_constraint) ...
def getGuessedWord(secretWord, lettersGuessed): ''' secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: string, comprised of letters and underscores that represents what letters in secretWord have been guessed so far. ''' # F...
def get_guessed_word(secretWord, lettersGuessed): """ secretWord: string, the word the user is guessing lettersGuessed: list, what letters have been guessed so far returns: string, comprised of letters and underscores that represents what letters in secretWord have been guessed so far. """ s...
def main(): try: configuration = open('config.txt') except Exception: print("Couldn't find the config.txt file!") if __name__ == '__main__': main()
def main(): try: configuration = open('config.txt') except Exception: print("Couldn't find the config.txt file!") if __name__ == '__main__': main()
#from sys import stdin #file = stdin file = open(r'.\data\maplambda.txt', 'rt' ) data = int(file.read().strip()) def fib(n): result = [] a, b = 0, 1 while n > 0: result.append(a) a, b = b, a+b n -= 1 return result print(list(map(lambda x: x**3, fib(data)))) #print(*map(lambda x: x**3, fib(data)), sep="\n")
file = open('.\\data\\maplambda.txt', 'rt') data = int(file.read().strip()) def fib(n): result = [] (a, b) = (0, 1) while n > 0: result.append(a) (a, b) = (b, a + b) n -= 1 return result print(list(map(lambda x: x ** 3, fib(data))))
# Write code to remove duplicattes from an unsorted linked list # Follow up: # How would you solve this problem if a temporary # buffer is not allowed? class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def __repr__(self): return self.data de...
class Node: def __init__(self, data=None, next=None): self.data = data self.next = next def __repr__(self): return self.data def set_next(self, new_next): self.next = new_next def get_next(self): return self.next class Linkedlist: def __init__(self, node...
#!/usr/bin/env python3 # Some columns are longer than others table1 = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose', 'duck']] table2 = [] def print_table(table): # Find out the number of rows of the longest columns # and the...
table1 = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose', 'duck']] table2 = [] def print_table(table): max_row = 0 widths = {} for (col, index) in zip(table, range(len(table))): max_row = max(max_row, len(col)) col_width = ...
#my solution print("Welcome to the tip calculator.") total_bill = float(input("What was the total bill? ")) amount_of_people = int(input("How many people to split the bill? ")) tip = int(input("What percentage tip would you like to give? 10, 12, or 15? ")) payment = float((tip * total_bill/100 + total_bill)/amount_of_...
print('Welcome to the tip calculator.') total_bill = float(input('What was the total bill? ')) amount_of_people = int(input('How many people to split the bill? ')) tip = int(input('What percentage tip would you like to give? 10, 12, or 15? ')) payment = float((tip * total_bill / 100 + total_bill) / amount_of_people) pa...
""" This file is part of Ludolph: Ansible plugin Copyright (C) 2015 Erigones, s. r. o. See the LICENSE file for copying permission. """ __version__ = '0.4'
""" This file is part of Ludolph: Ansible plugin Copyright (C) 2015 Erigones, s. r. o. See the LICENSE file for copying permission. """ __version__ = '0.4'
#!/usr/bin/python3 # 3-common_elements.py def common_elements(set_1, set_2): """Return a set of common elements in two sets.""" return (set_1 & set_2)
def common_elements(set_1, set_2): """Return a set of common elements in two sets.""" return set_1 & set_2
def say_hello(name=None): if name is None: return "Hello, world!" else: return f"Hello, {name}!"
def say_hello(name=None): if name is None: return 'Hello, world!' else: return f'Hello, {name}!'
# coding: utf-8 ############################################################################## # Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries. # # Subject to your compliance with these terms, you may use Microchip software # and any derivatives exclusively with Microchip products. It is your # resp...
same54cult_component_id_list = ['sercom7', 'sys_time', 'tc0'] same54cult_auto_connect_list = [['bluetooth_bm64', 'USART PLIB', 'sercom7', 'SERCOM7_UART'], ['sys_time', 'sys_time_TMR_dependency', 'tc0', 'TC0_TMR']] same54cult_pin_configs = [{'pin': 56, 'name': 'SERCOM7_PAD0', 'type': 'SERCOM7_PAD0', 'direction': '', 'la...
n = int(input()) name = [] for _ in range(n): name.append(input()) if name == sorted(name): print("INCREASING") elif name == sorted(name)[::-1]: print("DECREASING") else: print("NEITHER")
n = int(input()) name = [] for _ in range(n): name.append(input()) if name == sorted(name): print('INCREASING') elif name == sorted(name)[::-1]: print('DECREASING') else: print('NEITHER')
BLACK = (0,0,0) WHITE = (255,255,255) GREEN = (0,255,0) RED = (255,0,0) BLUE = (0,0,255) colors = {'Black': BLACK, 'White': WHITE, 'Green': GREEN, 'Red': RED, 'Blue': BLUE}
black = (0, 0, 0) white = (255, 255, 255) green = (0, 255, 0) red = (255, 0, 0) blue = (0, 0, 255) colors = {'Black': BLACK, 'White': WHITE, 'Green': GREEN, 'Red': RED, 'Blue': BLUE}
# pinspect_support_module_4.py # Copyright (c) 2013-2019 Pablo Acosta-Serafini # See LICENSE for details # pylint: disable=C0111,W0212 USAGE1 = """\ This is a test\ of a multi-line string """ USAGE2 = r""" This is a test of a raw multi-line string """ USAGE3 = r"""This is a test of a single-line stri...
usage1 = ' This is a test of a multi-line string ' usage2 = '\n This is a test\n of a raw multi-line string ' usage3 = 'This is a test of a single-line string' def another_property_action_enclosing_function(): """Generator function to test namespace support for enclosed class properties.""" def fg...
def func(): """ A multi-line docstring """ def inner_func(): """ A multi-line docstring"""
def func(): """ A multi-line docstring """ def inner_func(): """ A multi-line docstring"""
# Copyright 2017, bwsoft management # # 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 required by applicable law or agreed to in wr...
class Ianalysis(object): def __init__(self, config, historical_data_repository, alert_sender, data_structure): self._config = config self._historical_data_repository = historical_data_repository self._alert_sender = alert_sender self._input_fields = dict(map(lambda x: reversed(x), e...
''' The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the file. By using the read4 API, implement the function int read(char *buf, int n) that reads n characters from the fil...
""" The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the file. By using the read4 API, implement the function int read(char *buf, int n) that reads n characters from the fil...
''' Created on 1.12.2016 @author: Darren '''''' Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the following is not: 1 / \ 2 2...
""" Created on 1.12.2016 @author: Darren Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / 2 2 / \\ / 3 4 4 3 But the following is not: 1 / 2 2 \\ 3 3 Not...
def find_substring(string: str, substring: str) -> int: l1 = len(string) l2 = len(substring) for i in range(l1 - l2 + 1): status = True for j in range(l2): if string[i+j] != substring[j]: status = False if status: return i if ...
def find_substring(string: str, substring: str) -> int: l1 = len(string) l2 = len(substring) for i in range(l1 - l2 + 1): status = True for j in range(l2): if string[i + j] != substring[j]: status = False if status: return i if __name__ == '__m...
def list_headers(catalog, headers=True): result = [] if isinstance(headers, set): for header in catalog: if header in headers: result.append(header) else: result = catalog.keys() return set(result)
def list_headers(catalog, headers=True): result = [] if isinstance(headers, set): for header in catalog: if header in headers: result.append(header) else: result = catalog.keys() return set(result)
folium.Marker([42.333600, -71.109500], popup='<strong>Location Two</strong>', tooltip=tooltip, icon=folium.Icon(icon='cloud')).add_to(m), folium.Marker([42.377120, -71.062400], popup='<strong>Location Three</strong>', tooltip=tooltip, i...
(folium.Marker([42.3336, -71.1095], popup='<strong>Location Two</strong>', tooltip=tooltip, icon=folium.Icon(icon='cloud')).add_to(m),) (folium.Marker([42.37712, -71.0624], popup='<strong>Location Three</strong>', tooltip=tooltip, icon=folium.Icon(color='purple')).add_to(m),) (folium.Marker([42.37415, -71.12241], popup...
# Create a list of strings: fellowship fellowship = ['frodo', 'samwise', 'merry', 'aragorn', 'legolas', 'boromir', 'gimli'] # Create dict comprehension: new_fellowship new_fellowship = { member:len(member) for member in fellowship } # Print the new dictionary print(new_fellowship)
fellowship = ['frodo', 'samwise', 'merry', 'aragorn', 'legolas', 'boromir', 'gimli'] new_fellowship = {member: len(member) for member in fellowship} print(new_fellowship)
# @params: # str - string to perform subsets breakdown # n (optional) - nth order to break def get_string_subsets(str): subsets = [] for index in range(len(str)): if(index == 0): subsets.append(str[index]) else: subsets.append(subsets[index-1] + str[index]) ret...
def get_string_subsets(str): subsets = [] for index in range(len(str)): if index == 0: subsets.append(str[index]) else: subsets.append(subsets[index - 1] + str[index]) return subsets
#!python3.6 #coding:utf-8 #class complex([real[, imag]]) print(complex(3, 2))
print(complex(3, 2))
# # PySNMP MIB module ELTEX-MES-CFM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-CFM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:01:03 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
def mean(num_list): try: return sum(num_list)/len(num_list) except ZeroDivisionError: return 0 except TypeError: raise TypeError("Cannot get mean for non-number elements")
def mean(num_list): try: return sum(num_list) / len(num_list) except ZeroDivisionError: return 0 except TypeError: raise type_error('Cannot get mean for non-number elements')
#!/usr/bin/env python3 # Some data formatters that I seem to need from time to time... def rat(n, d, nan=float('nan'), mul=1.0): """ Calculate a ratio while avoiding division by zero errors. Strictly speaking we should have nan=float('nan') but for practical purposes we'll maybe want to report Non...
def rat(n, d, nan=float('nan'), mul=1.0): """ Calculate a ratio while avoiding division by zero errors. Strictly speaking we should have nan=float('nan') but for practical purposes we'll maybe want to report None (or 0.0?). """ try: return float(n) * mul / float(d) except (ZeroDi...
""" :author: Jinfen Li :url: https://github.com/LiJinfen """
""" :author: Jinfen Li :url: https://github.com/LiJinfen """
recent = { 9: (1, 1), 3: (2, 2), 1: (3, 3), 0: (4, 4), 8: (5, 5), 4: (6, 6) } last = 4 for turn in range(len(recent.keys()) + 1, 30_000_001): last = recent[last][1] - recent[last][0] recent[last] = (recent[last][1] if last in recent else turn, turn) print(last)
recent = {9: (1, 1), 3: (2, 2), 1: (3, 3), 0: (4, 4), 8: (5, 5), 4: (6, 6)} last = 4 for turn in range(len(recent.keys()) + 1, 30000001): last = recent[last][1] - recent[last][0] recent[last] = (recent[last][1] if last in recent else turn, turn) print(last)
def clean_empty(pkg, dpath): empty = True for f in dpath.iterdir(): if f.is_dir() and not f.is_symlink(): if not clean_empty(pkg, f): empty = False else: empty = False if empty and dpath != pkg.destdir: pr = dpath.relative_to(pkg.destdir) ...
def clean_empty(pkg, dpath): empty = True for f in dpath.iterdir(): if f.is_dir() and (not f.is_symlink()): if not clean_empty(pkg, f): empty = False else: empty = False if empty and dpath != pkg.destdir: pr = dpath.relative_to(pkg.destdir) ...
def find_disappeared_numbers(nums): """ :type nums: List[int] :rtype: List[int] """ result1 = [0]*len(nums) result2 = [] for i in range(0, len(nums)): if result1[nums[i]-1]==0: result1[nums[i]-1] = nums[i] else: pass ...
def find_disappeared_numbers(nums): """ :type nums: List[int] :rtype: List[int] """ result1 = [0] * len(nums) result2 = [] for i in range(0, len(nums)): if result1[nums[i] - 1] == 0: result1[nums[i] - 1] = nums[i] else: pass for i in range(0, len(r...
if __name__ == '__main__': fin = open('input.txt', 'r') fout = open('output.txt', 'w') k = int(fin.readline()) s = ['1' for i in range(k)] counts = set() counts.add('1' * k) need = 2 ** k have = 1 while have < need: ss = s[-k+1:] if ''.join(ss) + '0' in counts: ...
if __name__ == '__main__': fin = open('input.txt', 'r') fout = open('output.txt', 'w') k = int(fin.readline()) s = ['1' for i in range(k)] counts = set() counts.add('1' * k) need = 2 ** k have = 1 while have < need: ss = s[-k + 1:] if ''.join(ss) + '0' in counts: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Options: def __init__(self, telegram_bot_token: str): self.telegram_bot_token = telegram_bot_token
class Options: def __init__(self, telegram_bot_token: str): self.telegram_bot_token = telegram_bot_token
# noinspection PyUnusedLocal # friend_name = unicode string def hello(friend_name): """ Return hello message for a friend :param: friend_name: the person's name :return: String containing the message """ return f'Hello, {friend_name}!'
def hello(friend_name): """ Return hello message for a friend :param: friend_name: the person's name :return: String containing the message """ return f'Hello, {friend_name}!'
def knight_move(row, col): """knight_move (row, col) - returns all possible movements for the knight in chess based on the parameters of its current row and column""" # Deltas and Column Names columns = ["A", "B", "C", "D", "E", "F", "G", "H"] possible_moves = [(2, -1), (2, 1), (1, 2), (-1, 2), (-2...
def knight_move(row, col): """knight_move (row, col) - returns all possible movements for the knight in chess based on the parameters of its current row and column""" columns = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] possible_moves = [(2, -1), (2, 1), (1, 2), (-1, 2), (-2, 1), (-2, -1), (-1, -2), (1, -...
# -*- coding: utf-8 -*- # This is Testaction 2 def main(args): number = args.get("number") square = number+number print(square) return {"number":square} #if __name__=="__main__": # main({"number":4})
def main(args): number = args.get('number') square = number + number print(square) return {'number': square}
""" Written in Python 3. This program is all yours now! Have fun experimenting!! This program accepts a sentence and prints the frequency of all the letters in the sentence. teaches: creating functions, function calling, loops, bubble sort algorithm, lists (arrays), dictionary. """ def main(): sentence = input("\...
""" Written in Python 3. This program is all yours now! Have fun experimenting!! This program accepts a sentence and prints the frequency of all the letters in the sentence. teaches: creating functions, function calling, loops, bubble sort algorithm, lists (arrays), dictionary. """ def main(): sentence = input...
d = {} l = [1] try: d[l] = 2 except TypeError: pass else: print('Should not be able to use a list as a dict key!') a = {} try: d[a] = 2 except TypeError: pass else: print('Should not be able to use a dict as a dict key!')
d = {} l = [1] try: d[l] = 2 except TypeError: pass else: print('Should not be able to use a list as a dict key!') a = {} try: d[a] = 2 except TypeError: pass else: print('Should not be able to use a dict as a dict key!')
class Error(Exception): """Main error class to be inherited in all app's custom errors.""" def __init__(self, message: str = '', status_code: int = 400) -> None: super().__init__(message) if type(message) is str: self.message: str = message else: raise TypeError( ...
class Error(Exception): """Main error class to be inherited in all app's custom errors.""" def __init__(self, message: str='', status_code: int=400) -> None: super().__init__(message) if type(message) is str: self.message: str = message else: raise type_error(f'E...
def getIpBin(ip): ipBin = '' for index, octet in enumerate(ip.split("."), 1): ipBin += str(format(int(octet), '08b')) if index != 4: ipBin += "." return ipBin def getIpClass(ip): octet = ip.split(".") if 1 <= int(octet[0]) < 128: return 'A' elif 128 <= int(octet[0])...
def get_ip_bin(ip): ip_bin = '' for (index, octet) in enumerate(ip.split('.'), 1): ip_bin += str(format(int(octet), '08b')) if index != 4: ip_bin += '.' return ipBin def get_ip_class(ip): octet = ip.split('.') if 1 <= int(octet[0]) < 128: return 'A' elif 128 ...
OCTICON_PLUS_CIRCLE = """ <svg class="octicon octicon-plus-circle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zm.75 4.75a.75.75 0 00-1.5 0v2.5h-2.5a.75.75 0 000 1.5h2.5v2.5a.75.75 0 00...
octicon_plus_circle = '\n<svg class="octicon octicon-plus-circle" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zm.75 4.75a.75.75 0 00-1.5 0v2.5h-2.5a.75.75 0 000 1.5h2.5v2.5a.75.75 0 001....
# -*- coding: utf-8 -*- """ Created on Sun Oct 4 23:51:51 2020 @author: heziy """
""" Created on Sun Oct 4 23:51:51 2020 @author: heziy """
pi = 3.14159 R = float(input()) volume = (4/3) * pi * R ** 3 print('VOLUME = {:.3f}'.format(volume))
pi = 3.14159 r = float(input()) volume = 4 / 3 * pi * R ** 3 print('VOLUME = {:.3f}'.format(volume))
''' Extracted and modified from https://github.com/dirkmoors/drf-tus available under MIT License, Copyright (c) 2017, Dirk Moors ''' default_app_config = 'froide.upload.apps.UploadConfig' tus_api_version = '1.0.0' tus_api_version_supported = ['1.0.0'] tus_api_extensions = ['creation', 'creation-defer-length', 'ter...
""" Extracted and modified from https://github.com/dirkmoors/drf-tus available under MIT License, Copyright (c) 2017, Dirk Moors """ default_app_config = 'froide.upload.apps.UploadConfig' tus_api_version = '1.0.0' tus_api_version_supported = ['1.0.0'] tus_api_extensions = ['creation', 'creation-defer-length', 'termin...
for _ in range(int(input())): n=int(input()) s=input() for i in range(5): if s[0:i]+s[n-(4-i):n]=='2020': print('YES') break else: print('NO')
for _ in range(int(input())): n = int(input()) s = input() for i in range(5): if s[0:i] + s[n - (4 - i):n] == '2020': print('YES') break else: print('NO')
""" Created by akiselev on 2019-06-17 Task You are given three integers: a, b, and m , respectively. Print two lines. The first line should print the result of pow(a,b). The second line should print the result of pow(a,b,m). Input Format The first line contains a , the second line contains b, and the third line co...
""" Created by akiselev on 2019-06-17 Task You are given three integers: a, b, and m , respectively. Print two lines. The first line should print the result of pow(a,b). The second line should print the result of pow(a,b,m). Input Format The first line contains a , the second line contains b, and the third line co...
stockCount = int(input()) stock = [] for x in range(stockCount): info = input().split(",") tupleVersion = (info[0], info[1], info[2]) stock.append(tupleVersion) stock = sorted(stock, key=lambda a: a[0]) companyNames = [] for i in stock: if i[0] not in companyNames: companyNames.append(i[0]) comp...
stock_count = int(input()) stock = [] for x in range(stockCount): info = input().split(',') tuple_version = (info[0], info[1], info[2]) stock.append(tupleVersion) stock = sorted(stock, key=lambda a: a[0]) company_names = [] for i in stock: if i[0] not in companyNames: companyNames.append(i[0]) c...
# -------------- "solution" # -------------- "solution"
"""solution""" 'solution'
# # PySNMP MIB module TRIPPLITE-PRODUCTS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRIPPLITE-PRODUCTS # Produced by pysmi-0.3.4 at Wed May 1 15:27:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint, constraints_union) ...
def _tool_config( executable, additional_tools = [], args = [], env = {}, execution_requirements = {}): return struct( executable = executable, additional_tools = additional_tools, args = args, env = env, execution_requirements = execut...
def _tool_config(executable, additional_tools=[], args=[], env={}, execution_requirements={}): return struct(executable=executable, additional_tools=additional_tools, args=args, env=env, execution_requirements=execution_requirements) action_names = struct(BUILD='SPMBuild') actions = struct(tool_config=_tool_config)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # TODO: from dev_window # from PySide.QtWebKit import * # # QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True) # # self.view = QWebView() # self.setCentralWidget(self.view) # # self.view.load('https://twitter.c...
__author__ = 'ipetrash'
"""Defines the exceptions used by xnat sub-modules""" class XnatException(Exception): """Default exception for xnat errors""" def __init__(self, msg, study=None, session=None): # Call the base class constructor with the parameters it needs super().__init__(msg) # Now for your custom ...
"""Defines the exceptions used by xnat sub-modules""" class Xnatexception(Exception): """Default exception for xnat errors""" def __init__(self, msg, study=None, session=None): super().__init__(msg) self.study = study self.session = session class Dashboardexception(Exception): """...
# -------------- # settings pw = ph = 500 amount = 24 factor = 1/3 regular = False cell_s = pw / (amount + 2) # -------------- # function(s) def I(pos, s): x, y = pos polygon( (-s/2, -s/2), (-s/2, +s/2), (-s/2 * factor, +s/2), (-s/2 * factor, +s/2 * (1 - factor)/2), ...
pw = ph = 500 amount = 24 factor = 1 / 3 regular = False cell_s = pw / (amount + 2) def i(pos, s): (x, y) = pos polygon((-s / 2, -s / 2), (-s / 2, +s / 2), (-s / 2 * factor, +s / 2), (-s / 2 * factor, +s / 2 * (1 - factor) / 2), (+s / 2 * factor, +s / 2 * (1 - factor) / 2), (+s / 2 * factor, +s / 2), (+s / 2, ...
""" # Definition for a Node. class Node: def __init__(self, val = 0, neighbors = None): self.val = val self.neighbors = neighbors if neighbors is not None else [] """ class Solution: def cloneGraph(self, node: 'Node') -> 'Node': if node==None: return None stack = deq...
""" # Definition for a Node. class Node: def __init__(self, val = 0, neighbors = None): self.val = val self.neighbors = neighbors if neighbors is not None else [] """ class Solution: def clone_graph(self, node: 'Node') -> 'Node': if node == None: return None stack =...
newline = "\n" with open("AoC6.txt", 'r') as File1: info = [] for line in File1: if line == "\n": info.append("\n\n") else: info.append(f'''{line.split(newline)[0]}\n''') # print(info) customs = [] customs = "".join(info).split("\n\n") # print(customs) for i in range(le...
newline = '\n' with open('AoC6.txt', 'r') as file1: info = [] for line in File1: if line == '\n': info.append('\n\n') else: info.append(f'{line.split(newline)[0]}\n') customs = [] customs = ''.join(info).split('\n\n') for i in range(len(customs)): customs[i] = customs...
sum0 = 0 # If i is divisible by 3 or 5, add to sum for i in range(100): if (i%3 == 0 or i%5==0): sum0 += i # Print answer print('The sum is: ' + str(sum0))
sum0 = 0 for i in range(100): if i % 3 == 0 or i % 5 == 0: sum0 += i print('The sum is: ' + str(sum0))
{ 'targets': [ { 'target_name': 'kexec', 'sources': [ 'src/kexec.cc' ], 'defines': [ '<!@(node -v |grep "v4" > /dev/null && echo "__NODE_V4__" || true)', '<!@(node -v |grep "v0.1[12]" > /dev/null && echo "__NODE_V0_11_OR_12__" || true)', '<!@(command -v iojs > /dev/null &...
{'targets': [{'target_name': 'kexec', 'sources': ['src/kexec.cc'], 'defines': ['<!@(node -v |grep "v4" > /dev/null && echo "__NODE_V4__" || true)', '<!@(node -v |grep "v0.1[12]" > /dev/null && echo "__NODE_V0_11_OR_12__" || true)', '<!@(command -v iojs > /dev/null && echo "__NODE_V0_11_OR_12__" || true)', '<!@(node -v ...
class Solution: def chalkReplacer(self, chalk: List[int], k: int) -> int: i = 0 sumchalk = sum(chalk) k = k % sumchalk while k >= 0: k -= chalk[i] i = (i + 1) % len(chalk) return (i + len(chalk) - 1) % len(chalk)
class Solution: def chalk_replacer(self, chalk: List[int], k: int) -> int: i = 0 sumchalk = sum(chalk) k = k % sumchalk while k >= 0: k -= chalk[i] i = (i + 1) % len(chalk) return (i + len(chalk) - 1) % len(chalk)
class AMAUtils(): def __init__(self, ws): self.ws = ws def _confirm_ws_type(self, ref): """confirm whether 'ref' is of type 'KBaseMetagenomes.AnnotatedMetagenomeAssembly if not, throw error. """ if ref is None: raise ValueError(" 'ref' argument must be specified.") ...
class Amautils: def __init__(self, ws): self.ws = ws def _confirm_ws_type(self, ref): """confirm whether 'ref' is of type 'KBaseMetagenomes.AnnotatedMetagenomeAssembly if not, throw error. """ if ref is None: raise value_error(" 'ref' argument must be specified.") ...
expected_output = { "instance": { "master": { "areas": { "0.0.0.1": { "interfaces": { "ge-0/0/4.0": { "state": "PtToPt", "dr_id": "10.16.2.1", "bdr_id":...
expected_output = {'instance': {'master': {'areas': {'0.0.0.1': {'interfaces': {'ge-0/0/4.0': {'state': 'PtToPt', 'dr_id': '10.16.2.1', 'bdr_id': '10.64.2.4', 'nbrs_count': 1}}}}}}}
""" Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise. Each letter in magazine can only be used once in ransomNote. Example 1: Input: ransomNote = "a", magazine = "b" Output: false Example 2: Input: ransomNote = "aa", magazine = "ab" Output: ...
""" Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise. Each letter in magazine can only be used once in ransomNote. Example 1: Input: ransomNote = "a", magazine = "b" Output: false Example 2: Input: ransomNote = "aa", magazine = "ab" Output: ...
""" https://leetcode.com/problems/binary-tree-inorder-traversal/ Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,3,2] Follow up: Recursive solution is trivial, could you do it iteratively? """ # time complexity: O(n), space...
""" https://leetcode.com/problems/binary-tree-inorder-traversal/ Given a binary tree, return the inorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 2 / 3 Output: [1,3,2] Follow up: Recursive solution is trivial, could you do it iteratively? """ class Solution: def inorder...
class TrainData: def __init__(self, batch_size): self.batch_size = batch_size self.train_size = 0 self.validation_size = 0 def next_batch(self): raise NotImplementedError def validation_data(self): # validation data for early stopping of vae training # shoul...
class Traindata: def __init__(self, batch_size): self.batch_size = batch_size self.train_size = 0 self.validation_size = 0 def next_batch(self): raise NotImplementedError def validation_data(self): raise NotImplementedError def validation_samples(self, size=2)...
cars = ['bmw', 'audi', 'toyota', 'subaru'] print(cars) print(sorted(cars)) print(cars) cars.sort() print(cars)
cars = ['bmw', 'audi', 'toyota', 'subaru'] print(cars) print(sorted(cars)) print(cars) cars.sort() print(cars)
"""Tests for coverage-related command line flags under various configs.""" load( "@build_bazel_rules_swift//test/rules:action_command_line_test.bzl", "make_action_command_line_test_rule", ) default_coverage_test = make_action_command_line_test_rule( config_settings = { "//command_line_option:colle...
"""Tests for coverage-related command line flags under various configs.""" load('@build_bazel_rules_swift//test/rules:action_command_line_test.bzl', 'make_action_command_line_test_rule') default_coverage_test = make_action_command_line_test_rule(config_settings={'//command_line_option:collect_code_coverage': 'true'}) c...
""" Description: Combines the list of different stopwords files Author: Harshit Varma """ with open("smart_stop_list.txt", "r", encoding = "ascii") as f: ssl = f.readlines() ssl = [w.strip() for w in ssl[1:]] # Skip the first line with open("names.txt", "r", encoding = "ascii") as f: names = f.readlin...
""" Description: Combines the list of different stopwords files Author: Harshit Varma """ with open('smart_stop_list.txt', 'r', encoding='ascii') as f: ssl = f.readlines() ssl = [w.strip() for w in ssl[1:]] with open('names.txt', 'r', encoding='ascii') as f: names = f.readlines() names = [w.strip() for ...
HOST_SORUCE = "ip_of_the_mysql_host" SCHEMA_SORUCE = "world" USER_SORUCE = "root" PASSWORD_SORUCE = "rootpassword" PORT_SORUCE = 6603 HOST_METADATA = "ip_of_the_mysql_host" SCHEMA_METADATA = "demo" USER_METADATA = "demo" PASSWORD_METADATA = "metadata" PORT_METADATA = 6603
host_soruce = 'ip_of_the_mysql_host' schema_soruce = 'world' user_soruce = 'root' password_soruce = 'rootpassword' port_soruce = 6603 host_metadata = 'ip_of_the_mysql_host' schema_metadata = 'demo' user_metadata = 'demo' password_metadata = 'metadata' port_metadata = 6603
class ServiceBase(object): def __init__(self, protocol, ports, flags): self.service_protocol = protocol self.flags = flags self.ports = ports #TODO: check if return path needs to be enabled self.enable_return_path = False @property def IsReturnPathEnabled(self): ...
class Servicebase(object): def __init__(self, protocol, ports, flags): self.service_protocol = protocol self.flags = flags self.ports = ports self.enable_return_path = False @property def is_return_path_enabled(self): return self.enable_return_path @property ...
class Mode: ANY = -1 #used in api to disable mode filtering ALL = ANY STD = 0 TAIKO = 1 CTB = 2 MANIA = 3 OSU = STD CATCHTHEBEAT = CTB LAST = MANIA class Mods: MASK_NM = 0 MASK_NF = 1 << 0 MASK_EZ = 1 << 1 MASK_TD = 1 << 2 MASK_HD = 1 << 3 MASK_HR = 1 << 4 MASK_SD = 1 << 5 MASK_DT = 1 << 6 MASK_RL = ...
class Mode: any = -1 all = ANY std = 0 taiko = 1 ctb = 2 mania = 3 osu = STD catchthebeat = CTB last = MANIA class Mods: mask_nm = 0 mask_nf = 1 << 0 mask_ez = 1 << 1 mask_td = 1 << 2 mask_hd = 1 << 3 mask_hr = 1 << 4 mask_sd = 1 << 5 mask_dt = 1 << 6...
# Copyright 2013, 2014 Rackspace # 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 required ...
unset = object() class Attribute(object): """ Describe an attribute. """ def __init__(self, default=unset, validate=lambda x: x, getstate=lambda x: x): """ Initialize an ``Attribute`` object. :param default: The default value of the attribute. If unset, ...
class Session: """ This class is dummy for static analysis. This should be dynamically overridden by sessionmaker(bind=engine). """ def commit(self): pass def rollback(self): pass def close(self): pass
class Session: """ This class is dummy for static analysis. This should be dynamically overridden by sessionmaker(bind=engine). """ def commit(self): pass def rollback(self): pass def close(self): pass
class MyTest: def __init__(self): self.__foo = 1 self.__bar = "hello" def get_foo(self): return self.__foo def get_bar(self): return self.__bar
class Mytest: def __init__(self): self.__foo = 1 self.__bar = 'hello' def get_foo(self): return self.__foo def get_bar(self): return self.__bar
number = int(input()) first = number%10 variable = number%100 second = variable//10 third = number//100 result = 2*(first*100 + second*10 + third) print(result)
number = int(input()) first = number % 10 variable = number % 100 second = variable // 10 third = number // 100 result = 2 * (first * 100 + second * 10 + third) print(result)
# # PySNMP MIB module PWG-IMAGING-COUNTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PWG-IMAGING-COUNTER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:34:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
class Key: def __init__(self, enc_key=None, x5t_256=None): self.enc_key = enc_key self.x5t_256 = x5t_256 def to_json(self): return {'enc_key': self.enc_key if self.enc_key else '', 'x5t_256': self.x5t_256 if self.x5t_256 else ''} class Encdata: def __init__(self): self.da...
a = [1, "Hallo", 12.5] print(a) b = range(1, 10, 1) print(b) for i in b: print(i) c = [2, 4, 6, 8] d = [a, c] print(d) # Indizes print(a[1]) print(d[0][1]) # -> "Hallo" print(d[1][2]) # -> 6 c.append(10) print(c)
a = [1, 'Hallo', 12.5] print(a) b = range(1, 10, 1) print(b) for i in b: print(i) c = [2, 4, 6, 8] d = [a, c] print(d) print(a[1]) print(d[0][1]) print(d[1][2]) c.append(10) print(c)
#!/usr/bin/env python3 """Easy statistics The main class `Statistics` just extends dict{str:function}, function here will act on the object of statistics. The values of dict have not to be a function. If it is a string, then the attribute of object will be called. Please see the following example and the function `_...
"""Easy statistics The main class `Statistics` just extends dict{str:function}, function here will act on the object of statistics. The values of dict have not to be a function. If it is a string, then the attribute of object will be called. Please see the following example and the function `_call`, the underlying im...
class Calculator: __result = 1 def __init__(self): pass def add(self, i): self.__result = self.__result + i def subtract(self, i): self.__result = self.__result - i def getResult(self): return self.__result
class Calculator: __result = 1 def __init__(self): pass def add(self, i): self.__result = self.__result + i def subtract(self, i): self.__result = self.__result - i def get_result(self): return self.__result
#!/usr/bin/python """ Truncatable primes https://projecteuler.net/problem=37 """ def ispalindrome(n): return n == n[::-1] def int2bin(n): return "{0:b}".format(n) def main(): total = 0 for i in range(1000000): if ispalindrome(str(i)) and ispalindrome(str(int2bin(i))): total = t...
""" Truncatable primes https://projecteuler.net/problem=37 """ def ispalindrome(n): return n == n[::-1] def int2bin(n): return '{0:b}'.format(n) def main(): total = 0 for i in range(1000000): if ispalindrome(str(i)) and ispalindrome(str(int2bin(i))): total = total + i print(to...
class FirstClass(object): """docstring for FirstClass""" def setdata(self, value): """just set a value""" self.data = value def display(self): """just show the value""" print("data is {0}".format(self.data)) class SecondClass(FirstClass): """display it differently""" ...
class Firstclass(object): """docstring for FirstClass""" def setdata(self, value): """just set a value""" self.data = value def display(self): """just show the value""" print('data is {0}'.format(self.data)) class Secondclass(FirstClass): """display it differently""" ...
#range new_list = list(range(0,100)) print(new_list) print("\n") #join sentence = "!" new_sentence = sentence.join(["hello","I","am","JoJo"]) print(new_sentence) print("\n") new_sentence = " ".join(["hello","I","am","JoJo"]) print(new_sentence)
new_list = list(range(0, 100)) print(new_list) print('\n') sentence = '!' new_sentence = sentence.join(['hello', 'I', 'am', 'JoJo']) print(new_sentence) print('\n') new_sentence = ' '.join(['hello', 'I', 'am', 'JoJo']) print(new_sentence)
pets = { 'dogs': [ { 'name': 'Spot', 'age': 2, 'breed': 'Dalmatian', 'description': 'Spot is an energetic puppy who seeks fun and adventure!', 'url': 'https://content.codecademy.com/programs/flask/introduction-to-flask/dog-spot.jpeg' }, ...
pets = {'dogs': [{'name': 'Spot', 'age': 2, 'breed': 'Dalmatian', 'description': 'Spot is an energetic puppy who seeks fun and adventure!', 'url': 'https://content.codecademy.com/programs/flask/introduction-to-flask/dog-spot.jpeg'}, {'name': 'Shadow', 'age': 4, 'breed': 'Border Collie', 'description': 'Eager and curiou...