content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
''' @author: Sevval MEHDER Filling one cell: O(1) Filling all cells: O(2xn) = O(n) ''' def find_maximum_cost(Y): values = [[0 for _ in range(2)] for _ in range(len(Y))] # Go on with adding these 2 options i = 1 while i < len(Y): # Put these two options values[i][0] =...
""" @author: Sevval MEHDER Filling one cell: O(1) Filling all cells: O(2xn) = O(n) """ def find_maximum_cost(Y): values = [[0 for _ in range(2)] for _ in range(len(Y))] i = 1 while i < len(Y): values[i][0] = max(values[i - 1][0], values[i - 1][1] + Y[i - 1] - 1) values[i][1] =...
def can_build(plat): return (plat == "android") def configure(env): if env["platform"] == "android": # Amazon dependencies env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])") env.android_add_java_dir("android/src") ...
def can_build(plat): return plat == 'android' def configure(env): if env['platform'] == 'android': env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])") env.android_add_java_dir('android/src') env.android_add_res_dir('res') ...
# by Kami Bigdely # Inline method. # TODO: Refactor this program to improve its readability. class Person: def __init__(self, my_age): self.age = my_age self.LEGAL_DRINKING_AGE = 18 def enter_night_club(self, my_age): if older_than_18_year_old(my_age): print("Allowed to ent...
class Person: def __init__(self, my_age): self.age = my_age self.LEGAL_DRINKING_AGE = 18 def enter_night_club(self, my_age): if older_than_18_year_old(my_age): print('Allowed to enter.') else: print('Enterance of minors is denited.') def older_than_...
# Copyright (c) 2017 Dustin Doloff # Licensed under Apache License v2.0 load( "//assert:assert.bzl", "assert_equal", ) load( "//control_flow:control_flow.bzl", "while_loop", ) def run_all_tests(): test_while_loop() def incr(state): if type(state) == "dict": state["incr_calls"] = state...
load('//assert:assert.bzl', 'assert_equal') load('//control_flow:control_flow.bzl', 'while_loop') def run_all_tests(): test_while_loop() def incr(state): if type(state) == 'dict': state['incr_calls'] = state.get('incr_calls', 0) + 1 state['value'] += 1 else: state += 1 return s...
fixed_time_entries = [{'stop': '2018-03-05T18:08:21+00:00', 'at': '2018-03-05T18:08:21+00:00', 'duration': 70, 'guid': '68c5136314e9680a54d0a28508139836', 'start': '2018-03-05T18:08:15+00:00', 'id': 1, 'description': 'task-1', 'duronly': False, 'uid': 2488778, 'billable': F...
fixed_time_entries = [{'stop': '2018-03-05T18:08:21+00:00', 'at': '2018-03-05T18:08:21+00:00', 'duration': 70, 'guid': '68c5136314e9680a54d0a28508139836', 'start': '2018-03-05T18:08:15+00:00', 'id': 1, 'description': 'task-1', 'duronly': False, 'uid': 2488778, 'billable': False, 'wid': 1688309}, {'stop': '2018-03-05T18...
# from django.conf.urls import url, include # from rest_framework import routers # from planex.site import views # router = routers.SimpleRouter() # router.register(r'pages', views.PageViewSet, basename='pages') # router.register(r'documents', views.DocumentViewSet, basename='documents') urlpatterns = [] # url(r'^...
urlpatterns = []
def solution(phone_book): answer = True phone_book = sorted(phone_book, key=(lambda x: len(x))) for i, item in enumerate(phone_book): for j in range(0, i): if item.find(phone_book[j])==0: return False return answer
def solution(phone_book): answer = True phone_book = sorted(phone_book, key=lambda x: len(x)) for (i, item) in enumerate(phone_book): for j in range(0, i): if item.find(phone_book[j]) == 0: return False return answer
lst2 = list(map(lambda x: 2 ** x, range(5))) print(lst2) for i in list(map(lambda x: x ** 2, lst2)): print(i, end=" ") print() print(list(map(lambda x: 1 if x % 2 == 0 else 0, lst2)))
lst2 = list(map(lambda x: 2 ** x, range(5))) print(lst2) for i in list(map(lambda x: x ** 2, lst2)): print(i, end=' ') print() print(list(map(lambda x: 1 if x % 2 == 0 else 0, lst2)))
# encoding: UTF-8 LOADING_ERROR = 'Error occurred when loading the config file, please check.' CONFIG_KEY_MISSING = 'Key missing in the config file, please check.' DATA_SERVER_CONNECTED = 'Data server connected.' DATA_SERVER_DISCONNECTED = 'Data server disconnected' DATA_SERVER_LOGIN = 'Data server login compl...
loading_error = 'Error occurred when loading the config file, please check.' config_key_missing = 'Key missing in the config file, please check.' data_server_connected = 'Data server connected.' data_server_disconnected = 'Data server disconnected' data_server_login = 'Data server login completed.' data_server_logout =...
GPIO_BASE_PATH = "/sys/class/gpio" MOTOR_PIN = "13" PIR_PIN = "12" DONALD_TRACK = "donald_duck.mp3"
gpio_base_path = '/sys/class/gpio' motor_pin = '13' pir_pin = '12' donald_track = 'donald_duck.mp3'
# # @lc app=leetcode id=717 lang=python3 # # [717] 1-bit and 2-bit Characters # # https://leetcode.com/problems/1-bit-and-2-bit-characters/description/ # # algorithms # Easy (49.13%) # Likes: 325 # Dislikes: 844 # Total Accepted: 52.5K # Total Submissions: 107K # Testcase Example: '[1,0,0]' # # We have two speci...
class Solution: def is_one_bit_character(self, bits: List[int]) -> bool: i = 0 n = len(bits) if n <= 1: return True while i < n: if bits[i] == 0: i += 1 else: i += 2 if i == n - 1: return...
ACRONYM = "BSC" def transcription_factor_regulatory_site(**identifier_properties): unique_data_string = [ identifier_properties.get("absolutePosition", "NoAbsolutePosition"), identifier_properties.get("leftEndPosition", "NoLEND"), identifier_properties.get("rightEndPosition", "NoREND") ...
acronym = 'BSC' def transcription_factor_regulatory_site(**identifier_properties): unique_data_string = [identifier_properties.get('absolutePosition', 'NoAbsolutePosition'), identifier_properties.get('leftEndPosition', 'NoLEND'), identifier_properties.get('rightEndPosition', 'NoREND')] return unique_data_strin...
# -*- coding: utf-8 -*- # @Time : 2019/10/15 0015 16:21 # @Author : Erichym # @Email : 951523291@qq.com # @File : 520.py # @Software: PyCharm class Solution: def detectCapitalUse(self, word: str) -> bool: if 97<=ord(word[0])<=122: for i in range(1,len(word),1): if ord(wo...
class Solution: def detect_capital_use(self, word: str) -> bool: if 97 <= ord(word[0]) <= 122: for i in range(1, len(word), 1): if ord(word[i]) > 122 or ord(word[i]) < 97: return False return True elif len(word) > 1: if 65 <= o...
def waxs_S_edge_guil(t=1): dets = [pil300KW] names = ['sample02', 'sample03', 'sample04', 'sample05', 'sample06', 'sample07', 'sample08', 'sample09', 'sample10', 'sample11', 'sample12'] x = [26500, 21500, 16000, 10500, 5000, 0, -5500, -10500, 16000, -21000, -26500]#, -34000, -41000] y = [600, 600,...
def waxs_s_edge_guil(t=1): dets = [pil300KW] names = ['sample02', 'sample03', 'sample04', 'sample05', 'sample06', 'sample07', 'sample08', 'sample09', 'sample10', 'sample11', 'sample12'] x = [26500, 21500, 16000, 10500, 5000, 0, -5500, -10500, 16000, -21000, -26500] y = [600, 600, 800, 700, 700, 600, 600...
class ThePhantomMenace: def find(self, doors, droids): greatest_min = -1 best_door = doors[0] for idx, door in enumerate(doors): greatest_distance = 9999 for droid in droids: distance = abs(droid - door) if distance < greatest_dista...
class Thephantommenace: def find(self, doors, droids): greatest_min = -1 best_door = doors[0] for (idx, door) in enumerate(doors): greatest_distance = 9999 for droid in droids: distance = abs(droid - door) if distance < greatest_distan...
def get_index_of(sequence, item): for i in range(len(sequence)): if sequence[i] == item: return i numbers = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] thirteenIndex = get_index_of(numbers, 13) print("13 is at:", thirteenIndex)
def get_index_of(sequence, item): for i in range(len(sequence)): if sequence[i] == item: return i numbers = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] thirteen_index = get_index_of(numbers, 13) print('13 is at:', thirteenIndex)
num1 =100 num2 = 200 num3 = 300 num5 =500
num1 = 100 num2 = 200 num3 = 300 num5 = 500
# pw2wannier stores the k index in 4 digits, which crashes computations on grids larger than 9999. This fixes it. f = open("silicon.amn") out = open("silicon.amn.new", "w") out.write(f.readline()) out.write(f.readline()) for line in f: line = line[0:10] + " " + line[10:] out.write(line) f = open("silicon....
f = open('silicon.amn') out = open('silicon.amn.new', 'w') out.write(f.readline()) out.write(f.readline()) for line in f: line = line[0:10] + ' ' + line[10:] out.write(line) f = open('silicon.mmn') out = open('silicon.mmn.new', 'w') out.write(f.readline()) out.write(f.readline()) i = 0 for line in f: if i %...
# Admin specfic links ADMIN_HANDLE = "@kwokyto" # Bot settings NUMBER_TO_NOTIFY = 5 NUMBER_TO_BUMP = 5 # Messages sent to the user INVALID_FORMAT_MESSAGE = "Simi? I can only read text, don't send me anything else." NO_COMMAND_MESSAGE = "What are you saying?? Send a proper command lah please." START_MESSAGE = "Harlo a...
admin_handle = '@kwokyto' number_to_notify = 5 number_to_bump = 5 invalid_format_message = "Simi? I can only read text, don't send me anything else." no_command_message = 'What are you saying?? Send a proper command lah please.' start_message = 'Harlo ah! Easy peasy, /join to join queue, or /help if you still blur.' he...
# dataset settings ann_type = 'tanz_base' # * _base or _evaluation videos_per_gpu_train = 8 if ann_type == 'tanz_base' else 4 workers_per_gpu_train = 1 num_classes = 9 if ann_type == 'tanz_base' else 42 ## * model settings model = dict( type='Recognizer3D', backbone=dict( type='ResNet3d', # p...
ann_type = 'tanz_base' videos_per_gpu_train = 8 if ann_type == 'tanz_base' else 4 workers_per_gpu_train = 1 num_classes = 9 if ann_type == 'tanz_base' else 42 model = dict(type='Recognizer3D', backbone=dict(type='ResNet3d', pretrained2d=True, pretrained='torchvision://resnet50', depth=50, conv_cfg=dict(type='Conv3d'), ...
class Solution: MIN_VALUE = -(2 ** 31) MAX_VALUE = 2 ** 31 - 1 def myAtoi(self, string: str) -> int: try: return self._fit_in_range(self._parse_number(string)) except ValueError: return 0 def _parse_number(self, string: str) -> str: string = string.stri...
class Solution: min_value = -2 ** 31 max_value = 2 ** 31 - 1 def my_atoi(self, string: str) -> int: try: return self._fit_in_range(self._parse_number(string)) except ValueError: return 0 def _parse_number(self, string: str) -> str: string = string.strip(...
#Colors to be used in the plots color = ["#f94144","#f3722c","#f8961e","#f9c74f","#90be6d","#43aa8b","#577590"] sns.palplot(color)
color = ['#f94144', '#f3722c', '#f8961e', '#f9c74f', '#90be6d', '#43aa8b', '#577590'] sns.palplot(color)
class Shirt: def __init__(self, size, color): self.size = size.lower() self.color = color.lower() def __repr__(self): return str(self.size + "&" + self.color)
class Shirt: def __init__(self, size, color): self.size = size.lower() self.color = color.lower() def __repr__(self): return str(self.size + '&' + self.color)
def is_number(value): '''Checks if a string can be converted into a float (or int as a by product). Helper function for string_cols_to_numeric''' try: float(value) return True except ValueError: return False
def is_number(value): """Checks if a string can be converted into a float (or int as a by product). Helper function for string_cols_to_numeric""" try: float(value) return True except ValueError: return False
#!/usr/bin/python3 class strategyBase(object): def __init__(self): pass def _get_data(self): pass def _settle(self): pass if __name__ == "__main__": pass
class Strategybase(object): def __init__(self): pass def _get_data(self): pass def _settle(self): pass if __name__ == '__main__': pass
# by Kami Bigdely # Extract Class foods = {'butternut squash soup':[45, True, 'soup','North African',\ ['butter squash','onion','carrot', 'garlic','butter','black pepper', 'cinnamon','coconut milk']\ ,'1. Grill the butter squash, onion, carrot and garlic in the oven until' 'they get soft and g...
foods = {'butternut squash soup': [45, True, 'soup', 'North African', ['butter squash', 'onion', 'carrot', 'garlic', 'butter', 'black pepper', 'cinnamon', 'coconut milk'], '1. Grill the butter squash, onion, carrot and garlic in the oven untilthey get soft and golden on top 2. Put all in blender withbutter and coconut ...
def decimal_to_binary(num): if (num == 0): return 0 return num%2+10*decimal_to_binary(num//2) print(decimal_to_binary(2))
def decimal_to_binary(num): if num == 0: return 0 return num % 2 + 10 * decimal_to_binary(num // 2) print(decimal_to_binary(2))
# yacctab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EX...
_tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSETOF RESTRICT RET...
# -*- coding: utf-8 -*- __all__ = ['StatesSet'] class StatesSet: STATE, CAPTURED = range(2) def __init__(self): self._list = [] self._set = set() def __len__(self): return len(self._list) def __bool__(self): return bool(self._list) def __iter__(self): ...
__all__ = ['StatesSet'] class Statesset: (state, captured) = range(2) def __init__(self): self._list = [] self._set = set() def __len__(self): return len(self._list) def __bool__(self): return bool(self._list) def __iter__(self): yield from self._list ...
load("@rules_cc//cc:defs.bzl", "cc_library") # https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library cc_library( name = "cpp-utils", srcs = glob(["src/*.cpp"]), hdrs = glob(["inc/*.h"]), includes = ["inc"], visibility = ["//visibility:public"], deps = [ "@com_github_spdlog//...
load('@rules_cc//cc:defs.bzl', 'cc_library') cc_library(name='cpp-utils', srcs=glob(['src/*.cpp']), hdrs=glob(['inc/*.h']), includes=['inc'], visibility=['//visibility:public'], deps=['@com_github_spdlog//:spdlog', '@com_google_absl//absl/debugging:failure_signal_handler', '@com_google_absl//absl/debugging:stacktrace',...
#-*- coding: UTF-8 -*- class quick_sort(): a=[] def __init__(self,data): self.a=data[:] def sort(self,left,right): if left!=right: mid=left+int((right-left)/2) self.sort(left,mid) self.sort(mid+1,right) b=[] i=0 for i in...
class Quick_Sort: a = [] def __init__(self, data): self.a = data[:] def sort(self, left, right): if left != right: mid = left + int((right - left) / 2) self.sort(left, mid) self.sort(mid + 1, right) b = [] i = 0 for i ...
# # PySNMP MIB module CISCO-SNA-LLC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SNA-LLC-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:35:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
OUR_APP_NAME = 'Demo' SECTION_NAME = 'Manufacturer' SECTION_ITEMS = 'Products'
our_app_name = 'Demo' section_name = 'Manufacturer' section_items = 'Products'
SSID1 = 'ap1' PASSWORD1 = 'pw1' SSID2 = 'ap2' PASSWORD2 = 'pw2' MQTT_PORT = '1883' MQTT_USER = 'useri' MQTT_PASSWORD = 'salari' MQTT_SERVER = 'ip' WEBREPL_PASSWORD = "pw" CLIENT_ID = "ESP32-aurinkopaneeli" DHCP_NAME = "ESP32-aurinkopaneeli" TOPIC_ERRORS = 'errors/home/esp32' TOPIC_TEMP = 'koti/ulko/aurinkop...
ssid1 = 'ap1' password1 = 'pw1' ssid2 = 'ap2' password2 = 'pw2' mqtt_port = '1883' mqtt_user = 'useri' mqtt_password = 'salari' mqtt_server = 'ip' webrepl_password = 'pw' client_id = 'ESP32-aurinkopaneeli' dhcp_name = 'ESP32-aurinkopaneeli' topic_errors = 'errors/home/esp32' topic_temp = 'koti/ulko/aurinkopaneeli/lampo...
n=int(input()) a=[] for i in range(0,n): ele=int(input()) a.append(ele) print(list(set(a))) lower=int(input()) upper=int(input()) b=[x for x in range(lower,upper+1) if ( int(x**0.5))**2==x and sum(list(map(int,str(x))))<10 ] a=[(x,x**2)for x in range(lower,upper+1)] print(b) n=int(input()) m=i...
n = int(input()) a = [] for i in range(0, n): ele = int(input()) a.append(ele) print(list(set(a))) lower = int(input()) upper = int(input()) b = [x for x in range(lower, upper + 1) if int(x ** 0.5) ** 2 == x and sum(list(map(int, str(x)))) < 10] a = [(x, x ** 2) for x in range(lower, upper + 1)] print(b) n = in...
def add(x, y): return x+y result = add(1, 2) print(f"This is the sum: , {result}")
def add(x, y): return x + y result = add(1, 2) print(f'This is the sum: , {result}')
ld,lm,ly = map(int,input().split()) dd,dm,dy = map(int,input().split()) if ly< dy: print('0') elif ly > dy: print('10000') elif lm > dm: print(500*(lm-dm)) elif lm < dm: print('0') elif ld > dd: print(15*(ld-dd)) else: print('0')
(ld, lm, ly) = map(int, input().split()) (dd, dm, dy) = map(int, input().split()) if ly < dy: print('0') elif ly > dy: print('10000') elif lm > dm: print(500 * (lm - dm)) elif lm < dm: print('0') elif ld > dd: print(15 * (ld - dd)) else: print('0')
{ "targets": [ { "target_name": "pm", "sources": [ "src/pm.cpp", "src/pm.h" ], 'conditions': [ ['OS=="win"', { 'sources': [ "src/pm_win.cpp" ] } ], ['OS=="mac"', { 'sourc...
{'targets': [{'target_name': 'pm', 'sources': ['src/pm.cpp', 'src/pm.h'], 'conditions': [['OS=="win"', {'sources': ['src/pm_win.cpp']}], ['OS=="mac"', {'sources': ['src/pm_mac.cpp']}], ['OS=="linux"', {'conditions': [["target_arch=='ia32'", {'include_dirs+': ['/usr/include/dbus-1.0/', '/usr/include/glib-2.0/', '/usr/li...
def perfect_array(length): return ' '.join(['1']*length) def main(): t = int(input()) for _ in range(t): length = int(input()) print(perfect_array(length)) main()
def perfect_array(length): return ' '.join(['1'] * length) def main(): t = int(input()) for _ in range(t): length = int(input()) print(perfect_array(length)) main()
# Copyright 2019 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause # Package initialisation for Doctor. # Mightn't be necessary to declare __all__ at time of writing because it lists # everything. __all__ = ['comment_block.py', 'comment_line.py', 'doc_markdown.py', 'doctor_class.py...
__all__ = ['comment_block.py', 'comment_line.py', 'doc_markdown.py', 'doctor_class.py', 'getter.py', 'main.py', 'markdown.py', 'parser.py']
def hello(s): print("Hello, %s!!!" % s) hello('world') hello('python') hello('Sasha')
def hello(s): print('Hello, %s!!!' % s) hello('world') hello('python') hello('Sasha')
#!/usr/bin/env python # -*- coding: utf-8 -*- def score(str_in): garbage = False cnt = 1 out = 0 stack = [] garbage_cnt = 0 skip = False for i in str_in: if skip: skip = False continue if i == '!': skip = True continue ...
def score(str_in): garbage = False cnt = 1 out = 0 stack = [] garbage_cnt = 0 skip = False for i in str_in: if skip: skip = False continue if i == '!': skip = True continue if garbage and i == '>': garbage = ...
class TreeNode: def __init__(self, data): self.data = data self.parent = None self.children = [] self.__length = 0 def add_child(self, children): self.__length += len(children) for child in children: child.parent = self self.children.a...
class Treenode: def __init__(self, data): self.data = data self.parent = None self.children = [] self.__length = 0 def add_child(self, children): self.__length += len(children) for child in children: child.parent = self self.children.appe...
# Copyright (C) 2020-Present the hyssop authors and contributors. # # This module is part of hyssop and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php ''' File created: September 4th 2020 Modified By: hsky77 Last Updated: April 6th 2021 22:26:59 pm ''' Version = '0.0.7'
""" File created: September 4th 2020 Modified By: hsky77 Last Updated: April 6th 2021 22:26:59 pm """ version = '0.0.7'
class Extractor(object): def __init__(self, transcript): self.transcript = transcript def get_location(self): return "TBD" def get_date(self): return "TBD"
class Extractor(object): def __init__(self, transcript): self.transcript = transcript def get_location(self): return 'TBD' def get_date(self): return 'TBD'
def test_all_function(numeric_state): state = numeric_state state["subtracted"] = state["amount"] - state["amount"] space = state.space[1] all_events = space.all() assert len(all_events) == 3
def test_all_function(numeric_state): state = numeric_state state['subtracted'] = state['amount'] - state['amount'] space = state.space[1] all_events = space.all() assert len(all_events) == 3
#input: data from communties_data.txt #output: data useful for predictive analysis (ie: excluding first 5 attributes) in 2D Array def clean_raw_data(data): rows = (row.strip().split() for row in data) leaveLoop = 0 cleaned_data = [] for row in rows: tmp = [stat.strip() for stat in row[0].split(',')] cleaned_dat...
def clean_raw_data(data): rows = (row.strip().split() for row in data) leave_loop = 0 cleaned_data = [] for row in rows: tmp = [stat.strip() for stat in row[0].split(',')] cleaned_data.append(tmp[5:]) return cleaned_data def clean_sum_data(data): sum_rows = (row.strip().split() ...
# # PySNMP MIB module Juniper-DS3-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-DS3-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 19:51:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_range_constraint, value_size_constraint) ...
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Edward Lau <elau1004@netscape.net> # Licensed under the MIT License. # __version__ = '0.1.0'
__version__ = '0.1.0'
expected_output = { "controller_config": { "group_name": "default", "ipv4": "10.9.3.4", "mac_address": "AAAA.BBFF.8888", "multicast_ipv4": "0.0.0.0", "multicast_ipv6": "::", "pmtu": "N/A", "public_ip": "N/A", "status": "N/A", }, "mobility_summa...
expected_output = {'controller_config': {'group_name': 'default', 'ipv4': '10.9.3.4', 'mac_address': 'AAAA.BBFF.8888', 'multicast_ipv4': '0.0.0.0', 'multicast_ipv6': '::', 'pmtu': 'N/A', 'public_ip': 'N/A', 'status': 'N/A'}, 'mobility_summary': {'domain_id': '0x34ac', 'dscp_value': '48', 'group_name': 'default', 'keepa...
''' # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail ''' # Write your code here def right(a,b): r=a for...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ def right(a, b): r = a for i in range(b): r = r[-1...
# Write a function to check if the array is sorted or not arr = [1,2,3,5,9] n = len(arr) i = 0 def isSortedArray(arr,i, n): if (i==n-1): return True if arr[i] < arr[i+1] and isSortedArray(arr,i+1,n): return True else: return False print(isSortedArray(arr,i,n))
arr = [1, 2, 3, 5, 9] n = len(arr) i = 0 def is_sorted_array(arr, i, n): if i == n - 1: return True if arr[i] < arr[i + 1] and is_sorted_array(arr, i + 1, n): return True else: return False print(is_sorted_array(arr, i, n))
dict = { "__open_crash__": 'Crash save {} exists, do you want to recover it?', "__about__": "Simple route designer using BSicon", "__export_fail__": 'Failed to export {}', "__open_fail__": 'Failed to open {}', "__paste_no_valid_blocks__": "No valid blocks to paste", "__paste_filter_invalid_block...
dict = {'__open_crash__': 'Crash save {} exists, do you want to recover it?', '__about__': 'Simple route designer using BSicon', '__export_fail__': 'Failed to export {}', '__open_fail__': 'Failed to open {}', '__paste_no_valid_blocks__': 'No valid blocks to paste', '__paste_filter_invalid_blocks__': 'Invalid blocks hav...
def fact(n): ans = 1 for i in range(1,n+1): ans = ans*i return ans T = int(input()) while T: n = input() n = int(n) print(fact(n)) T = T-1
def fact(n): ans = 1 for i in range(1, n + 1): ans = ans * i return ans t = int(input()) while T: n = input() n = int(n) print(fact(n)) t = T - 1
BOARDS = { 'arduino' : { 'digital' : tuple(x for x in range(14)), 'analog' : tuple(x for x in range(6)), 'pwm' : (3, 5, 6, 9, 10, 11), 'use_ports' : True, 'disabled' : (0, 1) # Rx, Tx, Crystal }, 'arduino_mega' : { 'digital' : tuple(x for x in range(54)), ...
boards = {'arduino': {'digital': tuple((x for x in range(14))), 'analog': tuple((x for x in range(6))), 'pwm': (3, 5, 6, 9, 10, 11), 'use_ports': True, 'disabled': (0, 1)}, 'arduino_mega': {'digital': tuple((x for x in range(54))), 'analog': tuple((x for x in range(16))), 'pwm': tuple((x for x in range(2, 14))), 'use_p...
# This code should store "codewa.rs" as a variable called name but it's not working. # Can you figure out why? a = "code" b = "wa.rs" name = a + b def test(): assert name == "codewa.rs"
a = 'code' b = 'wa.rs' name = a + b def test(): assert name == 'codewa.rs'
#brute force T= int(input()) while T!=0: T-=1 n = int(input()) if n>3: k1=0 k2=0 value1 , value2 , value3 , value4 =0,0,0,0 ''' #--------------------------------------- value1 = 14*(n-1) + 20 #---------------------------------------- k1=n//2 k2 = n % 2 if k2 ==0: #value2 = 28*(...
t = int(input()) while T != 0: t -= 1 n = int(input()) if n > 3: k1 = 0 k2 = 0 (value1, value2, value3, value4) = (0, 0, 0, 0) '\n\t\t#---------------------------------------\n\t\tvalue1 = 14*(n-1) + 20\n\t\t#----------------------------------------\n\t\tk1=n//2\n\t\tk2 = n %...
''' pyatmos jb2008 subpackage This subpackage defines the following functions: JB2008_subfunc.py - subfunctions that implement the atmospheric model JB2008 jb2008.py - Input interface of JB2008 spaceweather.py download_sw_jb2008 - Download or update the space weather file for JB2008 from https://sol.spacenvi...
""" pyatmos jb2008 subpackage This subpackage defines the following functions: JB2008_subfunc.py - subfunctions that implement the atmospheric model JB2008 jb2008.py - Input interface of JB2008 spaceweather.py download_sw_jb2008 - Download or update the space weather file for JB2008 from https://sol.spacenvi...
class GameContainer: def __init__(self, lowest_level, high_score, stat_diffs, points_available): self.lowest_level = lowest_level self.high_score = high_score self.stat_diffs = stat_diffs self.points_available = points_available
class Gamecontainer: def __init__(self, lowest_level, high_score, stat_diffs, points_available): self.lowest_level = lowest_level self.high_score = high_score self.stat_diffs = stat_diffs self.points_available = points_available
class Foo: class Bar: def baz(self): pass
class Foo: class Bar: def baz(self): pass
def main(): return "foo" def failure(): raise RuntimeError("This is an error")
def main(): return 'foo' def failure(): raise runtime_error('This is an error')
def lily_format(seq): return " ".join(point["lilypond"] for point in seq) def output(seq): return "{ %s }" % lily_format(seq) def write(filename, seq): with open(filename, "w") as f: f.write(output(seq))
def lily_format(seq): return ' '.join((point['lilypond'] for point in seq)) def output(seq): return '{ %s }' % lily_format(seq) def write(filename, seq): with open(filename, 'w') as f: f.write(output(seq))
print("Iterando sobre o arquivo") with open("dados.txt", "r") as arquivo: for linha in arquivo: print(linha) print("Fim do arquivo", arquivo.name)
print('Iterando sobre o arquivo') with open('dados.txt', 'r') as arquivo: for linha in arquivo: print(linha) print('Fim do arquivo', arquivo.name)
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres...
# Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: sum = 0 def DFS(self,node: TreeNode, path: str): if node is N...
class Treenode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: sum = 0 def dfs(self, node: TreeNode, path: str): if node is None: return if node.left is None and node.right is None: ...
N=int(input()) count=0 for i in range(1,N+1): if len(str(i))%2==1:count+=1 print(count)
n = int(input()) count = 0 for i in range(1, N + 1): if len(str(i)) % 2 == 1: count += 1 print(count)
# # PySNMP MIB module CXCFG-IPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXCFG-IPX-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:32:22 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
# # PySNMP MIB module RBN-ENVMON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-ENVMON-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:44:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...
# https://www.codechef.com/problems/MNMX for T in range(int(input())): n,a=int(input()),list(map(int,input().split())) print((n-1)*min(a)) # If order matters # s=0 # for z in range(n-1): # if(a[0]>=a[1]): # s+=a[1] # a.pop(0) # else: # s+=a[0]...
for t in range(int(input())): (n, a) = (int(input()), list(map(int, input().split()))) print((n - 1) * min(a))
class NoLastBookException (Exception): pass class OpenLastBookFileFailed (Exception): pass
class Nolastbookexception(Exception): pass class Openlastbookfilefailed(Exception): pass
fruta = [] fruta.append('Banana') fruta.append('Tangerina') fruta.append('uva') fruta.append('Laranja') fruta.append('Melancia') for f,p in enumerate(fruta): print(f'Na prateleira {f} temos {p}')
fruta = [] fruta.append('Banana') fruta.append('Tangerina') fruta.append('uva') fruta.append('Laranja') fruta.append('Melancia') for (f, p) in enumerate(fruta): print(f'Na prateleira {f} temos {p}')
rows_count = int(input()) def get_snake_pos(matrix): for i, row in enumerate(matrix): if "S" in row: j = row.index("S") snake_pos = [i, j] return snake_pos def get_food_pos(matrix): food_positions = [] for i, row in enumerate(matrix): for j, _ in enume...
rows_count = int(input()) def get_snake_pos(matrix): for (i, row) in enumerate(matrix): if 'S' in row: j = row.index('S') snake_pos = [i, j] return snake_pos def get_food_pos(matrix): food_positions = [] for (i, row) in enumerate(matrix): for (j, _) in e...
#!/usr/bin/env python # TODO: import the random module # This function parses both the player # and monster files def parse_file(filename): members = {} file = open(filename,"r") lines = file.readlines() for line in lines: name, diff = line.split(";") members[name] = {"str": int(diff)...
def parse_file(filename): members = {} file = open(filename, 'r') lines = file.readlines() for line in lines: (name, diff) = line.split(';') members[name] = {'str': int(diff)} return members def fight_monster(diff, roll): if diff > roll: return -1 return 1 def do_ro...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/2/12 16:25 # @Author : Baimohan/PH # @Site : https://github.com/BaiMoHan # @File : setdefault.py # @Software: PyCharm cars = {'BMW': 8.5, 'BENS': 8.3, 'AUDI': 7.9} print(cars.setdefault('PORSCHE', 9.2)) print(cars) print(cars.setdefault('BMW', 4.5))...
cars = {'BMW': 8.5, 'BENS': 8.3, 'AUDI': 7.9} print(cars.setdefault('PORSCHE', 9.2)) print(cars) print(cars.setdefault('BMW', 4.5)) print(cars)
NUMBER_OF_ROWS = 8 NUMBER_OF_COLUMNS = 8 DIMENSION_OF_EACH_SQUARE = 64 BOARD_COLOR_1 = "#DDB88C" BOARD_COLOR_2 = "#A66D4F" X_AXIS_LABELS = ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H') Y_AXIS_LABELS = (1, 2, 3, 4, 5, 6, 7, 8) SHORT_NAME = { 'R':'Rook', 'N':'Knight', 'B':'Bishop', 'Q':'Queen', 'K':'King', 'P':'Paw...
number_of_rows = 8 number_of_columns = 8 dimension_of_each_square = 64 board_color_1 = '#DDB88C' board_color_2 = '#A66D4F' x_axis_labels = ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H') y_axis_labels = (1, 2, 3, 4, 5, 6, 7, 8) short_name = {'R': 'Rook', 'N': 'Knight', 'B': 'Bishop', 'Q': 'Queen', 'K': 'King', 'P': 'Pawn'} st...
def power(x, y, p) : res = 1 # Initialize result # Update x if it is more # than or equal to p x = x % p if (x == 0) : return 0 while (y > 0) : # If y is odd, multiply # x with result if ((y & 1) == 1) : res = (re...
def power(x, y, p): res = 1 x = x % p if x == 0: return 0 while y > 0: if y & 1 == 1: res = res * x % p y = y >> 1 x = x * x % p return res mod = int(1000000000.0) + 7 for i in range(int(input())): (n, a) = [int(j) for j in input().split()] c = a %...
class Solution: def isPalindrome(self, s: str) -> bool: l, r = 0, len(s) - 1 while(l < r): while(l < r and s[l].isalnum() == False): l+=1 while(l < r and s[r].isalnum() == False): r-=1 if(s[l].lower() != s[r].lower()): ...
class Solution: def is_palindrome(self, s: str) -> bool: (l, r) = (0, len(s) - 1) while l < r: while l < r and s[l].isalnum() == False: l += 1 while l < r and s[r].isalnum() == False: r -= 1 if s[l].lower() != s[r].lower(): ...
class Solution: def solve(self, nums): if len(nums) <= 2: return 0 l_maxes = [] l_max = -inf for num in nums: l_max = max(l_max,num) l_maxes.append(l_max) r_maxes = [] r_max = -inf for num in nums[::-1]: r_max = max(r_ma...
class Solution: def solve(self, nums): if len(nums) <= 2: return 0 l_maxes = [] l_max = -inf for num in nums: l_max = max(l_max, num) l_maxes.append(l_max) r_maxes = [] r_max = -inf for num in nums[::-1]: r_max ...
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def swapPairs(self, head: ListNode) -> ListNode: return self.swap(head) def swap(self, head: ListNode) -> ListNode: if head == None: return ...
class Listnode: def __init__(self, x): self.val = x self.next = None class Solution: def swap_pairs(self, head: ListNode) -> ListNode: return self.swap(head) def swap(self, head: ListNode) -> ListNode: if head == None: return None if head.next == None:...
def FermatPrimalityTest(number): ''' if number != 1 ''' if (number > 1): ''' repeat the test few times ''' for time in range(3): ''' Draw a RANDOM number in range of number ( Z_number ) ''' randomNumber = random.randint(2, number)-1 ''' Test if a...
def fermat_primality_test(number): """ if number != 1 """ if number > 1: ' repeat the test few times ' for time in range(3): ' Draw a RANDOM number in range of number ( Z_number ) ' random_number = random.randint(2, number) - 1 ' Test if a^(n-1) = 1 mod n ' ...
# Using Array slicing in python to reverse arrays # defining reverse function def reversedArray(array): print(array[::-1]) # Creating a Template Array array = [1, 2, 3, 4, 5] print("Current Array Order:") print(array) print("Reversed Array Order:") reversedArray(array)
def reversed_array(array): print(array[::-1]) array = [1, 2, 3, 4, 5] print('Current Array Order:') print(array) print('Reversed Array Order:') reversed_array(array)
#Get a left position and a right # iterative uses a loop def is_palindrome(string): left_index = 0 right_index = len(string) - 1 #repeat, or loop while left_index < right_index: #check if dismatch if string[left_index] != string[right_index]: return False #move to th...
def is_palindrome(string): left_index = 0 right_index = len(string) - 1 while left_index < right_index: if string[left_index] != string[right_index]: return False left_index += 1 right_index -= 1 return True def is_palindrome_recursive(string, left_index, right_index...
def distributeCandies(self, candies: int, num_people: int) -> List[int]: r = [0 for _ in range(num_people)] i = 0 c = 1 while candies != 0: if i > num_people - 1: i = 0 if c > candies: r[i] += candies break r[i] += c candies -= c ...
def distribute_candies(self, candies: int, num_people: int) -> List[int]: r = [0 for _ in range(num_people)] i = 0 c = 1 while candies != 0: if i > num_people - 1: i = 0 if c > candies: r[i] += candies break r[i] += c candies -= c ...
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' FIRST_LETTER = LETTERS[0] def get_sequence(column, count, step=1): column = validate(column) count = max(abs(count), 1) sequence = [] if column: sequence.append(column) count = count - 1 for i in range(count): previous ...
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' first_letter = LETTERS[0] def get_sequence(column, count, step=1): column = validate(column) count = max(abs(count), 1) sequence = [] if column: sequence.append(column) count = count - 1 for i in range(count): previous = sequence[-1] if...
# ToDo: Make it configurable DEFAULT_PARAMS = { "os_api": "23", "device_type": "Pixel", "ssmix": "a", "manifest_version_code": "2018111632", "dpi": 420, "app_name": "musical_ly", "version_name": "9.1.0", "is_my_cn": 0, "ac": "wifi", "update_version_code": "2018111632", "chann...
default_params = {'os_api': '23', 'device_type': 'Pixel', 'ssmix': 'a', 'manifest_version_code': '2018111632', 'dpi': 420, 'app_name': 'musical_ly', 'version_name': '9.1.0', 'is_my_cn': 0, 'ac': 'wifi', 'update_version_code': '2018111632', 'channel': 'googleplay', 'device_platform': 'android', 'build_number': '9.9.0', ...
def Ispalindrome(usrname): return usrname==usrname[::-1] def main(): usrname=input("Enter the String :") #temp=usrname[::-1] if Ispalindrome(usrname): print("String %s is palindrome"%(usrname)) else: print("String %s is not palindrome"%(usrname)) if __name__ == '__main__': main()
def ispalindrome(usrname): return usrname == usrname[::-1] def main(): usrname = input('Enter the String :') if ispalindrome(usrname): print('String %s is palindrome' % usrname) else: print('String %s is not palindrome' % usrname) if __name__ == '__main__': main()
# Advent of Code 2015 # # From https://adventofcode.com/2015/day/3 # inputs = [data.strip() for data in open('../inputs/Advent2015_03.txt', 'r')][0] move = {'^': 0 + 1j, ">": 1, "v": 0 - 1j, "<": -1} def visit(inputs): position = 0 + 0j visited = {position} for x in inputs: position = position +...
inputs = [data.strip() for data in open('../inputs/Advent2015_03.txt', 'r')][0] move = {'^': 0 + 1j, '>': 1, 'v': 0 - 1j, '<': -1} def visit(inputs): position = 0 + 0j visited = {position} for x in inputs: position = position + move[x] visited.add(position) return visited print(f'AoC 20...
age1 = 12 age2 = 18 print("age1 + age2") print(age1 + age2) print("age1 - age2") print(age1 - age2) print("age1 * age2") print(age1 * age2) print("age1 / age2") print(age1 / age2) print("age1 % age2") print(age1 % age2) sent1 = "Today is a beautiful day" firstName = "Marlon" lastName = "Monzon" print(firstName + " "...
age1 = 12 age2 = 18 print('age1 + age2') print(age1 + age2) print('age1 - age2') print(age1 - age2) print('age1 * age2') print(age1 * age2) print('age1 / age2') print(age1 / age2) print('age1 % age2') print(age1 % age2) sent1 = 'Today is a beautiful day' first_name = 'Marlon' last_name = 'Monzon' print(firstName + ' ' ...
a = input() s = [int(x) for x in input().split()] ans = [str(x) for x in sorted(s)] print(' '.join(ans))
a = input() s = [int(x) for x in input().split()] ans = [str(x) for x in sorted(s)] print(' '.join(ans))
# Equations (c) Baltasar 2019 MIT License <baltasarq@gmail.com> class TDS: def __init__(self): self._vbles = {} def __iadd__(self, other): self._vbles[other[0]] = other[1] return self def __getitem__(self, item): return self._vbles[item] def __setitem__(self, item, v...
class Tds: def __init__(self): self._vbles = {} def __iadd__(self, other): self._vbles[other[0]] = other[1] return self def __getitem__(self, item): return self._vbles[item] def __setitem__(self, item, value): self._vbles[item] = value def get_vble_names(...
x = int(input("enter percentage\n")) if(x>=65): print("Excellent") elif(x>=55 and x<65): print("Good") elif(x>=40 and x<55): print("Fair") else: print("Failed")
x = int(input('enter percentage\n')) if x >= 65: print('Excellent') elif x >= 55 and x < 65: print('Good') elif x >= 40 and x < 55: print('Fair') else: print('Failed')
WORK_PATH = "/tmp/posts" PORT = 8000 AUTHOR = "@asadiyan" TITLE = "fsBlog" DESCRIPTION = "<h3></h3>"
work_path = '/tmp/posts' port = 8000 author = '@asadiyan' title = 'fsBlog' description = '<h3></h3>'
def TwosComplementOf(n): if isinstance(n,str) == True: binintnum = int(n) binmun = int("{0:08b}".format(binintnum)) strnum = str(binmun) size = len(strnum) idx = size -1 while idx >= 0: ...
def twos_complement_of(n): if isinstance(n, str) == True: binintnum = int(n) binmun = int('{0:08b}'.format(binintnum)) strnum = str(binmun) size = len(strnum) idx = size - 1 while idx >= 0: if strnum[idx] == '1': break idx = idx...
# pylint: skip-file # pylint: disable=too-many-instance-attributes class GcloudComputeZones(GcloudCLI): ''' Class to wrap the gcloud compute zones command''' # pylint allows 5 # pylint: disable=too-many-arguments def __init__(self, region=None, verbose=False): ''' Constructor for gcloud resour...
class Gcloudcomputezones(GcloudCLI): """ Class to wrap the gcloud compute zones command""" def __init__(self, region=None, verbose=False): """ Constructor for gcloud resource """ super(GcloudComputeZones, self).__init__() self._region = region self.verbose = verbose @proper...
class Stack: def __init__(self, *objects): self.stack = [] if len(objects) > 0: for obj in objects: self.stack.append(obj) def push(self, *objects): for obj in objects: self.stack.append(obj) def pop(self, obj): ...
class Stack: def __init__(self, *objects): self.stack = [] if len(objects) > 0: for obj in objects: self.stack.append(obj) def push(self, *objects): for obj in objects: self.stack.append(obj) def pop(self, obj): if self.stack != []: ...
class CalcError(Exception): def __init__(self, error): self.message = error super().__init__(self.message)
class Calcerror(Exception): def __init__(self, error): self.message = error super().__init__(self.message)
#Binary to Decimal conversion def binDec(n): num = int(n); value = 0; base = 1; flag = num; while(flag): l = flag%10; flag = int(flag/10); print(flag); value = value+l*base; base = base*2; return value num = input(); a = binDec(num); print(a)
def bin_dec(n): num = int(n) value = 0 base = 1 flag = num while flag: l = flag % 10 flag = int(flag / 10) print(flag) value = value + l * base base = base * 2 return value num = input() a = bin_dec(num) print(a)
{ 'targets': [ { 'target_name': 'lb_shell_package', 'type': 'none', 'default_project': 1, 'dependencies': [ 'lb_shell_contents', ], 'conditions': [ ['target_arch=="android"', { 'dependencies': [ 'lb_shell_android.gyp:lb_shell_apk', ...
{'targets': [{'target_name': 'lb_shell_package', 'type': 'none', 'default_project': 1, 'dependencies': ['lb_shell_contents'], 'conditions': [['target_arch=="android"', {'dependencies': ['lb_shell_android.gyp:lb_shell_apk']}, {'dependencies': ['lb_shell_exe.gyp:lb_shell']}], ['target_arch not in ["linux", "android", "wi...
# PRINT OUT A WELCOME MESSAGE. print('Welcome to Food Funhouse!') # LOOP UNTIL THE USER CHOOSES TO EXIT. order_total_in_dollars_and_cents = 0.0 while True: # PRINT OUT THE MENU OPTIONS. print('1. Cheeseburger - $5.50') print('2. Pizza - $5.00') print('3. Taco - $3.00') print('4. Cookie - $1.99') ...
print('Welcome to Food Funhouse!') order_total_in_dollars_and_cents = 0.0 while True: print('1. Cheeseburger - $5.50') print('2. Pizza - $5.00') print('3. Taco - $3.00') print('4. Cookie - $1.99') print('5. Milk - $0.99') print('6. Pay for Order/Exit') print('7. Cancel Order/Exit') selec...
# Simple Calculator def calculate(x,y,operator): if operator == "*": result = float(x * y) print(f"The answer is {result} ") elif operator == "/": result = float(x / y) print(f"The answer is {result} ") elif operator == "+": result = float(x + y) print(f"The ...
def calculate(x, y, operator): if operator == '*': result = float(x * y) print(f'The answer is {result} ') elif operator == '/': result = float(x / y) print(f'The answer is {result} ') elif operator == '+': result = float(x + y) print(f'The answer is {result} ...