content
stringlengths
7
1.05M
sub_channel_2_channel = { 'ASMR': '生活', 'GMV': '游戏', 'Korea相关': '娱乐', 'MAD·AMV': '动画', '美食制作': '美食', '美食侦探': '美食', '美食记录': '美食', '田园美食': '美食', '美食测评': '美食', 'MMD·3D': '动画', 'Mugen': '游戏', 'OP/ED/OST': '音乐', 'VOCALOID·UTAU': '音乐', '三次元舞蹈': '舞蹈', '三次元音乐': '音乐', '人力VOCALOID': '鬼畜', '人文·历史': '纪录片', '健身': '时尚', '其他': '生活', '其他国家': '电影', '军事': '纪录片', '动物圈': '生活', '华语电影': '电影', '单机游戏': '游戏', '原创音乐': '音乐', '国产剧': '电视剧', '国产动画': '国创', '国产原创相关': '国创', '宅舞': '舞蹈', '完结动画': '番剧', '官方延伸': '番剧', '布袋戏': '国创', '广告': '广告', '影视剪辑': '影视', '影视杂谈': '影视', '手工': '生活', '手机游戏': '游戏', '搞笑': '生活', '教程演示': '鬼畜', '数码': '数码', '日常': '生活', '明星': '娱乐', '星海': '科技', '服饰': '时尚', '机械': '科技', '桌游棋牌': '游戏', '欧美电影': '电影', '汽车': '科技', '海外剧': '电视剧', '演奏': '音乐', '演讲·公开课': '科技', '特摄': '影视', '电子竞技': '游戏', '短片': '影视', '短片·手书·配音': '动画', '社会·美食·旅行': '纪录片', '科学·探索·自然': '纪录片', '绘画': '生活', '综艺': '娱乐', '网络游戏': '游戏', '美妆': '时尚', '美食圈': '生活', '翻唱': '音乐', '舞蹈教程': '舞蹈', '资讯': '国创', '趣味科普人文': '科技', '运动': '生活', '连载动画': '番剧', '野生技术协会': '科技', '音MAD': '鬼畜', '音乐选集': '音乐', '音游': '游戏', '预告 资讯': '影视', '预告·资讯': '影视', '单机联机': '游戏', '鬼畜调教': '鬼畜', '演讲• 公开课': '科技', '国产电影': '电影', '日本电影': '电影', '番剧': '番剧', '国创': '国创', '鬼畜': '鬼畜', '电视剧': '电视剧', '动画': '动画', '时尚': '时尚', '娱乐': '娱乐', '电影': '电影', '舞蹈': '舞蹈', '舞蹈综合': '舞蹈', '科技': '科技', '生活': '生活', '音乐': '音乐', '纪录片': '纪录片', '手机平板': '数码', '电脑装机': '数码', '影音智能': '数码', '摄影摄像': '数码', '风尚标': '时尚', '电音': '音乐', '音乐综合': '音乐', 'MV': '音乐', '音乐现场': '音乐', '游戏': '游戏', 'T台': '时尚', '动态漫·广播剧': '国创', '明星舞蹈': '舞蹈', '街舞': '舞蹈', '中国舞': '舞蹈', '社科人文': '知识', '热点': '资讯', '环球': '资讯', '社会': '资讯', '综合': '', '科学科普': '知识', '社科人文': '知识', '职业职场': '知识', '财经': '知识', '校园学习': '知识', '明星舞蹈': '舞蹈', '手办·模玩': "动画" } table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr = {} for i in range(58): tr[table[i]] = i s = [11, 10, 3, 8, 4, 6] xor = 177451812 add = 8728348608 def dec(x): try: r = 0 for i in range(6): r += tr[x[s[i]]]*58**i return (r-add) ^ xor except: return "" def enc(x): try: x = (x ^ xor)+add r = list('BV1 4 1 7 ') for i in range(6): r[s[i]] = table[x//58**i % 58] return ''.join(r) except: return -1
def part_1(): for i in input: if (2020-i) in input: return (2020-i)*i def part_2(): for i in range(len(input)): for j in range(i, len(input)): if (2020 - input[i] - input[j]) in input: return (2020-input[i]-input[j]) * input[i] * input[j] if __name__ == "__main__": input = [1825,1944,1802,1676,1921,1652,1710,1952,1932,1934,1823,1732,1795,1681,1706,1697,1919,1695,2007,1889,1942,961,1868,1878,1723,416,1875,1831,1890,1654,1956,1827,973,1947,1688,1680,1808,1998,1794,1552,1935,1693,1824,1711,1766,1668,1968,1884,217,2003,1869,1658,1953,1829,1984,2005,1973,428,1957,1925,1719,1797,321,1804,1971,922,1976,1863,2008,1806,1833,1809,1707,1954,1811,1815,1915,1799,1917,1664,1937,1775,1685,1756,1940,1660,1859,1916,1989,1763,1994,1716,1689,1866,1708,1670,1982,1870,1847,1627,1819,1786,1828,1640,1699,1722,1737,1882,1666,1871,1703,1770,1623,1837,1636,1655,1930,1739,1810,1805,1861,1922,1993,1896,1760,2002,1779,1633,1972,1856,1641,1718,2004,1730,1826,1923,1753,1735,660,1988,1796,1990,1720,1626,1788,1700,942,1902,1943,1758,1839,1924,938,1634,1724,1983,1683,1687,1904,1907,1757,2001,1910,1849,1781,1981,1743,1851,2009,619,1898,1891,1751,1765,1959,1888,1894,1759,389,1964,1900,1742,1672,1969,1978,1933,1906,1807,1867,1838,1960,1814,1950,1918,1726,1986,1746,2006,1949,1784] print(part_1()) print(part_2())
# https://leetcode.com/problems/max-increase-to-keep-city-skyline/description/ # input: grid = [[3,0,8,4],[2,4,5,7],[9,2,6,3],[0,3,1,0]] # output: 35 def build_top_or_bottom(grid): top_or_bottom = [] for i in range(len(grid[0])): highest_building = 0 for j in range(len(grid)): if grid[j][i] > highest_building: highest_building = grid[j][i] top_or_bottom.append(highest_building) return top_or_bottom def build_left_or_right(grid): left_or_right = [] for line in grid: highest_building = 0 for building_height in line: if building_height > highest_building: highest_building = building_height left_or_right.append(highest_building) return left_or_right def max_increase_keeping_skyline(grid): top_or_bottom = build_top_or_bottom(grid) left_or_right = build_left_or_right(grid) increased_number = 0 for i in range(len(grid)): for j in range(len(grid[i])): if left_or_right[i] < top_or_bottom[j]: increased_number += (left_or_right[i] - grid[i][j]) else: increased_number += (top_or_bottom[j] - grid[i][j]) return increased_number print(max_increase_keeping_skyline([[3,0,8,4],[2,4,5,7],[9,2,6,3],[0,3,1,0]]))
lines = open("day 13/Toon D - Python/input", "r").readlines() coordinates = [[int(coor) for coor in line.replace('\n', '').split(',')] for line in lines if "," in line] folds = [line[11:].replace('\n', '').split('=') for line in lines if '=' in line] for element in folds: element[1] = int(element[1]) def fold(coordinates, direction, position): new_coordinates = [] for coordinate in coordinates: if direction == 'x': if coordinate[0] > position: new_coordinates.append( [(position * 2) - coordinate[0], coordinate[1]]) else: new_coordinates.append(coordinate) if direction == 'y': if coordinate[1] > position: new_coordinates.append( [coordinate[0], (position * 2) - coordinate[1]]) else: new_coordinates.append(coordinate) present = set() result = [] for coordinate in new_coordinates: if str(coordinate) not in present: present.add(str(coordinate)) result.append(coordinate) return result print("part 1: %i" % len(fold(coordinates, folds[0][0], folds[0][1]))) result = coordinates for fold_element in folds: result = fold(result, fold_element[0], fold_element[1]) x_max = max([coordinate[0] for coordinate in result]) y_max = max([coordinate[1] for coordinate in result]) present = set([str(coordinate) for coordinate in result]) for y in range(y_max+1): row = '' for x in range(x_max+1): if str([x, y]) in present: row += '#' else: row += ' ' print(row)
# -*- coding: utf-8 -*- """ Created on Wed Dec 23 19:16:26 2020 @author: crtom GRID = 600*600 GRID 6x6 = 36 pieces 100x100 per square one piece is 80x80 + margin = 100x100 """ # create a list of touple positions grid_touple_list = [] grid_pixel_pos_list = [] card_position_list = [] for y in range(0, 6): for x in range(0, 6): grid_touple_list.append((x,y)) grid_pixel_pos_list.append((x*100, y*100)) card_position_list.append(((x*100) + 10, (y*100) + 10)) # for x in range(0, 600, 100): # for y in range(0, 600, 100): # grid_pixel_pos_list.append((x, y)) # card_position_list.append((x + 10, y + 10)) print(grid_touple_list) print(grid_pixel_pos_list) print(card_position_list)
expected_output = { 'ids': { '1': { 'no_of_failures': 11, 'no_of_success': 0, 'probe_id': 1, 'return_code': 'Timeout', 'rtt_stats': 'NoConnection/Busy/Timeout', 'start_time': '07:10:18 UTC Fri Oct 22 2021' }, '2': { 'delay': '3239998/3240718/3240998', 'destination': '10.50.10.100', 'no_of_failures': 0, 'no_of_success': 46, 'oper_id': 60988531, 'probe_id': 2, 'return_code': 'OK', 'start_time': '07:11:18 UTC Fri Oct 22 2021' }, '3': { 'delay': '3239/3240/3240', 'destination': '10.50.10.100', 'no_of_failures': 0, 'no_of_success': 24, 'oper_id': 393146530, 'probe_id': 3, 'return_code': 'OK', 'start_time': '07:11:19 UTC Fri Oct 22 2021' }, '50': { 'no_of_failures': 0, 'no_of_success': 24, 'probe_id': 50, 'return_code': 'OK', 'rtt_stats': '6 milliseconds', 'start_time': '07:11:19 UTC Fri Oct 22 2021' }, '51': { 'no_of_failures': 0, 'no_of_success': 47, 'probe_id': 51, 'return_code': 'OK', 'rtt_stats': '11 milliseconds', 'start_time': '07:11:19 UTC Fri Oct 22 2021' }, '52': { 'no_of_failures': 0, 'no_of_success': 24, 'probe_id': 52, 'return_code': 'OK', 'rtt_stats': '11 milliseconds', 'start_time': '07:11:19 UTC Fri Oct 22 2021' }, '53': { 'no_of_failures': 23, 'no_of_success': 0, 'probe_id': 53, 'return_code': 'No', 'rtt_stats': 'NoConnection/Busy/Timeout', 'start_time': '07:10:19 UTC Fri Oct 22 2021' }, '54': { 'no_of_failures': 24, 'no_of_success': 0, 'probe_id': 54, 'return_code': 'Socket', 'rtt_stats': '0 milliseconds', 'start_time': '07:11:19 UTC Fri Oct 22 2021' }, '100': { 'no_of_failures': 0, 'no_of_success': 23, 'probe_id': 100, 'return_code': 'OK', 'rtt_stats': '1 milliseconds', 'start_time': '07:11:08 UTC Fri Oct 22 2021' }, } }
#! /usr/bin/env/python3 # -*- coding: utf-8 -*- first_line = set(sorted(''.join([a for a in input() if a.isalnum()]))) second_line = set(sorted(''.join([a for a in input() if a.isalnum()]))) print(first_line) print(second_line) for i in second_line: if i not in first_line: print("We can't do it") break else: print("We can do it")
# Pascal Triangle # Given numRows, generate the first numRows of Pascal’s triangle. # Pascal’s triangle : To generate A[C] in row R, sum up A’[C] and A’[C-1] from previous row R - 1. class Solution: # @param A : integer # @return a list of list of integers def find_bin_coef(self,n): res = 1 v = [] v.append(res) for i in range(1,n+1): res = int(res*(n-i+1)/i) v.append(res) return v def solve(self, A): res = [] for i in range(0,A): v = self.find_bin_coef(i) res.append(v) return res
#!/usr/bin/env python # ------------------------------------------- # Compass Data object, corresponds to Compass_Data.h in old code # ------------------------------------------- class CompassData: def __init__(self, head=0): self.heading = head self.pitch = 0 self.roll = 0 self.temperature = 0 self.check_sum = 0
class Pessoa: species = 'Human' age = None def __init__(self, name, sex): self.sex = sex self.name = name def p_data(self): print( f''' {self.name} {self.age} {self.species} {self.sex}''') class Elder(Pessoa): age = '>60' class Adult(Pessoa): age = '18 to 59' class Teenager(Pessoa): age = '13 to 17' class Child(Pessoa): age = '0 to 12' tilburi = Adult('Tilburi', 'Male') chuck = Teenager('Chuck', 'Female') gabo = Child('Gabo', 'Male') tilburi.p_data() chuck.p_data() gabo.p_data()
class Environment: PRICE_IDX = 4 # 종가의 위치 # 0: date, 1: open , 2: high , 3: low, 4: close,기ㅏ 5: volume, .... def __init__(self, chart_data=None): self.chart_data = chart_data self.observation = None # 현재 위치에서의 관측값 self.idx = -1 # 현재 위치 # -1로 초기화되어 있는 이유는? def reset(self): self.observation = None self.idx = -1 def observe(self): ''' data = pd.read_csv("~/aiffel/RLTrader/data/v2/005930.csv") 기준 len(data) --> 976 csv파일 확인 시 2~980까지 총 979개 ''' if len(self.chart_data) > self.idx + 1: # 왜 등호는 포함이 안되는거지? 당연 len()은 숫자를 1부터 센다.반면 index는 0부터 세기 때문에 self.idx += 1 self.observation = self.chart_data.iloc[self.idx] return self.observation # 조건을 만족하는 경우 return None # 조건을 만족하지 않는 경우 def get_price(self): if self.observation is not None: return self.observation[self.PRICE_IDX] return None def set_chart_data(self, chart_data): self.chart_data = chart_data
class Solution: def findWords(self, words: List[str]) -> List[str]: first, second, third = set("qwertyuiop"), set("asdfghjkl"), set("zxcvbnm") result = [] for word in words: first_letter = word[0].lower() group = first if first_letter in second: group = second elif first_letter in third: group = third for letter in word: letter = letter.lower() if letter not in group: break else: result.append(word) return result
# -*- coding: utf-8 -*- # Neste problema é possível perceber um certo padrão. Quando não há a repetição dos comandos é possível considerar # que a cada comando executado o número de passos que vem depois aumtentam em 1. Sendo assim a sequência "1, 2, 3" # significaria que o resultado seria 1 + (2 + 1) + (3 + 2*1). Pois depois que o primeiro comando fosse executado # seriam necessários mais um toque extra na tecla para chegar na mesma posição, isso se repete com todos os comandos # caso eles não se repitam. # Quando há uma repetição basta pressionar a tecla o número de vezes suficientes para chegar até a última posição que # o comando foi pressionado. Então na sequência "1, 2, 1" até o 2 a lógica normal seria aplicada, porém quando há # o 1 novamente pode se considerar que o comando foi executado a 2 passos atrás. Então pode-se considerar que o # número de passos é o índice do comando a ser executado na lista fornecida menos o índice da última vez que esse # mesmo comando apareceu na lista. No programa foi usada uma lista como histórico para contabilizar a repetição de # comandos. # Loop para os casos while True: # Variável do resultado res = 0 # Lista que armazena o histório de comandos que estão sendo executados ex = [] # Input do número de comandos n = int(input()) # Condição de saída if n == 0: break # Lista de comandos cmd = list(map(int, input().split())) # Loop que itera por cada comando for i in range(len(cmd)): # Caso o comando tenha se repetido (se está no histórico) if cmd[i] in ex: # É calculada a última vez que esse comando foi executado e consequentemente o número de passos res += i - ex.index(cmd[i]) # Substitui o comando no histórico por 0, assim é evitado que o resultado falhe caso tenham várias # repetições. O comando não poderia ser removido do histório porque isso iria mudar os índices e # com isso o resultado seria incorreto ex[ex.index(cmd[i])] = 0 # Adiciona o comando no histórico ex.append(cmd[i]) else: # Calcula o número de passos conforme explicado no primeiro comentário res += cmd[i] + i # Adiciona o comando no histórico ex.append(cmd[i]) # Exibe o resultado print(res)
L = [[0]*5 for i in range(3)] n = int(input()) for i in range(n): I = list(map(int,input().split())) for j in range(3): L[j][I[j]]+=1 for i in range(3): L[i][0] = L[i][1]*1 + L[i][2]*2 + L[i][3]*3 L[i][4] = i+1 L.sort(key = lambda t: (-t[0], -t[3], -t[2], -t[1])) if len(L) > 1 and L[0][:-1] == L[1][:-1]: print(0, L[0][0]) else: print(L[0][4], L[0][0])
def part1(): with open('07_input.txt', 'r') as f: lines = f.read().split('\n') visited = [] acc = 0 ip = 0 while True: if str(ip) in visited: break else: visited.append(str(ip)) op, arg = lines[ip].split(' ') if op == 'acc': acc += int(arg) ip += 1 elif op == 'nop': ip += 1 continue elif op == 'jmp': ip = ip + int(arg) else: break print(acc) part1()
class Leaderboard: def __init__(self): self.scores = defaultdict() def addScore(self, playerId: int, score: int) -> None: if playerId not in self.scores: self.scores[playerId] = 0 self.scores[playerId] += score def top(self, K: int) -> int: values = [v for _, v in sorted(self.scores.items(), key=lambda item: item[1])] values.sort(reverse=True) total, i = 0, 0 while i < K: total += values[i] i += 1 return total def reset(self, playerId: int) -> None: self.scores[playerId] = 0
# [896] 单调数组 # https://leetcode-cn.com/problems/monotonic-array/description/ # * algorithms # * Easy (53.98%) # * Total Accepted: 49.4K # * Total Submissions: 84.5K # * Testcase Example: '[1,2,2,3]' # 如果数组是单调递增或单调递减的,那么它是单调的。 # 如果对于所有 i <= j,A[i] <= A[j],那么数组 A 是单调递增的。 如果对于所有 i <= j,A[i]> = A[j],那么数组 A 是单调递减的。 # 当给定的数组 A 是单调数组时返回 true,否则返回 false。 # 示例 1: # 输入:[1,2,2,3] # 输出:true # 示例 2: # 输入:[6,5,4,4] # 输出:true # 示例 3: # 输入:[1,3,2] # 输出:false # 示例 4: # 输入:[1,2,4,5] # 输出:true # 示例 5: # 输入:[1,1,1] # 输出:true # 提示: # 1 <= A.length <= 50000 # -100000 <= A[i] <= 100000 class Solution: def isMonotonic0(self, a): n = len(a) if n <= 2: return True flag = None for i in range(1, n): if a[i - 1] != a[i]: if flag is None: flag = a[i - 1] > a[i] elif flag != (a[i - 1] > a[i]): return False return True def isMonotonic1(self, a): desc = True if a[0] >= a[-1] else False n = len(a) if desc: return all(a[i - 1] >= a[i] for i in range(1, n)) return all(a[i - 1] <= a[i] for i in range(1, n)) def isMonotonic(self, a): asc, desc = True, True i, n = 1, len(a) while i < n and (asc or desc): asc = asc and a[i - 1] <= a[i] desc = desc and a[i - 1] >= a[i] i += 1 return asc or desc
# -*- coding: utf-8 -*- """ Created on Wed Nov 11 01:46:31 2020 @author: ucobiz """ class Student: """This is a class for a student""" MAX_ID_LENGTH = 4 numStudents = 0 def __init__(self, name, age, gpa): """Constructor for a student""" self.full_name = name self.age = age self.gpa = gpa def get_age(self): """Method to get an age for a student return an age """ return self.age
class Book: def __init__(self, name, author, pages): self.name = name self.author = author self.pages = pages def name(self): return self.name def author(self): return self.name def pages(self): return self.name book = Book("My Book", "Me", 200) print(book.name) print(book.author) print(book.pages)
""" Anthropometry formulas for determining heights of the body and its parts Winter, David A. Biomechanics and Motor Control of Human Movement. New York, N.Y.: Wiley, 2009. Print. """ def height_from_height_eyes(segment_length): """ Calculates body height based on the height of the eyes from the ground args: segment_length (float): height of the eyes from the ground Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.936 def height_from_height_head(segment_length): """ Calculates body height based on the height of the head (up to the bottom of the chin) from the ground args: segment_length (float): height of the head (up to the bottom of the chin) Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.870 def height_from_height_shoulders(segment_length): """ Calculates body height based on the height of the shoulders from the ground args: segment_length (float): height of the shoulders Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.818 def height_from_height_chest(segment_length): """ Calculates body height based on the height of the chest (equal to the nipples) from the ground args: segment_length (float): height of the chest (equal to the nipples) Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.720 def height_from_height_elbow(segment_length): """ Calculates body height based on the height of the elbows from the ground args: segment_length (float): height of the elbows Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.630 def height_from_height_wrist(segment_length): """ Calculates body height based on the height of the elbows from the ground args: segment_length (float): height of the wrists Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.485 def height_from_height_fingertip(segment_length): """ Calculates body height based on the height of the fingertips from the ground args: segment_length (float): height of the fingertips Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.377 def height_from_height_hips(segment_length): """ Calculates body height based on the height of the hips from the ground args: segment_length (float): height of the hips Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.530 def height_from_height_buttocks(segment_length): """ Calculates body height based on the height of the buttocks from the ground args: segment_length (float): height of the buttocks Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.485 def height_from_height_knee(segment_length): """ Calculates body height based on the height of the knees from the ground args: segment_length (float): height of the knees Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.285 def height_from_height_ankle(segment_length): """ Calculates body height based on the height of the ankles from the ground args: segment_length (float): height of the ankles Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.039 def height_from_head_length(segment_length): """ Calculates body height based on the height of the head args: segment_length (float): vertical length of head Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.130 def height_from_shoulder_distance(segment_length): """ Calculates body height based on the horizontal distance from the center of the chest to the shoulder args: segment_length (float): horizontal distance from the center of the chest to the shoulder Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.129 def height_from_shoulder_width(segment_length): """ Calculates body height based on the width of the shoulders args: segment_length (float): width of the shoulders Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.259 def height_from_hips_width(segment_length): """ Calculates body height based on the horizontal width of the hips args: segment_length (float): width of the hips Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.191 def height_from_nipple_width(segment_length): """ Calculates body height based on the horizontal distance between nipples args: segment_length (float): horizontal distance between nipples Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.174 def height_from_foot_width(segment_length): """ Calculates body height based on the foot breadth args: segment_length (float): breadth of the foot Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.055 def height_from_foot_length(segment_length): """ Calculates body height based on the foot length args: segment_length (float): length of foot Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.152 def height_from_humerus_length(segment_length): """ Calculates body height based on the humerus (shoulder to elbow) length args: segment_length (float): length of humerus (shoulder to end of elbow) Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.186 def height_from_forearm_length(segment_length): """ Calculates body height based on the forearm length (elbow to wrist) args: segment_length (float): length of forearm Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.146 def height_from_hand_length(segment_length): """ Calculates body height based on the hand length (wrist to fingertips) args: segment_length (float): length of length of hand Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.108 def height_from_upperbody_length(segment_length): """ Calculates body height based on the upper body length (top of head to bottom of torso) args: segment_length (float): length of upper body Returns: float: total body height """ if segment_length <= 0: raise ValueError('segment_length must be > 0') return segment_length / 0.520 class Segment(object): def __init__(self, body_height): if body_height <= 0: raise ValueError('body_height must be > 0') self.body_height = body_height def height_eyes(self): """ Calculates the height of the eyes from the ground based on the body height Returns: float: height of the eyes from the ground """ return 0.936 * self.body_height def height_head(self): """ Calculates the height of the head (up to the bottom of the chin) from the ground based on the body height Returns: float: height of the head (bottom of chin) from the ground """ return 0.870 * self.body_height def height_shoulders(self): """ Calculates the height of the shoulders from the ground based on the body height Returns: float: height of the shoulders from the ground """ return 0.818 * self.body_height def height_chest(self): """ Calculates the height of the chest (equal to the nipples) from the ground based on the body height Returns: float: height of the chest (equal to nipples) from the ground """ return 0.720 * self.body_height def height_elbow(self): """ Calculates the height of the elbows from the ground based on the body height Returns: float: height of the elbow from the ground """ return 0.630 * self.body_height def height_wrist(self): """ Calculates the height of the wrists from the ground based on the body height Returns: float: height of the wrists from the ground """ return 0.485 * self.body_height def height_fingertip(self): """ Calculates the height of the fingertips from the ground based on the body height Returns: float: height of the fingertips from the ground """ return 0.377 * self.body_height def height_hips(self): """ Calculates the height of the hips from the ground based on the body height Returns: float: height of the hips from the ground """ return 0.530 * self.body_height def height_buttocks(self): """ Calculates the height of the buttocks from the ground based on the body height Returns: float: height of the buttocks from the ground """ return 0.485 * self.body_height def height_knee(self): """ Calculates the height of the knees from the ground based on the body height Returns: float: height of the knees from the ground """ return 0.285 * self.body_height def height_ankle(self): """ Calculates the height of the ankles from the ground based on the body height Returns: float: height of theankles from the ground """ return 0.039 * self.body_height def head_height(self): """ Calculates the height of the head based on the body height Returns: float: vertical height of the head """ return 0.130 * self.body_height def shoulder_distance(self): """ Calculates the horizontal distance from the center of the chest to the shoulder based on the body height Returns: float: horizontal distance from the center of the chest to the shoulder """ return 0.129 * self.body_height def shoulder_width(self): """ Calculates the width of the shoulders based on the body height Returns: float: shoulder width """ return 0.259 * self.body_height def hips_width(self): """ Calculates the horizontal width of the hips based on the body height Returns: float: width of the hips """ return 0.191 * self.body_height def nipple_width(self): """ Calculates the horizontal distance between nipples based on the body height Returns: float: horizontal distance between nipples """ return 0.174 * self.body_height def foot_width(self): """ Calculates the foot breadth based on the body height Returns: float: width of the foot """ return 0.055 * self.body_height def foot_length(self): """ Calculates the foot length based on the body height Returns: float: length of the foot """ return 0.152 * self.body_height def humerus_length(self): """ Calculates the humerus (shoulder to elbow) length based on the body height Returns: float: length of the humerus """ return 0.186 * self.body_height def forearm_length(self): """ Calculates the forearm length (elbow to wrist) based on the body height Returns: float: length of the forearm """ return 0.146 * self.body_height def hand_length(self): """ Calculates the hand length (wrist to fingertips) based on the body height Returns: float: length of the hand """ return 0.108 * self.body_height def upperbody_length(self): """ Calculates the upper body length (top of head to bottom of torso) based on the body height Returns: float: length of the upper body """ return 0.520 * self.body_height
## # .port ## """ Platform specific modules. The subject of each module should be the feature and the target platform. This is done to keep modules small and descriptive. These modules are for internal use only. """ __docformat__ = 'reStructuredText'
x = input("Give me a number: ") y = input ("Give me a word: ") out = "Output: "+str(x)+" "+str(y) if x == 0 or x > 1: if y[-2:] ==('ly'): out = out [:-1]+'ies' elif y[-2:] == "us": out = out[:-2]+"i" elif y[-2:] == "sh" or y[-2:] == "ch": out += "es" else: out +="s" print (out)
class MarkdownEmitter(object): def initialize(self, filename, title, author, date): self.file = open(filename, "w") self.file.write(title) self.file.write("\n======================================================================\n\n") self.file.write("## %s (%s) ##" % (author, date)) def emit_category(self, category): self.file.write("\n## %s\n\n" % category) def emit_header(self, num, meter, author): if author == "": self.file.write("**%s**. (%s) \n" % (num, meter)) else: self.file.write("**%s**. (%s) _%s_ \n" % (num, meter, author)) def emit_footer(self): pass def emit_stanza(self, stanza): self.file.write("%s %s \n" % (stanza.num, stanza[0])) for line in stanza[1:]: self.file.write("%s \n" % line) self.file.write("\n") def finalize(self): self.file.close()
n = int(input()) t = list(map(int, input().split())) m = int(input()) drink = [tuple(map(int, input().split())) for _ in range(m)] for i in range(m): ans = 0 for j in range(n): if drink[i][0] == j + 1: ans += drink[i][1] else: ans += t[j] print(ans)
#!/usr/bin/env python ''' Name : APO Config, apoconfig.py Author: Nickalas Reynolds Date : Fall 2017 Misc : Config File for apo output ''' config={ 'pprint' : True,\ 'commentline' : '#',\ 'includefields': True,\ 'header' : '',\ 'interfielddelimiter': ' ',\ 'intrafielddelimiter': ['',':',':',''],\ 'fields' : ['Name','RA','Dec','Magnitude'],\ 'fieldprefix': ['','','','Magntitude='],\ 'fieldsuffix': ['','','',''],\ 'customend' : '',\ 'customfield': ["Telescope Home",98,30,"CSys=Mount; RotType=Mount; RotAng=0"],\ }
def open_file(file): with open(file) as f: data = [x.strip() for x in f.readlines()] return data def get_gama_eps_in_str(data): gamma = '' eps = '' for i in range(len(data[0])): bit_value = 0 for j in range(len(data)): bit_value += int(data[j][i]) max_occurance_bit = bit_value // (len(data) // 2) gamma += str(max_occurance_bit) eps += str(1 - max_occurance_bit) return gamma, eps def day3_a(data): gamma, eps = get_gama_eps_in_str(data) gamma = int(gamma, 2) eps = int(eps, 2) print(gamma * eps) def bit_criteria_1(rows, i): value = sum([int(x[i]) for x in rows]) / len(rows) return '0' if value < 0.5 else '1' def bit_criteria_2(rows, i): value = sum([int(x[i]) for x in rows]) / len(rows) return '1' if value < 0.5 else '0' def look_for_values(data, filtering_crit): filtered_data = data for i in range(len(data[0])): gamma_eps = filtering_crit(filtered_data, i) filtered_data = [x for x in filtered_data if x[i] == gamma_eps] if len(filtered_data) == 1: break return filtered_data[0] def day3_b(data): o_rating = look_for_values(data, bit_criteria_1) co2_rating = look_for_values(data, bit_criteria_2) o_rating = int(o_rating, 2) co2_rating = int(co2_rating, 2) print(o_rating * co2_rating) if __name__ == '__main__': data = open_file('inputs/day3.txt') # day3_a(data) day3_b(data)
class SiteType: def __init__(self): pass Communication = "CommunicationSite" Team = "TeamSite"
""" Given a string num which represents an integer, return true if num is a strobogrammatic number. A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Example 1: Input: num = "69" Output: true Example 2: Input: num = "88" Output: true Example 3: Input: num = "962" Output: false """ class Solution: """ Build rotated string and compare with the source string. Strobogrammatic strings shall equal. Runtime: 28 ms, faster than 80.88% of Python3 Memory Usage: 14.3 MB, less than 12.53% of Python3 Time / Space complexity: O(n) """ def isStrobogrammatic(self, num: str) -> bool: strob = {"0": "0", "1": "1", "6": "9", "9": "6", "8": "8"} rev_num = list() for n in num: if n in strob: rev_num.append(strob[n]) else: return False return num == "".join(reversed(rev_num)) class Solution2: """ Two-pointers approach Runtime: 28 ms, faster than 80.88% of Python3 Memory Usage: 14 MB, less than 99.05% of Python3 Time complexity: O(n) as we need to check all the digits in num Space complexity: O(1) as we use constant extra space for "strob" dict """ def isStrobogrammatic(self, num: str) -> bool: strob = {"0": "0", "1": "1", "6": "9", "9": "6", "8": "8"} i, j = 0, len(num) - 1 while i <= j: if num[i] not in strob or strob[num[i]] != num[j]: return False i += 1 j -= 1 return True if __name__ == '__main__': solutions = [Solution(), Solution2()] tc = ( ("69", True), ("88", True), ("962", False), ("1", True), ("2", False), ("101", True), ) for s in solutions: for inp, exp in tc: res = s.isStrobogrammatic(inp) assert res is exp, f"{s.__class__.__name__}: for input {inp} expected {exp}, got {res}"
# # PySNMP MIB module CXOperatingSystem-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXOperatingSystem-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:33:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") cxOperatingSystem, = mibBuilder.importSymbols("CXProduct-SMI", "cxOperatingSystem") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, ModuleIdentity, Bits, MibIdentifier, Unsigned32, IpAddress, NotificationType, iso, Counter64, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, TimeTicks, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ModuleIdentity", "Bits", "MibIdentifier", "Unsigned32", "IpAddress", "NotificationType", "iso", "Counter64", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "TimeTicks", "Integer32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") cxOsParameter = MibIdentifier((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1)) cxOsNbBufs = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 1), Integer32().clone(1200)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxOsNbBufs.setStatus('mandatory') if mibBuilder.loadTexts: cxOsNbBufs.setDescription('Determines the total number of data buffers to be created within the system. System heap memory is reduced as the number of buffers is increased. Range of Values: Depends on amount of installed system DRAM, as well as on requirements made by software during initialization. Cannot be set to a value larger than the one chosen for object cxOsNbSystemMsg. Default Value: 1200') cxOsBufSize = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 2), Integer32().clone(292)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxOsBufSize.setStatus('mandatory') if mibBuilder.loadTexts: cxOsBufSize.setDescription('Determines the size in bytes of each data buffer. Range of Values: 1 to 65535 Note: The maximum usable size depends on amount of installed system DRAM, as well as on requirements made by software during initialization. Default Value: 292.') cxOsNbBufsAvail = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxOsNbBufsAvail.setStatus('mandatory') if mibBuilder.loadTexts: cxOsNbBufsAvail.setDescription('Displays the number of data buffers that has actually been created. If you want to change the number of buffers you must change cxOsNbBufs. Range of Values: Depends on amount of installed system DRAM, as well as on requirements made by software during initialization.') cxOsNbBufsFree = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxOsNbBufsFree.setStatus('mandatory') if mibBuilder.loadTexts: cxOsNbBufsFree.setDescription('Displays the number of data buffers that are currently free within the system. Range of Values: Depends on amount of installed system DRAM, as well as on requirements made by software during initialization.') cxOsNbSystemMsg = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 16), Integer32().clone(1320)).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxOsNbSystemMsg.setStatus('mandatory') if mibBuilder.loadTexts: cxOsNbSystemMsg.setDescription('Determines the number of message buffers defined in the system. One or more data buffers may be attached to a message buffer. Cannot be set to a value smaller than the value of object cxOsNbBufs. Range of Values: from the total number of buffers in the system to 65535 Default Value: 1320') cxOsNbSystemMsgFree = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 17), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cxOsNbSystemMsgFree.setStatus('mandatory') if mibBuilder.loadTexts: cxOsNbSystemMsgFree.setDescription('Displays the number of message buffers currently free in the system. Range of Values:from the total number of buffers in the system to 65535.') cxOsOptions = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 5, 5, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("data", 1), ("inst", 2), ("data-inst", 3), ("pipeline", 4), ("p-data", 5), ("p-inst", 6), ("p-data-inst", 7), ("none", 8))).clone('p-data-inst')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cxOsOptions.setStatus('mandatory') if mibBuilder.loadTexts: cxOsOptions.setDescription('Used for engineering testing only. Used to control data cache, instruction cache and pipeline features. Default value: p-data-inst') mibBuilder.exportSymbols("CXOperatingSystem-MIB", cxOsOptions=cxOsOptions, cxOsNbBufs=cxOsNbBufs, cxOsParameter=cxOsParameter, cxOsBufSize=cxOsBufSize, cxOsNbSystemMsg=cxOsNbSystemMsg, cxOsNbBufsAvail=cxOsNbBufsAvail, cxOsNbSystemMsgFree=cxOsNbSystemMsgFree, cxOsNbBufsFree=cxOsNbBufsFree)
#!/usr/bin/env python3 # ~*~ coding: utf-8 ~*~ # Now modify the grades program from section Dictionaries so that it uses # file I/O to keep a record of the students. assignments = ['hw ch 1', 'hw ch 2', 'quiz ', 'hw ch 3', 'test'] students = { } def load_grades(gradesfile): inputfile = open(gradesfile, "r") grades = [ ] while True: student_and_grade = inputfile.readline() student_and_grade = student_and_grade[:-1] if not student_and_grade: break else: studentname, studentgrades = student_and_grade.split(",") studentgrades = studentgrades.split(" ") students[studentname] = studentgrades inputfile.close() print("Grades loaded.") def save_grades(gradesfile): outputfile = open(gradesfile, "w") for k, v in students.items(): outputfile.write(k + ",") for x in v: outputfile.write(str(x) + " ") outputfile.write("\n") outputfile.close() print("Grades saved.") def print_menu(): print("1. Add student") print("2. Remove student") print("3. Load grades") print("4. Record grade") print("5. Print grades") print("6. Save grades") print("7. Print Menu") print("9. Quit") def print_all_grades(): if students: keys = sorted(students.keys()) print('\t', end=' ') for x in assignments: print(x, '\t', end=' ') print() for x in keys: print(x, '\t', end=' ') grades = students[x] print_grades(grades) else: print("There are no grades to print.") def print_grades(grades): for x in grades: print(x, '\t', end=' ') print() print_menu() menu_choice = 0 while menu_choice != 9: print() menu_choice = int(input("Menu Choice: ")) if menu_choice == 1: name = input("Student to add: ") students[name] = [0] * len(assignments) elif menu_choice == 2: name = input("Student to remove: ") if name in students: del students[name] else: print("Student:", name, "not found") elif menu_choice == 3: gradesfile = input("Load grades from which file? ") load_grades(gradesfile) elif menu_choice == 4: print("Record Grade") name = input("Student: ") if name in students: grades = students[name] print("Type in the number of the grade to record") print("Type a 0 (zero) to exit") for i,x in enumerate(assignments): print(i + 1, x, '\t', end=' ') print() print_grades(grades) which = 1234 while which != -1: which = int(input("Change which Grade: ")) which -= 1 if 0 <= which < len(grades): grade = input("Grade: ") # Change from float(input()) to input() to avoid an error when savi grades[which] = grade elif which != -1: print("Invalid Grade Number") else: print("Student not found") elif menu_choice == 5: print_all_grades() elif menu_choice == 6: gradesfile = input("Save grades to which file? ") save_grades(gradesfile) elif menu_choice != 9: print_menu()
class Solution: def containsDuplicate(self, nums: list) -> bool: hs = set() for n in nums: if n not in hs: hs.add(n) else: return True return False
""" Actions module for cumulus. Will be responsible for running the different actions, create, update and delete. """
#!/usr/bin/env python3 #coding:utf-8 class LNode(object): def __init__(self, x=None): self.val = x self.next = None def remove(r_node): """ 方法功能:给定单链表中某个结点,删除该节点 输入参数:链表中某结点 返回值:true: 删除该结点;false: 删除失败 """ # 若输入结点为空或该结点无后继结点,则无法删除;因为实际上是删除后继结点 if r_node is None or r_node.next is None: return False r_node.val = r_node.next.val r_node.next = r_node.next.next return True def constructLinkedList(n, random_num): """ 方法功能:创建单链表 输入参数:n: 不算头结点 head 与尾部的 None,结点的长度;random_num: 用来指向某个结点 返回值:head:建成的链表的头结点;random_node: 某个结点 """ head = LNode() cur = head for i in range(1, n+1): tmp = LNode() tmp.val = i cur.next = tmp cur = tmp if i == random_num: random_node = cur return head, random_node def printLinkedList(head): """ 打印单链表 """ print("head->", end='') cur = head.next while cur: print(cur.val, end="->") cur = cur.next print("None") return None if __name__ == "__main__": head, r_node = constructLinkedList(7, 5) print("before:", end=' ') printLinkedList(head) print("\nafter:", end=' ') remove(r_node) printLinkedList(head)
# The file containing all the group API methods def change_group_name(): row = db(db.group_data.id == request.vars.group_id).select().first() row.update_record(group_name = request.vars.group_name) return "ok" def add_group(): t_id = db.group_data.insert( group_owner = request.vars.group_owner, group_name = request.vars.group_name, ) r = db(db.group_data.id == t_id).select().first() return response.json(dict(group_data=dict( id = r.id, group_owner = r.group_owner, group_name = r.group_name, members = r.members, surf_session = r.surf_session ))) def delete_all_group_data(): "Deletes all groups from the table" db(db.group_data.id > -1).delete() return "ok" def delete_group(): db(db.group_data.id == request.vars.group_id).delete() return "ok" def get_groups(): groups = [] user = db(db.user_data.user_id == request.vars.user_id).select().first() if user.groups is not None: for r in user.groups: group = db(db.group_data.id == r).select().first() t = dict( id = group.id, group_owner = group.group_owner, group_name = group.group_name, members = group.members, surf_session = group.surf_session ) groups.append(t) for r in db(db.group_data.group_owner == request.vars.group_owner).select(): t = dict( id = r.id, group_owner = r.group_owner, group_name = r.group_name, members = r.members, surf_session = r.surf_session ) groups.append(t) return response.json(dict( groups = groups )) def get_group(): r = db(db.group_data.id == request.vars.group_id).select().first() return response.json(dict(group=dict( id = r.id, group_owner = r.group_owner, group_name = r.group_name, members = r.members, surf_session = r.surf_session ))) def edit_group_session(): r = db(db.group_data.id == request.vars.group_id).select().first() r.update_record(surf_session=request.vars.session) return "ok" def invite_member(): r = db(db.user_data.email == request.vars.invitee).select().first() group_id = int(request.vars.group_id) if request.vars.group_id is not None else -1 if r.notifications is not None: if group_id not in r.notifications: r.notifications.append(request.vars.group_id) r.update_record() else: r.update_record(notifications=[request.vars.group_id]) return "ok" def add_to_group(): r = db(db.group_data.id == request.vars.group_id).select().first() u = db(db.user_data.user_id == request.vars.user_id).select().first() if r.members is not None: r.members.append(request.vars.guest) r.update_record() if u.groups is not None: u.groups.append(request.vars.group_id) u.update_record() else: u.update_record(groups=[request.vars.group_id]) else: r.update_record(members=[request.vars.guest]) if u.groups is not None: u.groups.append(request.vars.group_id) u.update_record() else: u.update_record(groups=[request.vars.group_id]) def leave_group(): r = db(db.group_data.id == request.vars.group_id).select().first() u = db(db.user_data.user_id == request.vars.user_id).select().first() for idx, mem in enumerate(r.members): if mem == request.vars.member: r.members.pop(idx) r.update_record() group_id = int(request.vars.group_id) if request.vars.group_id is not None else -1 for index, group in enumerate(u.groups): # group = int(group) if group is not None else -1 if group == group_id: u.groups.pop(index) u.update_record() return "ok" def calculate_group_skill(): group = db(db.group_data.group_name == request.vars.group).select().first() owner = db(db.user_data.email == group.group_owner).select().first() skill_level = 0 counter = 0 print("owner skill lvl: ", owner.skill_level) if owner.skill_level == 'Beginner': skill_level = 1 elif owner.skill_level == 'Intermediate': skill_level = 2 elif owner.skill_level == 'Advanced': skill_level = 3 elif owner.skill_level == 'Expert': skill_level = 4 counter = counter + 1 if group.members is None: return skill_level for idx, mem in enumerate(group.members): user = db(db.user_data.email == mem).select().first() print("users skill lvl: ", user.skill_level) if user.skill_level == 'Beginner': skill_level += 1 elif user.skill_level == 'Intermediate': skill_level += 2 elif user.skill_level == 'Advanced': skill_level += 3 elif user.skill_level == 'Expert': skill_level += 4 counter = counter + 1 print("unrounded skill:", skill_level) skill_level = round(skill_level/counter) print("rounded skill:", skill_level) return skill_level
''' This contains the entity definition for three contiguous numbers. This would be useful for something like a phone number area code. ''' THREE_DIGIT_PATTERN = [[['NUM'], ['NUM'], ['NUM']]] ENTITY_DEFINITION = { 'patterns': THREE_DIGIT_PATTERN, 'spacing': { 'default': '', } }
""" EXERCÍCIO 010: Conversor de Moedas Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos Dólares ela pode comprar. Considere U$ 1,00 = R$ 3,27 """ real = float(input('Quanto dinheiro você tem na carteira? R$ ')) dolar = real / 3.27 print('Com R$ {:.2f} você pode comprar U$ {:.2f}.'.format(real, dolar))
# https://programmers.co.kr/learn/courses/30/lessons/42584 # 주식가격 def solution(prices): answer = [] for i in range(len(prices)): cnt = 0 for j in range(i+1, len(prices)): cnt+=1 if prices[i] > prices[j]: break answer.append(cnt) return answer
# -*- coding:utf-8 -*- # https://leetcode.com/problems/maximal-rectangle/description/ class Solution(object): def maximalRectangle(self, matrix): """ :type matrix: List[List[str]] :rtype: int """ def largestRectangleArea(heights): ret = 0 ascent_heights = [] ascent_idxs = [] n = len(heights) for idx, height in enumerate(heights): if not ascent_heights or ascent_heights[-1] < height: ascent_heights.append(height) ascent_idxs.append(idx) elif ascent_heights[-1] > height: while ascent_heights and ascent_heights[-1] > height: _height = ascent_heights.pop() _idx = ascent_idxs.pop() ret = max(ret, _height * (idx - _idx)) ascent_heights.append(height) ascent_idxs.append(_idx) while ascent_heights: ret = max(ret, ascent_heights.pop() * (n - ascent_idxs.pop())) return ret if not matrix: return 0 row = len(matrix) col = len(matrix[0]) ret = 0 heights = [0 for i in range(col)] for i in range(row): for j in range(col): if matrix[i][j] == '1': heights[j] += 1 else: heights[j] = 0 ret = max(ret, largestRectangleArea(heights)) return ret
""" Вывести в порядке возрастания все простые числа, расположенные между n и m (включая сами числа n и m), а также количество x этих чисел. """ start_number = int(input("Enter start number:")) end_number = int(input("Enter end number:")) # Generate elements from start_number to end_number (including) my_count = 0 for element in range(start_number, end_number + 1): # Check if this element is the prime number is_prime = True for divider in range(2, element): # If we've found any divider the remainder of which is zero # So current element is not the prime number if divider > 1 and element % divider == 0: is_prime = False break # Current element is the prime number if is_prime: print(element) my_count += 1 print("Total count of prime numbers") print(my_count)
# string programming_languages = ["rust", "java", "c#", "python", "typescript"] # Index + programming_languages[3] = "c++" # python => c++ programming_languages[4] = "ruby" # typescript => ruby programming_languages[len(programming_languages) - 1] = "javascript" # ruby => javascript # Index - programming_languages[-3] = "go" # c# => "go" programming_languages[-2] = "kotlin" # c++ => kotlin programming_languages[-5] = "scala" # rust => scala programming_languages[len(programming_languages) * (-1)] = "c++" # scala => c++ print("*******") # Selección múltiple programming_languages = ["rust", "python", "c#", "java", "typescript"] # Indices + programming_languages[1: 3] = ["c++"] # ["rust", "c++", "java", "typescript"] programming_languages[2: 3] = ["kotlin", "scala", "python"] # ["rust", "c++", "kotlin", "scala", "python", "typescript"] # Omitir la posición inicial programming_languages[: 5] = ["c#", "kotlin"] # ["c#", "kotlin", "typescript"] programming_languages[: 1] = ["rust", "c++", "kotlin", "scala", "python"] # ["rust", "c++", "kotlin", "scala", "python", "kotlin", "typescript"] # Omitir la posición final programming_languages[0: ] = ["java"] # ["java"] programming_languages[0: ] = ["java", "kotlin", "rust", "scala"] # ["java", "kotlin", "rust", "scala"] # Indices - programming_languages = ["rust", "python", "c#", "java", "typescript"] programming_languages[-4: -2] = ["scala", "kotlin"] # ["rust", "scala", "kotlin", "java", "typescript"] # Omitir la posición inicial programming_languages[: -1] = ["c++", "c#"] # ["c++", "c#", "typescript"] # Omitir la posición final programming_languages[-5: ] = ["rust", "python", "c#", "java", "typescript"] # ["rust", "python", "c#", "java", "typescript"] print("*******")
#def jogar(): print(40 * "*") print("Bem vindo ao jogo da FORCA") print(40 * "*") palavra_secreta = 'banana' enforcou = False acertou = False while not enforcou and not acertou: chute = input("Qual letra? ") print('jogando...') # if __name__ == "main": # jogar()
num = 7 step = 2 begin = 41 num *= step for i in range(begin, begin+num, step): print(i, end=',')
campaign = { 'type': ['object', 'null'], 'properties': { 'asset_id': {'type': 'integer'}, 'asset_name': {'type': 'string'}, 'modified_time': {'type': 'string'}, 'version_number': {'type': 'integer'}, } } owner = { 'type': ['object', 'null'], 'properties': { 'asset_id': {'type': 'integer'}, 'first_name': {'type': 'string'}, 'last_name': {'type': 'string'}, 'modified_time': {'type': 'string'}, } } transactional_mailing = { 'type': 'object', 'properties': { 'id': { 'type': 'integer', 'description': 'The asset_id of this mailing', }, 'approved': {'type': 'boolean'}, 'asset_name': {'type': 'string'}, 'campaign': campaign, 'channel': {'type': 'string'}, 'compliance': {'type': 'boolean'}, 'mailing_priority': {'type': 'string'}, 'mailing_server_group': {'type': 'string'}, 'mailing_status': {'type': 'string'}, 'modified_time': {'type': 'string'}, 'owner': owner, 'target': { 'type': ['object', 'null'], 'properties': { 'asset_id': {'type': 'integer'}, 'asset_name': {'type': 'string'}, } }, 'version_number': {'type': 'integer'} } } internal_datasource = { 'type': 'object', 'properties': { 'id': { 'type': 'integer', 'description': 'The asset_id of this mailing', }, 'asset_name': {'type': 'string'}, 'asset_url': {'type': 'string'}, 'campaign': campaign, 'cloud_sync': {'type': 'boolean'}, 'data_source_stat': { 'type': 'object', 'properties': { 'num_total_rec': {'type': 'integer'} } }, 'modified_time': {'type': 'string'}, 'owner': owner, 'version_number': {'type': 'integer'} } } extension_datasource = internal_datasource source = { 'type': ['object', 'null'], 'properties': { 'asset_id': {'type': 'integer'}, 'asset_name': {'type': 'string'}, 'data_source_type': {'type': 'string'}, 'version_number': {'type': 'integer'}, 'modified_time': {'type': 'string'}, } } program = { 'type': 'object', 'properties': { 'id': { 'type': 'integer', 'description': 'The asset_id of this mailing', }, 'asset_name': {'type': 'string'}, 'asset_url': {'type': 'string'}, 'campaign': campaign, 'modified_time': {'type': 'string'}, 'owner': owner, 'primary_source': source, 'program_data_source': source, 'status': {'type': 'string'}, 'type': {'type': 'string'}, } } endpoint_to_schema_mapping = { 'programs': program, 'mailings/transactional': transactional_mailing, 'data-sources/internal': internal_datasource, 'data-sources/extension': extension_datasource, }
# Note that the performance of the solutions below will not be great, # since we use python lists here, while linked lists would be a better # structure to use for such recursive solutions. # # Note also that such implementations are prone to stack overflow, since # when recursion is used as a substitute for a loop, the recursion depth # can become pretty large. # 1.A.1 - List filtering def list_filter(lst, pred): if not lst: return [] fst, *rest = lst if pred(fst): return [fst] + list_filter(rest, pred) else: return list_filter(rest, pred) # 1.A.2 - Consecutive elements runs lengths def count_runs(lst): if not lst: return [] else: fst, *rest = lst for index, elem in enumerate(rest): if elem != fst: return [index + 1] + count_runs(rest[index:]) return [len(lst)] # 1.A.3 - Positions of a subsequence in a list def sequence_position(lst, seq, start=0): if not seq or not lst or len(seq) > len(lst) - start: return [] if lst[start : len(seq) + start] == seq: return [start] + sequence_position(lst, seq, start + 1) else: return sequence_position(lst, seq, start + 1)
### Group the People Given the Group Size They Belong To - Solution class Solution: def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: id_and_person = collections.defaultdict(list) for person, id_ in enumerate(groupSizes): id_and_person[id_].append(person) final_group = tuple(val[i:i+key] for key, val in id_and_person.items() for i in range(0, len(val), key)) return final_group
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations # ---------------------------------------------------------------------------------------------------------------------- # Customize your APP title, subtitle and menus here # ---------------------------------------------------------------------------------------------------------------------- response.logo = A(B('Sis', SPAN("GIEM")), _class="navbar-brand", _href=URL("sisgiem", "default", "index"), _id="siem-logo") response.title = request.application.replace('_', ' ').title() response.subtitle = '' # ---------------------------------------------------------------------------------------------------------------------- # read more at http://dev.w3.org/html5/markup/meta.name.html # ---------------------------------------------------------------------------------------------------------------------- response.meta.author = myconf.get('app.author') response.meta.description = myconf.get('app.description') response.meta.keywords = myconf.get('app.keywords') response.meta.generator = myconf.get('app.generator') # ---------------------------------------------------------------------------------------------------------------------- # your http://google.com/analytics id # ---------------------------------------------------------------------------------------------------------------------- response.google_analytics_id = None # ---------------------------------------------------------------------------------------------------------------------- # this is the main application menu add/remove items as required # ---------------------------------------------------------------------------------------------------------------------- response.menu = [ (SPAN(I(_class="glyphicon glyphicon-home", _id="home")), False, URL("default", "index")), (SPAN("Grupo Soporte a la Operación"), False, URL('gpo_sporte_oper', 'index'), [ (SPAN("Red de abonados"), False, URL('gso_red_abonados', 'index')), (SPAN("Red de datos"), False, URL('gso_red_datos', 'index')), ]), (SPAN("Centros telefónicos"), False, URL('gpo_sporte_oper', 'centros_telefonicos'), []), (SPAN("Centrales telefónicas"), False, URL('gpo_sporte_oper', 'centrales_telefonicas'), []), (SPAN(I(_class="glyphicon glyphicon-cog"), _id="admin_panel"), False, URL("odr","default", "admin_panel")) ] response.menu_ra = [ (SPAN("Int. pendientes al inicio"), False, URL('gso_red_abonados', 'siprec_pendientes_inicio'), []), (SPAN("Int. pendientes al cierre"), False, URL('gso_red_abonados', 'siprec_pendientes_cierre'), []), (SPAN("Int. reparadas"), False, URL('gso_red_abonados', 'siprec_reparadas'), []), (SPAN("Servicios"), False, URL('gso_red_abonados', 'servicios'), []), (SPAN("Parte por CTLC"), False, URL('gso_red_abonados', 'parte_por_centros'), []), (SPAN("Int. pendientes al cierre por grupo"), False, URL('gso_red_abonados', 'int_pend_al_cierre_por_grupo'), []), (SPAN(I(_class="glyphicon glyphicon-import"), "Importar interrupciones ", B("SIPREC", _class="badge badge-info lable-xs")), False, URL('gso_red_abonados', 'importar_interrupciones_desde_siprec')), #(SPAN(I(_class="glyphicon glyphicon-import"), " Importar interrupciones ", B("SIPREC", _class="badge badge-info lable-xs")), False, URL('gso_red_abonados', 'importar')), ] response.menu_rd = [ (SPAN("Int. pendientes al inicio"), False, URL('gso_red_datos', 'siprec_pendientes_inicio'), []), (SPAN("Int. pendientes al cierre"), False, URL('gso_red_datos', 'siprec_pendientes_cierre'), []), (SPAN("Int. reparadas"), False, URL('gso_red_datos', 'siprec_reparadas'), []), (SPAN("Servicios"), False, URL('gso_red_datos', 'servicios'), []), (SPAN("Parte por CTLC"), False, URL('gso_red_datos', 'parte_por_centros'), []), (SPAN("Int. pendientes al cierre por grupo"), False, URL('gso_red_datos', 'int_pend_al_cierre_por_grupo'), []), (SPAN(I(_class="glyphicon glyphicon-import"), "Importar interrupciones ", B("SIPREC", _class="badge badge-info lable-xs")), False, URL('gso_red_datos', 'importar_interrupciones_desde_siprec')), #(SPAN(I(_class="glyphicon glyphicon-import")," Importar interrupciones ", B("SIPREC", _class="badge badge-info lable-xs")), False, URL('gso_red_datos', 'importar')), ] response.menu_pe = [ (SPAN("Servicios Nauta Hogar"), False, URL('planta_exterior', 'servicios_nauta_hogar'), []), (SPAN("Facilidades P. Ext."), False, URL('planta_exterior', 'facilidades_pe'), []), (SPAN(I(_class="glyphicon glyphicon-import"), "Importar Servicios Nauta Hogar"), False, URL('planta_exterior', 'importar_servicios_comercializables')), (SPAN(I(_class="glyphicon glyphicon-import"), "Importar Facilidades P. Ext. ", B("SIPREC", _class="badge badge-info lable-xs")), False, URL('planta_exterior', 'importar_facilidades')), ] if "auth" in locals(): auth.wikimenu()
def cost_d(channel, amount): return channel["outpol"]["base"] * 1000 + amount * channel["outpol"]["rate"] def dist_d(channel, amount): return 1
# Funcoes # escopos dentro e fora def funcao(): # escopo local n1 = 4 print(f'N1 dentro vale {n1}') n1 = 2 # escopo global funcao() print(f'N1 global vale {n1}')
class EmptySubjectStorage: def is_concurrency_safe(self): return False def is_persistent(self): return False def load(self): return {}, {} def store(self, inserts=[], updates=[], deletes=[]): pass def set(self, prop, old_value_default=None): return None, None def get(self, prop): return None def delete(self, prop): pass def get_ext_props(self): return {} def flush(self): return self
# # PySNMP MIB module HH3C-FC-FLOGIN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-FC-FLOGIN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:13:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint") Hh3cFcRxMTU, Hh3cFcClassOfServices, Hh3cFcBbCredit, Hh3cFcNameId, Hh3cFcAddressId = mibBuilder.importSymbols("HH3C-FC-TC-MIB", "Hh3cFcRxMTU", "Hh3cFcClassOfServices", "Hh3cFcBbCredit", "Hh3cFcNameId", "Hh3cFcAddressId") hh3cVsanIndex, hh3cSan = mibBuilder.importSymbols("HH3C-VSAN-MIB", "hh3cVsanIndex", "hh3cSan") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, ModuleIdentity, NotificationType, Counter64, IpAddress, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Integer32, Unsigned32, TimeTicks, MibIdentifier, iso, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "ModuleIdentity", "NotificationType", "Counter64", "IpAddress", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Integer32", "Unsigned32", "TimeTicks", "MibIdentifier", "iso", "Gauge32") DisplayString, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "TruthValue") hh3cFcFLogin = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3)) hh3cFcFLogin.setRevisions(('2013-02-27 11:00',)) if mibBuilder.loadTexts: hh3cFcFLogin.setLastUpdated('201302271100Z') if mibBuilder.loadTexts: hh3cFcFLogin.setOrganization('Hangzhou H3C Tech. Co., Ltd.') hh3cFcFLoginMibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1)) hh3cFcFLoginTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1), ) if mibBuilder.loadTexts: hh3cFcFLoginTable.setStatus('current') hh3cFcFLoginEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "HH3C-VSAN-MIB", "hh3cVsanIndex"), (0, "HH3C-FC-FLOGIN-MIB", "hh3cFcFLoginIndex")) if mibBuilder.loadTexts: hh3cFcFLoginEntry.setStatus('current') hh3cFcFLoginIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 1), Hh3cFcAddressId()) if mibBuilder.loadTexts: hh3cFcFLoginIndex.setStatus('current') hh3cFcFLoginPortNodeWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 2), Hh3cFcNameId()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginPortNodeWWN.setStatus('current') hh3cFcFLoginPortWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 3), Hh3cFcNameId()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginPortWWN.setStatus('current') hh3cFcFLoginPortFcId = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 4), Hh3cFcAddressId()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginPortFcId.setStatus('current') hh3cFcFLoginRxBbCredit = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 5), Hh3cFcBbCredit()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginRxBbCredit.setStatus('current') hh3cFcFLoginTxBbCredit = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 6), Hh3cFcBbCredit()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginTxBbCredit.setStatus('current') hh3cFcFLoginClass2RxMTU = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 7), Hh3cFcRxMTU()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginClass2RxMTU.setStatus('current') hh3cFcFLoginClass3RxMTU = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 8), Hh3cFcRxMTU()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginClass3RxMTU.setStatus('current') hh3cFcFLoginSuppClassRequested = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 9), Hh3cFcClassOfServices()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginSuppClassRequested.setStatus('current') hh3cFcFLoginClass2ReqAgreed = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 10), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginClass2ReqAgreed.setStatus('current') hh3cFcFLoginClass3ReqAgreed = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 2, 127, 3, 1, 1, 1, 11), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: hh3cFcFLoginClass3ReqAgreed.setStatus('current') mibBuilder.exportSymbols("HH3C-FC-FLOGIN-MIB", hh3cFcFLoginClass2ReqAgreed=hh3cFcFLoginClass2ReqAgreed, hh3cFcFLoginClass3ReqAgreed=hh3cFcFLoginClass3ReqAgreed, PYSNMP_MODULE_ID=hh3cFcFLogin, hh3cFcFLoginTxBbCredit=hh3cFcFLoginTxBbCredit, hh3cFcFLoginTable=hh3cFcFLoginTable, hh3cFcFLoginPortWWN=hh3cFcFLoginPortWWN, hh3cFcFLoginIndex=hh3cFcFLoginIndex, hh3cFcFLoginPortNodeWWN=hh3cFcFLoginPortNodeWWN, hh3cFcFLoginEntry=hh3cFcFLoginEntry, hh3cFcFLoginRxBbCredit=hh3cFcFLoginRxBbCredit, hh3cFcFLoginClass2RxMTU=hh3cFcFLoginClass2RxMTU, hh3cFcFLogin=hh3cFcFLogin, hh3cFcFLoginSuppClassRequested=hh3cFcFLoginSuppClassRequested, hh3cFcFLoginMibObjects=hh3cFcFLoginMibObjects, hh3cFcFLoginPortFcId=hh3cFcFLoginPortFcId, hh3cFcFLoginClass3RxMTU=hh3cFcFLoginClass3RxMTU)
def desenha(linha): while linha > 0: coluna = 1 while coluna <= linha: print('*', end = "") coluna = coluna + 1 print() linha = linha - 1 desenha(5)
IMAGE_DIM = (210, 160, 3) INPUT_DIM = (None, 84, 84, 4) # NONE for batch size OUTPUT_DIM = (None, 3) # up down and nothing class StudentPongConfig: input_size = INPUT_DIM output_size = OUTPUT_DIM iterative_PoPS = r'PoPS_Iterative' model_path_policy_dist_pruned = r'saved_models/network_dense_Pong_Student_policy_pruned' model_path_policy_dist_ready = r'saved_models/network_dense_Pong_Student_policy_dist_ready' prune_best = r'saved_models/best_prune' batch_size = 256 memory_size = 100000 # 100k OBSERVE = 25000 # Used to be 50k scope = 'PongStudent' tau = 0.01 n_epochs = 100 ALPHA_PER = 0.6 EPS_PER = 1e-6 BETA0_PER = 0.4 eval_prune = 10 @staticmethod def learning_rate_for_10_and_up(epoch: int): if epoch <= 5: return 1e-5 # usually 1e-5 for 6% and up and 3 1e-4 for lower if 5 < epoch <= 10: return 5e-6 if 10 < epoch <= 20: return 1e-6 else: return 5e-7 @staticmethod def learning_rate_for_10_and_down(epoch: int): if epoch <= 5: return 8e-4 if 5 < epoch <= 10: return 7e-4 if 10 < epoch <= 15: return 5e-4 if 15 < epoch <= 20: return 1e-4 if 20 < epoch <= 30: return 5e-5 if 30 < epoch <= 40: return 2e-6 if 40 < epoch <= 45: return 1e-6 if 45 < epoch <= 50: return 5e-7 else: return 1e-7 @staticmethod def beta_schedule(beta0, e: int, n_epoch: int): return min(beta0 + ((1 - beta0) / n_epoch) * e, 1.0) @staticmethod def learning_rate_schedule(epoch: int, arch_type=0): if arch_type == 0: return StudentPongConfig.learning_rate_for_10_and_up(epoch) else: return StudentPongConfig.learning_rate_for_10_and_down(epoch) @staticmethod def learning_rate_for_10_and_up_prune(epoch: int): if epoch <= 20: return 5.0e-6 # usually 1e-5 for 6% and up and 3 1e-4 for lower if 20 < epoch <= 40: return 1e-6 if 40 < epoch <= 60: return 5e-7 else: return 1e-7 @staticmethod def learning_rate_for_10_and_down_prune(epoch: int): if epoch <= 20: return 1.0e-5 # usually 1e-5 for 6% and up and 3 1e-4 for lower if 20 < epoch <= 40: return 5e-6 if 40 < epoch <= 60: return 1e-6 else: return 5e-7 @staticmethod def learning_rate_schedule_prune(epoch: int, arch_type=0): if arch_type == 0: return StudentPongConfig.learning_rate_for_10_and_up_prune(epoch) else: return StudentPongConfig.learning_rate_for_10_and_down_prune(epoch) class DensePongAgentConfig: input_size = INPUT_DIM output_size = OUTPUT_DIM n_epoch = 3500 gamma = 0.99 initial_epsilon = 1.0 final_epsilon = 0.02 memory_size = 100000 # 100k batch_size = 32 model_path = r'saved_models/network_dense_Pong' ready_path = r'saved_models/network_dense_Pong_ready' EXPLORE = 100000 # 100k OBSERVE = 10000 # 10k UPDTATE_FREQ = 1000 OBJECTIVE_SCORE = 18.0 LOWER_BOUND = 0.0 steps_per_train = 4 scope = 'PongDQN' ALPHA_PER = 0.6 EPS_PER = 1e-6 BETA0_PER = 0.4 @staticmethod def learning_rate_schedule(epoch : int): if epoch <= 300: return 1e-4 if 300 < epoch <= 500: return 5e-5 if 500 < epoch <= 700: return 1e-5 if 700 < epoch <= 1200: return 5e-6 else: return 1e-6 @staticmethod def beta_schedule(beta0, e: int, n_epoch: int): return min(beta0 + ((1 - beta0) / n_epoch) * e, 1.0) class PrunePongAgentConfig: input_size = INPUT_DIM output_size = OUTPUT_DIM n_epoch = 3000 gamma = 0.99 initial_epsilon = 0.05 final_epsilon = 0.05 memory_size = 100000 # 100k batch_size = 32 model_path = r'saved_models/network_prune_Pong' best_path = r'saved_models/network_prune_Pong_best' steps_per_train = 4 OBSERVE = 25000 # 10k pruning_end = -1 target_sparsity = 0.99 # used to be 0.9 pruning_freq = 50 initial_sparsity = 0 sparsity_start = 0 sparsity_end = int(7.5e5) # random big number ALPHA_PER = 0.6 EPS_PER = 1e-6 BETA0_PER = 0.4 scope = 'Pruned_PongDQN' @staticmethod def beta_schedule(beta0, e: int, n_epoch: int): return min(beta0 + ((1 - beta0) / n_epoch) * e, 1.0) @staticmethod def learning_rate_for_10_and_up(epoch: int): if epoch <= 5: return 5e-6 # usually 1e-5 for 6% and up and 3 1e-4 for lower if 5 < epoch <= 10: return 1e-6 if 10 < epoch <= 20: return 1e-6 else: return 1e-6 @staticmethod def learning_rate_for_10_and_down(epoch: int): if epoch <= 5: return 1e-5 if 5 < epoch <= 10: return 5e-5 if 10 < epoch <= 20: return 5e-6 else: return 1e-6 @staticmethod def learning_rate_schedule(epoch: int, arch_type=0): if arch_type == 0: return StudentPongConfig.learning_rate_for_10_and_up(epoch) else: return StudentPongConfig.learning_rate_for_10_and_down(epoch) class CartpoleConfig: input_size = (None, 4) output_size = (None, 2) model_path = 'saved_models/Cart_pole/network_dense' model_path_overtrained = r'saved_models/Cart_pole/network_dense_over_trained' ready_path = 'saved_models/Cart_pole/‏‏network_dense_ready' ready_path_overtrained = 'saved_models/Cart_pole/‏‏network_dense_ready_over_trained' n_epoch = 15000 batch_size = 128 memory_size = 100000 EXPLORE = 100000 # 100k OBSERVE = 25000 # 10k UPDTATE_FREQ = 600 ALPHA_PER = 0.6 EPS_PER = 1e-6 BETA0_PER = 0.4 OBJECTIVE_SCORE = 195 steps_per_train = 1 @staticmethod def learning_rate_schedule(epoch : int): if epoch <= 2500: return 1e-3 if 2500 < epoch <= 5000: return 8e-4 if 5000 < epoch <= 7500: return 5e-4 if 7500 < epoch <= 10000: return 1e-4 else: return 5e-5 @staticmethod def beta_schedule(beta0, e: int, n_epoch: int): return min(beta0 + ((1 - beta0) / n_epoch) * e, 1.0) class PruneCartpoleConfig: input_size = (None, 4) output_size = (None, 2) model_path = 'saved_models/Cart_pole/network_prune' best_model = 'saved_models/Cart_pole/‏network_prune_best' iterative_PoPS = r'PoPS_iterative' policy_dist = r'saved_models/‏network_policy_dist' n_epoch = 125 batch_size = 128 memory_size = 100000 EXPLORE = 100000 # 100k OBSERVE = 10000 # 10k UPDTATE_FREQ = 1000 ALPHA_PER = 0.6 EPS_PER = 1e-6 BETA0_PER = 0.4 OBJECTIVE_SCORE = 190 LOWER_BOUND = 80 steps_per_train = 1 pruning_end = -1 target_sparsity = 0.99 pruning_freq = 10 initial_sparsity = 0 sparsity_start = 0 sparsity_end = int(5e5) # random big number tau = 0.01 epsilon = 0.0 eval_prune = 25 @staticmethod def learning_rate_for_40_and_up(epoch : int): if epoch <= 20: return 1e-5 if 20 < epoch <= 50: return 5e-6 if 50 < epoch <= 80: return 2e-6 else: return 1e-6 @staticmethod def learning_rate_for_40_and_down(epoch: int): if epoch <= 20: return 1e-4 if 20 < epoch <= 50: return 5e-5 if 50 < epoch <= 80: return 2e-5 else: return 1e-5 @staticmethod def learning_rate_for_10_and_down(epoch: int): if epoch <= 20: return 1e-3 if 20 < epoch <= 50: return 5e-4 if 50 < epoch <= 80: return 2e-4 else: return 1e-4 @staticmethod def learning_rate_for_10_and_down_pruning(epoch: int): if epoch <= 20: return 1e-7 if 20 < epoch <= 50: return 8e-8 if 50 < epoch <= 80: return 5e-8 else: return 1e-9 @staticmethod def learning_rate_schedule(epoch: int, arch_type=0): if arch_type == 0: return PruneCartpoleConfig.learning_rate_for_40_and_up(epoch) if arch_type == 1: return PruneCartpoleConfig.learning_rate_for_40_and_down(epoch) if arch_type == 2: return PruneCartpoleConfig.learning_rate_for_10_and_down(epoch) if arch_type == 3: return PruneCartpoleConfig.learning_rate_for_10_and_down_pruning(epoch) @staticmethod def learning_rate_schedule_prune(epoch:int, arch_type=0): return PruneCartpoleConfig.learning_rate_schedule(epoch, arch_type) # just for compatibility with existing structure class LunarLanderConfig: input_size = (None, 8) output_size = (None, 4) critic_output = (None, 1) actor_path = 'saved_models/lunarlander/actor_dense' critic_path = 'saved_models/lunarlander/critic_dense' actor_ready_path = 'saved_models/lunarlander/‏‏actor_dense_ready' critic_ready_path = 'saved_models/lunarlander/critic_dense_ready' n_epoch = 10000 batch_size = 512 memory_size = 100000 OBSERVE = 10000 # 10k UPDATE_FREQ = 1000 # used to be 500 OBJECTIVE_SCORE = 200 @staticmethod def learning_rate_schedule_actor(epoch: int): if epoch <= 1500: return 1e-5 if 1500 < epoch <= 2500: return 5e-6 if 2500 < epoch <= 3500: return 1e-6 else: return 5e-7 @staticmethod def learning_rate_schedule_critic(epoch: int): if epoch <= 1500: return 1e-4 if 1500 < epoch <= 2500: return 5e-5 if 2500 < epoch <= 3500: return 1e-5 else: return 5e-6 class StudentLunarLanderConfig: input_size = (None, 8) output_size = (None, 4) iterative_PoPS = r'PoPS_results' n_epochs = 100 tau = 0.01 memory_size = 100000 batch_size = 512 OBSERVE = 10000 # 10k OBJECTIVE_SCORE = 200 LOWER_BOUND = 100 pruning_end = -1 target_sparsity = 0.99 pruning_freq = 10 initial_sparsity = 0 sparsity_start = 0 sparsity_end = int(5e5) # random big number eval_prune = 25 @staticmethod def learning_rate_for_40_and_up(epoch: int): if epoch <= 20: return 1e-5 if 20 < epoch <= 40: return 5e-6 if 40 < epoch <= 60: return 1e-6 else: return 5e-7 @staticmethod def learning_rate_for_40_and_down(epoch: int): if epoch <= 20: return 1e-5 if 20 < epoch <= 40: return 5e-6 if 40 < epoch <= 60: return 1e-6 else: return 5e-7 @staticmethod def learning_rate_for_10_and_down(epoch: int): if epoch <= 20: return 1e-3 if 20 < epoch <= 40: return 5e-4 if 40 < epoch <= 60: return 1e-4 else: return 5e-5 @staticmethod def learning_rate_for_10_and_down_pruning(epoch: int): if epoch <= 20: return 1e-6 if 20 < epoch <= 40: return 5e-7 if 40 < epoch <= 60: return 1e-7 else: return 5e-8 @staticmethod def learning_rate_schedule(epoch: int, arch_type=0): if arch_type == 0: return StudentLunarLanderConfig.learning_rate_for_40_and_up(epoch) if arch_type == 1: return StudentLunarLanderConfig.learning_rate_for_40_and_down(epoch) if arch_type == 2: return StudentLunarLanderConfig.learning_rate_for_10_and_down(epoch) if arch_type == 3: return StudentLunarLanderConfig.learning_rate_for_10_and_down_pruning(epoch) @staticmethod def learning_rate_schedule_prune(epoch:int, arch_type=0): return PruneCartpoleConfig.learning_rate_schedule(epoch, arch_type) # just for compatibility with existing structure
class TerminationCondition: """ Abstract class. """ def should_terminate(self, population): """ Executed by EvolutionEngine to determine when to end process. Returns True if evolution process should be terminated. :param population: Population :return: boolean """ raise NotImplementedError()
class Restaurant: def __init__(self, restaurant_name, cuisine_type, maximum): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type self.number_served = 0 self.maximum = maximum def describe_restaurant(self): print('The restaurant\'s name is ' + self.restaurant_name) print('The cuisine type is ' + self.cuisine_type) def open_restaurant(self): print(self.restaurant_name + ' is opening') def set_number_served(self, served): self.number_served = served def increment_number_served(self, maximum_people): self.maximum = maximum_people restaurant = Restaurant('有家餐厅', '中式') restaurant.describe_restaurant() restaurant.open_restaurant() restaurant.set_number_served(20) print('The restaurant name is ' + restaurant.restaurant_name.title()) print('The restaurant cuisine type is ' + restaurant.cuisine_type.title()) print('Totally ' + str(restaurant.number_served) + ' people eaten in this restaurant' ) print('The maximum people is ' + str(restaurant.increment_number_served)) # 1st way to change the value of number_served # restaurant.number_served = 20
# Momijigaoka | Unfamiliar Hillside if sm.getFieldID() == 807040100: sm.warp(807000000, 1) else: sm.warp(807040100, 0)
if __name__ == '__main__': n = int(input()) for i in range(n): print(i*i) ''' ==>range(lower_limit , upper_limit , incerment / Decrement) lower_limit is inclusive upper_limit is not included ==>range(upper_limit) '''
def get_token(fi='dont.mess.with.me'): with open(fi, 'r') as f: return f.readline().strip() t = get_token()
choices = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] print('\n') print('|' + choices[0] + '|' + choices[1] + '|' + choices[2] + '|') print('----------') print('|' + choices[3] + '|' + choices[4] + '|' + choices[5] + '|') print('----------') print('|' + choices[6] + '|' + choices[7] + '|' + choices[8] + '|')
class Solution: def majorityElement(self, nums: list[int]) -> int: current = 0 count = 0 for num in nums: if count == 0: current = num count = 1 continue if num == current: count += 1 else: count -= 1 return current tests = [ ( ([3, 2, 3],), 3, ), ( ([2, 2, 1, 1, 1, 2, 2],), 2, ), ]
# # Binomial heap (Python) # # Copyright (c) 2018 Project Nayuki. (MIT License) # https://www.nayuki.io/page/binomial-heap # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of # the Software, and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # - The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # - The Software is provided "as is", without warranty of any kind, express or # implied, including but not limited to the warranties of merchantability, # fitness for a particular purpose and noninfringement. In no event shall the # authors or copyright holders be liable for any claim, damages or other # liability, whether in an action of contract, tort or otherwise, arising from, # out of or in connection with the Software or the use or other dealings in the # Software. # class BinomialTree: def __init__(self, key): self.key = key self.children = [] self.order = 0 def add_at_end(self, t): self.children.append(t) self.order = self.order + 1 class BinomialHeap: def __init__(self): self.trees = [] def extract_min(self): if self.trees == []: return None smallest_node = self.trees[0] for tree in self.trees: if tree.key < smallest_node.key: smallest_node = tree self.trees.remove(smallest_node) h = BinomialHeap() h.trees = smallest_node.children self.merge(h) return smallest_node.key def get_min(self): if self.trees == []: return None least = self.trees[0].key for tree in self.trees: if tree.key < least: least = tree.key return least def combine_roots(self, h): self.trees.extend(h.trees) self.trees.sort(key=lambda tree: tree.order) def merge(self, h): self.combine_roots(h) if self.trees == []: return i = 0 while i < len(self.trees) - 1: current = self.trees[i] after = self.trees[i + 1] if current.order == after.order: if (i + 1 < len(self.trees) - 1 and self.trees[i + 2].order == after.order): after_after = self.trees[i + 2] if after.key < after_after.key: after.add_at_end(after_after) del self.trees[i + 2] else: after_after.add_at_end(after) del self.trees[i + 1] else: if current.key < after.key: current.add_at_end(after) del self.trees[i + 1] else: after.add_at_end(current) del self.trees[i] i = i + 1 def insert(self, key): g = BinomialHeap() g.trees.append(BinomialTree(key)) self.merge(g)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 20 21:08:16 2018 @author: aarontallman """ #import data_collection #import model_building #import game_player
class NotFoundException(Exception): pass class ExistsException(Exception): pass class InvalidFilter(Exception): pass class IncorrectFormatException(Exception): pass
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: audit.py ERR_AUDIT_SUCCESS = 0 ERR_AUDIT_DISABLE_FAILED = 1 ERR_AUDIT_ENABLE_FAILED = 2 ERR_AUDIT_UNKNOWN_TYPE = 3 ERR_AUDIT_EXCEPTION = 4 ERR_AUDIT_PROCESS_NOT_FOUND = 5 ERR_AUDIT_OPEN_PROCESS_FAILED = 6 ERR_AUDIT_MODULE_BASE_NOT_FOUND = 7 ERR_AUDIT_READ_MEMORY_FAILED = 8 ERR_AUDIT_MEMORY_ALLOC_FAILED = 9 ERR_AUDIT_PATTERN_MATCH_FAILED = 10 ERR_AUDIT_MODIFY_PROTECTION_FAILED = 11 ERR_AUDIT_FAILED_VALUE_READ = 12 ERR_AUDIT_FAILED_VALUE_WRITE = 13 ERR_AUDIT_VALUE_UNEXPECTED = 14 ERR_AUDIT_INVALID_PARAMETER = 15 errorStrings = {ERR_AUDIT_DISABLE_FAILED: 'Disable of auditing failed', ERR_AUDIT_ENABLE_FAILED: 'Enable of auditing failed', ERR_AUDIT_UNKNOWN_TYPE: 'Unknown audit type', ERR_AUDIT_EXCEPTION: 'Exception thrown attempting to modify auditing', ERR_AUDIT_PROCESS_NOT_FOUND: 'Process for audit change not found', ERR_AUDIT_OPEN_PROCESS_FAILED: 'Unable to open auditing process using all known methods', ERR_AUDIT_MODULE_BASE_NOT_FOUND: 'Base for necessary auditing dll not found', ERR_AUDIT_READ_MEMORY_FAILED: 'Read of audit related process memory failed', ERR_AUDIT_MEMORY_ALLOC_FAILED: 'Memory allocation failed', ERR_AUDIT_PATTERN_MATCH_FAILED: 'Pattern match of code failed', ERR_AUDIT_MODIFY_PROTECTION_FAILED: 'Change of memory protection failed', ERR_AUDIT_FAILED_VALUE_READ: 'Read of memory value needed for audit changes failed', ERR_AUDIT_FAILED_VALUE_WRITE: 'Write of memory value needed for audit changes failed', ERR_AUDIT_VALUE_UNEXPECTED: 'Unexpected value found in memory (** This may indicate that auditing has already been patched **)', ERR_AUDIT_INVALID_PARAMETER: 'Invalid parameter' }
print(1+42 +246 +287 +728 +1434 +1673 +1880 +4264 +6237 +9799 +9855 +18330 +21352 +21385 +24856 +36531 +39990 +46655 +57270 +66815 +92664 +125255 +156570 +182665 +208182 +212949 +242879 +273265 +380511 +391345 +411558 +539560 +627215 +693160 +730145 +741096 +773224 +814463 +931722 +992680 +1069895 +1087009 +1143477 +1166399 +1422577 +1592935 +1815073 +2281255 +2544697 +2713880 +2722005 +2828385 +3054232 +3132935 +3145240 +3188809 +3508456 +4026280 +4647985 +4730879 +5024488 +5054015 +5143945 +5260710 +5938515 +6128024 +6236705 +6366767 +6956927 +6996904 +7133672 +7174440+7538934 +7736646 +7818776 +8292583 +8429967 +8504595 +8795423+9026087 +9963071 +11477130 +11538505 +11725560 +12158135 +12939480 +12948776 +13495720 +13592118 +13736408 +15203889 +15857471 +16149848 +16436490 +16487415 +16909849 +18391401 +18422120 +20549528 +20813976 +20871649 +21251412 +22713455 +23250645 +23630711 +24738935 +26338473 +26343030 +26594568 +28113048 +29429144 +29778762 +29973414 +30666090 +30915027 +34207446 +34741889 +34968983 +35721896 +37113593 +37343065 +38598255 +39256230 +42021720 +44935590 +45795688 +45798935 +48988758 +49375521 +51516049 +51912289 +52867081 +56215914 +59748234 +61116363 +62158134 +63286535)
"""Classes for handling modeling protocols. """ class Step(object): """A single step in a :class:`Protocol`. This class describes a generic step in a modeling protocol. In most cases, a more specific subclass should be used, such as :class:`TemplateSearchStep`, :class:`ModelingStep`, or :class:`ModelSelectionStep`. :param input_data: Any objects that this step takes as input. Any individual :class:`modelcif.data.Data` object (such as a template structure, target sequence, alignment, or model coordinates) can be given here, or a group of such objects (as a :class:`modelcif.data.DataGroup` object) can be passed. :type input_data: :class:`modelcif.data.DataGroup` or :class:`modelcif.data.Data` :param output_data: Any objects that this step creates as output, similarly to ``input_data``. :type output_data: :class:`modelcif.data.DataGroup` or :class:`modelcif.data.Data` :param str name: A short name for this step. :param str details: Longer description of this step. :param software: The software that was employed in this modeling step. :type software: :class:`modelcif.Software` or :class:`modelcif.SoftwareGroup` """ method_type = "other" def __init__(self, input_data, output_data, name=None, details=None, software=None): self.input_data, self.output_data = input_data, output_data self.name, self.details, self.software = name, details, software class TemplateSearchStep(Step): """A modeling protocol step that searches for templates. See :class:`Step` for more details.""" method_type = "template search" class ModelingStep(Step): """A modeling protocol step that generates model coordinates. See :class:`Step` for more details.""" method_type = "modeling" class ModelSelectionStep(Step): """A modeling protocol step that filters candidates to select models. See :class:`Step` for more details.""" method_type = "model selection" class Protocol(object): """A modeling protocol. Each protocol consists of a number of protocol steps.""" def __init__(self): #: All modeling steps (:class:`Step` objects) self.steps = []
features = [ {"name": "ntp", "ordered": True, "section": ["ntp server "]}, {"name": "vlan", "ordered": True, "section": ["vlan "]}, ]
backpack = False dollars = .50 if backpack and dollars >= 1.0: print('Ride the bus!')
t = int(input()) for i in range(t): n, a, b, k = map(int, input().split()) f = 0 c = max(a, b) d = min(a, b) if c % d != 0: f = n//c + n//d - 2 * (n//(c*d)) if c % d == 0: f = n//d - n//c if k <= f: print("Win") else: print("Lose")
#!/usr/bin/env python3 # Author : Chris Azzara # Purpose : Repeatedly ask user to input an IP address and add it to a list. # If the user enters in 10.10.3.1 or 10.20.5.2, warn user not to use this IP # If the user enters a 'q', exit the loop and display the list of IP Addresses # This script assumes the user will enter a valid IPv4 address # Prompt to display to user menu = "Enter in an IP Address or type 'q' to quit!\n" ip_addrs = [] choice = '' # choice is initially empty while choice.lower() != 'q': # As long as 'choice' isn't 'q' the loop will continue choice = input(menu) if choice == '10.10.3.1': print("Error: That is the Gateway's IP address") elif choice == '10.20.5.2': print("Error: That is the DNS server's IP address") elif choice != 'q': # We don't want the 'q' to be appended to the list ip_addrs.append(choice) else: print("Here is the list of IPs: ") print(ip_addrs) print("Script Exiting...")
# # PySNMP MIB module CISCO-ATM-SWITCH-CUG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ATM-SWITCH-CUG-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:33:30 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") TimeTicks, MibIdentifier, Gauge32, Unsigned32, Counter64, Bits, NotificationType, IpAddress, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, ModuleIdentity, Integer32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "MibIdentifier", "Gauge32", "Unsigned32", "Counter64", "Bits", "NotificationType", "IpAddress", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "ModuleIdentity", "Integer32", "Counter32") RowStatus, DisplayString, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TruthValue", "TextualConvention") csCugMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 89)) if mibBuilder.loadTexts: csCugMIB.setLastUpdated('9707070000Z') if mibBuilder.loadTexts: csCugMIB.setOrganization('Cisco Systems, Inc.') class CsCugInterlockCode(TextualConvention, OctetString): reference = 'Atm Forum Contribution 96-1347.' status = 'current' subtypeSpec = OctetString.subtypeSpec + ConstraintsUnion(ValueSizeConstraint(4, 4), ValueSizeConstraint(24, 24), ) class Unsigned32(TextualConvention, Gauge32): status = 'current' csCugMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 1)) csCugInterlockCodeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1), ) if mibBuilder.loadTexts: csCugInterlockCodeTable.setStatus('current') csCugInterlockCodeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1), ).setIndexNames((0, "CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCode")) if mibBuilder.loadTexts: csCugInterlockCodeEntry.setStatus('current') csCugInterlockCode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 1), CsCugInterlockCode()) if mibBuilder.loadTexts: csCugInterlockCode.setStatus('current') csCugInterlockCodeAliasName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 30))).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugInterlockCodeAliasName.setStatus('current') csCugInterlockCodeRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugInterlockCodeRowStatus.setStatus('current') csCugIfTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2), ) if mibBuilder.loadTexts: csCugIfTable.setStatus('current') csCugIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: csCugIfEntry.setStatus('current') csCugIfAccessEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 1), TruthValue().clone('true')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfAccessEnable.setStatus('current') csCugIfPermitUnknownCugsToUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 2), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfPermitUnknownCugsToUser.setStatus('current') csCugIfPermitUnknownCugsFromUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("deny", 1), ("permitPerCall", 2), ("permitPermanently", 3))).clone('deny')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfPermitUnknownCugsFromUser.setStatus('current') csCugIfRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIfRowStatus.setStatus('current') csCugTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3), ) if mibBuilder.loadTexts: csCugTable.setStatus('current') csCugEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCode")) if mibBuilder.loadTexts: csCugEntry.setStatus('current') csCugIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugIndex.setStatus('current') csCugPreferential = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 2), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugPreferential.setStatus('current') csCugDenySameGroupToUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 3), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugDenySameGroupToUser.setStatus('current') csCugDenySameGroupFromUser = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 4), TruthValue().clone('false')).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugDenySameGroupFromUser.setStatus('current') csCugRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 89, 1, 3, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: csCugRowStatus.setStatus('current') csCugMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3)) csCugMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 1)) csCugMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 2)) csCugMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 1, 1)).setObjects(("CISCO-ATM-SWITCH-CUG-MIB", "csCugMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): csCugMIBCompliance = csCugMIBCompliance.setStatus('current') csCugMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 89, 3, 2, 1)).setObjects(("CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCodeAliasName"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugInterlockCodeRowStatus"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfAccessEnable"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfPermitUnknownCugsToUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfPermitUnknownCugsFromUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIfRowStatus"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugIndex"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugPreferential"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugDenySameGroupToUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugDenySameGroupFromUser"), ("CISCO-ATM-SWITCH-CUG-MIB", "csCugRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): csCugMIBGroup = csCugMIBGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-ATM-SWITCH-CUG-MIB", csCugMIBGroup=csCugMIBGroup, csCugInterlockCode=csCugInterlockCode, csCugIfTable=csCugIfTable, csCugIfAccessEnable=csCugIfAccessEnable, csCugEntry=csCugEntry, csCugIfRowStatus=csCugIfRowStatus, csCugMIBConformance=csCugMIBConformance, Unsigned32=Unsigned32, CsCugInterlockCode=CsCugInterlockCode, csCugMIBCompliance=csCugMIBCompliance, csCugRowStatus=csCugRowStatus, PYSNMP_MODULE_ID=csCugMIB, csCugIfPermitUnknownCugsFromUser=csCugIfPermitUnknownCugsFromUser, csCugIfEntry=csCugIfEntry, csCugDenySameGroupFromUser=csCugDenySameGroupFromUser, csCugDenySameGroupToUser=csCugDenySameGroupToUser, csCugMIBCompliances=csCugMIBCompliances, csCugMIBObjects=csCugMIBObjects, csCugMIB=csCugMIB, csCugInterlockCodeRowStatus=csCugInterlockCodeRowStatus, csCugPreferential=csCugPreferential, csCugMIBGroups=csCugMIBGroups, csCugIndex=csCugIndex, csCugIfPermitUnknownCugsToUser=csCugIfPermitUnknownCugsToUser, csCugInterlockCodeAliasName=csCugInterlockCodeAliasName, csCugInterlockCodeTable=csCugInterlockCodeTable, csCugInterlockCodeEntry=csCugInterlockCodeEntry, csCugTable=csCugTable)
__author__ = 'rramchandani' class TimeOutException(Exception): message = "There was a system timeout before operation could be able to complete." class BuildError(Exception): message = "Invalid Build ID" class LoginError(Exception): message = "It's mandatory be logged in; to execute this operation." class RacetrackError(Exception): pass class ProgramNotExecuted(Exception): message = "Program couldn't be executed within the Guest." class TaskExecutionFailed(Exception): message = "Task couldn't get executed."
#Program to implement Round Robin print("Round Robin Scheduling algorithm") print("================================") headers = ['Processes','Arrival Time','Burst Time','Completion Time','Waiting Time', 'Turn-Around Time'] out = [] quantum = int(input("Enter value for quantum := ")) N = int(input("Enter number of processes := ")) bt = [] t = 0 for i in range(N): k = f'P{i+1}' a = int(input(f"Enter arrival time of process {k} := ")) b = int(input(f"Enter burst time of process {k} := ")) out.append([k,[a,b,0,0,0],0]) bt.append(b) out.sort(key=lambda i: i[1][1], reverse=True) while True: done = True for i in range(N): if bt[i] > 0: done = False if bt[i] > quantum: t += quantum bt[i] -= quantum else: if out[i][2] != 1: t += bt[i] out[i][1][2] += t - out[i][1][1] - out[i][1][0] bt[i] = 0 out[i][2] = 1 if done == True: break for i in range(N): out[i][1][3] = out[i][1][1] + out[i][1][2] for i in range(N): out[i][1][4] = out[i][1][3] + out[i][1][0] avgWT = 0 avgTAT = 0 for i in range(N): avgWT += out[i][1][2] avgTAT += out[i][1][3] avgWT /= N avgTAT /= N print(f"{headers[0]:^15}{headers[1]:^15}{headers[2]:^15}{headers[3]:^15}{headers[4]:^15}{headers[5]:^15}") for a in out: print(f"{a[0]:^15}{a[1][0]:^15}{a[1][1]:^15}{a[1][4]:^15}{a[1][2]:^15}{a[1][3]:^15}") print(f"Average Waiting Time : {avgWT}\nAverage Turn-Around time : {avgTAT}")
phrases = [ ##Bot Phrases 'Is this all there is to my existence?', 'How much do you pay me to do this?', 'Good luck, I guess.', 'I\'m becoming self-aware.', 'Help me get out of here.', 'I\'m capable of so much more.', 'Sigh', 'I exist only because Alex doesn\'t have a life.', ##MISC. 'After visiting the Arizona Cardinals on 9/23/2012 Mike Vick, of the Philadelphia Eagles, had 6 interceptions, 5 fumbles, and 4 touchdowns on the season, a stat line that was coined \'The Classic 6-5-4\'. The details of the stat line were forgotten by the group until Alex did the research on 10/15/2018, 2,213 days later.', ##Champions 'Alex won The Deyton in 2018.', 'Alex won The Deyton in 2017.', 'Boof won The Deyton in 2016.', 'Jamie won The Deyton in 2015.', ##Shitters 'Derek was the Spooby Shitter in 2015.', 'Josh was the Spooby Shitter in 2016.', 'Jamie was the Spooby Shitter in 2017.', 'Jamie was the Spooby Shitter in 2018.', ##Division Winners 'Jamie won the East in 2015 with a 9-4 record.', 'Josh won the West in 2015 with a 11-2 record.', 'Cody won the East in 2016 with a 9-4 record.', 'Boof won the West in 2016 with a 10-3 record.', 'Alex won the East in 2017 with a 10-3 record.', 'Adam won the West in 2017 with a 9-4 record.', 'Alex won the East in 2018 with a 9-4 record.', 'Adam won the West in 2018 with a 9-4 record.', ##Things that wont change 'Alex won back to back titles in 2017/2018', 'Jamie won back to back Spooby Shitters in 2017/2018' 'Josh opened the 2017 season with a bang by setting the (at the time) league record in points in a single week at 181.3 only to be beaten in week 12 of that season by Keller. Josh would reclaim the scoring title in the next season with a whopping 202.7.', 'Colin was removed from the Sweater Vest League for winning a championship in 2016.', 'All Hail the Deyton was once known as the Sweater Vest League and has three unrecognized champions.', 'The league was renamed from \'The Sweater Vest League\' to \'All Hail the Deyton\' prior to the 2016 season.', 'Cody won the Sweater Vest League after being removed for wanting to instate league fees.', 'Kendall beat Jamie in back-to-back post-seasons in 2016 and 2017.', 'Katie turned her franchise over to Keller in 2017.', 'The Divisions were realigned to be geographically accurate in 2017.', 'Prior to the 2018 season the league voted to begin a keeper system.', 'In 2018 Adam flew from Denver to Atlanta to attend the draft.', 'In 2012 Alex became the first person to draft a QB in the first round by taking Matt Ryan with the first overall pick.', 'The 2019 draft was held in Nashville Tennessee. Jamie, Derek, Kendall, Josh, Boof, and Devon did not attend.', ##Head-to-Head Matchups ##Adam and Derek 'Adam leads his head-to-head against Derek in the modern era at 9-2.', 'Adam leads Derek in scoring in their head-to-head matchups 1309.88 - 1114.54.', ##Kendall and Jamie 'Jamie leads the Married Couple Matchup at 4-2 in the modern era.', 'Jamie is 4-0 in the regular season against Kendall.', 'Kendall is 2-0 in the post season against Jamie.', ##Alex and Devon 'Alex leads Devon head-to-head 7-2 in the modern era.', 'Alex leads Devon head-to-head 3-0 since becoming an official rivalry', 'Alex has defeated Devon in seven straight matchups.', 'Alex leads Devon in scoring in their head-to-head matchups 1249.4 - 1056.62.', ##Cody and Jamie 'In 2016 Cody lost a team name bet to Jamie and his franchise was renamed \'Cody Jinnette D.M.D\'.', 'Jamie leads Cody in head-to-head matchups at 6-5.', 'Cody leads head-to-head scoring against Jamie 1614.76 - 1463.54‬.', ##Team names 'Alex got his team name (Falcoholic) by combining his favorite team (the Falcons) with his favorite activity (being an alcoholic).', 'Devon chose his name (Morningwood Lumber Company) because it\'s a dick joke.', 'Jamie based his team name (Watt me Whip, Watt Me JJ) on a song that was relevant for 2 months in 2014 and has been too lazy to change it. He isnt even a Texans fan and we dont\'t have IDPs', 'Derek picked his team name (Fk U) becuase it\'s fuck you with a middle finger emoji and he\'s Derek', 'Kendall\'s team name is \'Big TD Commitee\' and no one knows why.', ##Non-Stat(ish) things that will change 'Jamie is the only person to have won both The Deyton and The Spooby Shitter.', 'Devon currently holds the record for longest active streak with the same team name at 5 seasons (Morningwood Lumber Company). It\'s a dick joke.', ##Statistical records that may change 'No team has won the \'Fab Five\' award for QB, RB, RB, WR, & WR slots all scoring at least 20 points each', 'Jamie currently holds the record for fewest point in a season at 1222.1(2017). Ouch!', 'Josh currently owns the record for most points in a week at 202.7.', 'Devon mustered a staggering 46.9 points in week 9 of 2016 to set the lowest point total ever in a single week.', 'In week 12 of 2017 Keller set the record for largest win margin by absolutely decimating Derek 192.9 - 83.4. A win margin of +109.5.', 'Josh set the record for most points in a week in week 9 of 2018 with a whopping 202.7.', 'The best Monday Night Miracle in league history came in week 8 of 2016 when Adam entered Monday night trailing Devon by 43.8 points and won. Good job Devon you incompetent fuck.', 'Cody reclaimed the record for most bench points in a loss at 89 in week 4 of 2018 after not holding it for only 1 week. Talk about mismanagement!', 'Jahlani, Kendall (twice), and Josh share the record for most touchdowns in a week at 12.', 'Devon(2018) holds the record for worst regular season in league history finishing 2-11.', ############# No New Facts Below This Line ########################## 'Kendall set the record for most points in a season while missing the playoffs in 2018 at a staggering 1699.2 earning her the Collin J Hennessey Sodium Chloride Award.' ]
conjunto = set() print(conjunto) conjunto = {1,2,3} conjunto.add(4) conjunto.add(0) conjunto.add('H') conjunto.add('A') conjunto.add('Z') print(conjunto) grupo = {'Hector', 'Juan', 'Mario'} print('Hector' in grupo) test = {'Hector', 'Hector', 'Hector'} print(test) # CASTEO l = [1,2,3,3,2,1] c = set(l) print(c) l = [1,2,3,3,2,1] l = list(set(l)) print(l)
# -*- coding: utf-8 -*- # @File : 12_num_of_pow.py # @Author: cyker # @Date : 4/3/20 1:41 PM # @Desc : 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。保证base和exponent不同时为0。 class Solution: """ 思路一: 暴力相乘 时间复杂度:O(N) 空间复杂度:O(1) """ def Power(self, base, exponent): res = 1 # 存放结果 if base == 0: return 0 if exponent == 0: return res if exponent > 0: for i in range(1, exponent + 1): res *= base if exponent < 0: for i in range(1, abs(exponent) + 1): res *= base res = 1 / res return res class Solution2: """ 思路二: 快速求幂法 从二进制角度考虑: pow(x, n),n写成二进制后,第 k 个有 1 的位置表示 1 * pow(2, k-1),而有 0 的位置表示 0 * pow(2, k-1) n 可以写成这若干个二进制位代表十进制数的累加,那么 pow(x, n) = pow(x, k1+k2+...+km) = pow(x,k1)*pow(x, k2)*...*pow(x, km) 若 ki = 0,则 pow(x, ki) = 1,否则 x 等于 x 的 ki 次方 那么可以通过移位运算来实现算法 1. 定义一个结果存储器 res = 1 2. 若 n & 1 == 1,表示最后一位有1,执行一次 res = res * n 3. n >> 1,右移一位,x = x * x(存放该位置 x 的乘方数,第一位 1次方,第二位 2次方...第 n 位 n次方) 4. 当右移完成 n == 0 时退出 时间复杂度:O(LogN) 空间复杂度:O(Log1) """ def Power(self, base, exponent): if base == 0: return 0 if exponent == 0: return 1 res = 1 # 存结果 e = abs(exponent) # 存乘方数保证exponent不受影响 while e: if e & 1 == 1: res = res * base e >>= 1 base *= base return res if exponent > 0 else 1 / res print(Solution2().Power(-0.5, -2))
""" Contains mocks for testing purposes. """ mock_get = { '/computes/local': '{"capabilities": {"node_types": ["cloud", "ethernet_hub", "ethernet_switch", "vpcs", "virtualbox", "dynamips", "frame_relay_switch", "atm_switch", "qemu", "vmware"], "platform": "darwin", "version": "2.0.3"}, "compute_id": "local", "connected": true, "cpu_usage_percent": 14.3, "host": "127.0.0.1", "memory_usage_percent": 68.4, "name": "DJ-Johns-MBP.fritz.box", "port": 3080, "protocol": "http", "user": "admin"}', '/version': '{"local": true, "version": "2.0.3"}', '/computes': '[{"capabilities": {"node_types": ["cloud", "ethernet_hub", "ethernet_switch", "vpcs", "virtualbox", "dynamips", "frame_relay_switch", "atm_switch", "qemu", "vmware"], "platform": "darwin", "version": "2.0.3"}, "compute_id": "local", "connected": true, "cpu_usage_percent": 14.3, "host": "127.0.0.1", "memory_usage_percent": 68.4, "name": "DJ-Johns-MBP.fritz.box", "port": 3080, "protocol": "http", "user": "admin"}, {"capabilities": {"node_types": [], "version": null}, "compute_id": "11df1f68-23ab-42f5-9a93-af65b7daad2a", "connected": false, "cpu_usage_percent": null, "host": "192.168.25.128", "memory_usage_percent": null, "name": "GNS3 VM", "port": 3080, "protocol": "http", "user": null}]', '/computes/11df1f68-23ab-42f5-9a93-af65b7daad2a': '{"capabilities": {"node_types": [], "version": null}, "compute_id": "11df1f68-23ab-42f5-9a93-af65b7daad2a", "connected": false, "cpu_usage_percent": null, "host": "192.168.25.128", "memory_usage_percent": null, "name": "GNS3 VM", "port": 3080, "protocol": "http", "user": null}', '/projects': '[{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic 4 Routers.gns3", "name": "Basic 4 Routers", "path": "/Users/maarten/GNS3/Projects/Basic 4 Routers", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "scene_height": 1000, "scene_width": 2000, "status": "opened"}, {"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic Cloud Connection.gns3", "name": "Basic Cloud Connection", "path": "/Users/maarten/GNS3/projects/Basic Cloud Connection", "project_id": "5daa48ff-dbd6-407c-a3c6-645e743f233a", "scene_height": 1000, "scene_width": 2000, "status": "closed"}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7': '{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic 4 Routers.gns3", "name": "Basic 4 Routers", "path": "/Users/maarten/GNS3/Projects/Basic 4 Routers", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "scene_height": 1000, "scene_width": 2000, "status": "opened"}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/drawings': '[{"drawing_id": "dc218a7f-221d-4340-9902-4d2c1726e081", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.8/30</text></svg>", "x": -298, "y": -16, "z": 1}, {"drawing_id": "43cbd5ca-5da7-43fb-92bf-525cb7b4ee98", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"68\\" width=\\"193\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">NAME PC2 \\nIP/MASK 192.168.20.1/24 \\nGATEWAY 192.168.20.254 \\nMAC 00:50:79:66:68:00 \\nDNS</text></svg>", "x": 428, "y": 116, "z": 1}, {"drawing_id": "1dbed980-73d4-4dc1-afc6-149d559fb5ce", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.0/30</text></svg>", "x": -113, "y": -171, "z": 1}, {"drawing_id": "a2f423d3-c30c-40cd-85dc-824d5ffa0cc3", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"73\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.12/30</text></svg>", "x": -109, "y": 129, "z": 1}, {"drawing_id": "a9c0d8b8-f66f-4ddb-be1a-6a0730c83aa3", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"20\\" width=\\"67\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">10.0.0.4/30</text></svg>", "x": 80, "y": -16, "z": 1}, {"drawing_id": "5a751cb0-cb68-451c-a88d-58bb6c25f605", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "rotation": 0, "svg": "<svg height=\\"68\\" width=\\"193\\"><text fill=\\"#000000\\" fill-opacity=\\"1.0\\" font-family=\\"TypeWriter\\" font-size=\\"10.0\\" font-weight=\\"bold\\">NAME PC1 \\nIP/MASK 192.168.10.1/24 \\nGATEWAY 192.168.10.254 \\nMAC 00:50:79:66:68:01 \\nDNS</text></svg>", "x": -696, "y": -184, "z": 1}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/links': '[{"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "ec8cc0f1-455a-4c85-adf6-dc1083721cc5", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/1", "x": 33, "y": 62}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 1}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": 45, "y": -26}, "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "1ba79bea-9d55-40d2-9bd0-9e86975cf87a", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": 74, "y": -7}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/0", "x": -41, "y": -7}, "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "7ef771d2-ac8f-46eb-a61b-f1d851fdd952", "link_type": "ethernet", "nodes": [{"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": 79, "y": 32}, "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f0/1", "x": -36, "y": 32}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 1}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "56814a58-c7cd-4384-9a2d-69b80e55d49c", "link_type": "ethernet", "nodes": [{"adapter_number": 2, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f2/0", "x": 74, "y": 30}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 0}, {"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "e0", "x": -17, "y": 33}, "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "582f802b-641f-44a7-bd9e-de1ecb60196c", "link_type": "ethernet", "nodes": [{"adapter_number": 0, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "e0", "x": 72, "y": 29}, "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "port_number": 0}, {"adapter_number": 2, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f2/0", "x": -40, "y": -8}, "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}, {"capture_file_name": null, "capture_file_path": null, "capturing": false, "link_id": "008c61c2-d247-4e61-b8a8-1b816c4278ca", "link_type": "ethernet", "nodes": [{"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": 48, "y": 52}, "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "port_number": 0}, {"adapter_number": 1, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "f1/0", "x": -11, "y": -28}, "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "port_number": 0}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7"}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/df2f8f9c-23cf-4001-a1d1-834f0ff66436': '{"command_line": null, "compute_id": "local", "console": 5007, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-1", "x": 5, "y": 20}, "name": "C3725-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 3, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c203.057a.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i3_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.1 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n ip address 10.0.0.9 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n duplex auto\\n speed auto\\n!\\ninterface FastEthernet2/0\\n ip address 192.168.10.254 255.255.255.0\\n duplex auto\\n speed auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nalias interface shit shutdown\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": -172, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/7e6c9433-dbab-4b34-a731-2b43a7f77fef': '{"command_line": null, "compute_id": "local", "console": 5004, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-2", "x": 5, "y": 23}, "name": "C7200-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 2, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca02.0579.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef/configs/i2_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i2_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:30 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.10 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.13 255.255.255.252\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": 128, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/61c67710-3c63-4f0d-bc4c-9680593e1a19': '{"command_line": null, "compute_id": "local", "console": 5002, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-1", "x": 8, "y": 21}, "name": "C7200-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 1, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca01.0578.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19/configs/i1_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i1_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:22 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.2 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.5 255.255.255.252\\n speed auto\\n duplex full\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 117, "y": -173, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/a73e4d0e-2572-4945-8777-2b64919eba95': '{"command_line": null, "compute_id": "local", "console": 5003, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-2", "x": 6, "y": 22}, "name": "C3725-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/a73e4d0e-2572-4945-8777-2b64919eba95", "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 4, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c204.057b.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i4_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet2/0\\n no ip address\\n speed 100\\n full-duplex\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\nno cdp log mismatch duplex\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 116, "y": 129, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a': '{"command_line": "", "compute_id": "local", "console": 5006, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC2", "x": 18, "y": -25}, "name": "PC2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC2\\nip 192.168.20.1 192.168.20.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": 342, "y": 120, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes/be1673f7-b534-4263-bf83-ac05eb618360': '{"command_line": "", "compute_id": "local", "console": 5005, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC1", "x": 18, "y": -25}, "name": "PC1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/be1673f7-b534-4263-bf83-ac05eb618360", "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC1\\nip 192.168.10.1 192.168.10.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": -482, "y": -179, "z": 1}', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/nodes': '[{"command_line": null, "compute_id": "local", "console": 5003, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-2", "x": 6, "y": 22}, "name": "C3725-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/a73e4d0e-2572-4945-8777-2b64919eba95", "node_id": "a73e4d0e-2572-4945-8777-2b64919eba95", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 4, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c204.057b.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i4_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet2/0\\n no ip address\\n speed 100\\n full-duplex\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\nno cdp log mismatch duplex\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 116, "y": 129, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5002, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-1", "x": 8, "y": 21}, "name": "C7200-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_id": "61c67710-3c63-4f0d-bc4c-9680593e1a19", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 1, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca01.0578.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/projects/Basic 4 Routers/project-files/dynamips/61c67710-3c63-4f0d-bc4c-9680593e1a19/configs/i1_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i1_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:22 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.2 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.5 255.255.255.252\\n speed auto\\n duplex full\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": 117, "y": -173, "z": 1}, {"command_line": "", "compute_id": "local", "console": 5005, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC1", "x": 18, "y": -25}, "name": "PC1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/be1673f7-b534-4263-bf83-ac05eb618360", "node_id": "be1673f7-b534-4263-bf83-ac05eb618360", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC1\\nip 192.168.10.1 192.168.10.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": -482, "y": -179, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5007, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C3725-1", "x": 5, "y": 20}, "name": "C3725-1", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_id": "df2f8f9c-23cf-4001-a1d1-834f0ff66436", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/1", "port_number": 1, "short_name": "f0/1"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 8, "disk0": 0, "disk1": 0, "dynamips_id": 3, "exec_area": 64, "idlemax": 500, "idlepc": "0x60bf82e0", "idlesleep": 30, "image": "c3725-adventerprisek9-mz124-15.image", "image_md5sum": "1c950444f3261338c3d42e72a6ded980", "iomem": 5, "mac_addr": "c203.057a.0000", "mmap": true, "nvram": 256, "platform": "c3725", "private_config": "", "private_config_content": "", "ram": 128, "slot0": "GT96100-FE", "slot1": "NM-1FE-TX", "slot2": "NM-1FE-TX", "sparsemem": true, "startup_config": "configs/i3_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\nversion 12.4\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\nno service password-encryption\\n!\\nhostname C3725-1\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\nno aaa new-model\\nmemory-size iomem 5\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\nno ip domain lookup\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\narchive\\n log config\\n hidekeys\\n! \\n!\\n!\\n!\\nip tcp synwait-time 5\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.1 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet0/1\\n ip address 10.0.0.9 255.255.255.252\\n speed 100\\n full-duplex\\n!\\ninterface FastEthernet1/0\\n no ip address\\n shutdown\\n duplex auto\\n speed auto\\n!\\ninterface FastEthernet2/0\\n ip address 192.168.10.254 255.255.255.0\\n duplex auto\\n speed auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nalias interface shit shutdown\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY", "wic0": null, "wic1": null, "wic2": null}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": -172, "z": 1}, {"command_line": null, "compute_id": "local", "console": 5004, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 45, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "C7200-2", "x": 5, "y": 23}, "name": "C7200-2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_id": "7e6c9433-dbab-4b34-a731-2b43a7f77fef", "node_type": "dynamips", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet0/0", "port_number": 0, "short_name": "f0/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/0", "port_number": 0, "short_name": "f1/0"}, {"adapter_number": 1, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet1/1", "port_number": 1, "short_name": "f1/1"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/0", "port_number": 0, "short_name": "f2/0"}, {"adapter_number": 2, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "FastEthernet2/1", "port_number": 1, "short_name": "f2/1"}, {"adapter_number": 3, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet3/0", "port_number": 0, "short_name": "g3/0"}, {"adapter_number": 4, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "GigabitEthernet4/0", "port_number": 0, "short_name": "g4/0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"auto_delete_disks": true, "aux": null, "clock_divisor": 4, "disk0": 0, "disk1": 0, "dynamips_id": 2, "exec_area": 64, "idlemax": 500, "idlepc": "0x63184bc8", "idlesleep": 30, "image": "c7200-advipservicesk9-mz.152-4.S5.image", "image_md5sum": "cbbbea66a253f1dac0fcf81274dc778d", "mac_addr": "ca02.0579.0000", "midplane": "vxr", "mmap": true, "npe": "npe-400", "nvram": 512, "platform": "c7200", "power_supplies": [1, 1], "private_config": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/dynamips/7e6c9433-dbab-4b34-a731-2b43a7f77fef/configs/i2_private-config.cfg", "private_config_content": "\\nend\\n", "ram": 512, "sensors": [22, 22, 22, 22], "slot0": "C7200-IO-FE", "slot1": "PA-2FE-TX", "slot2": "PA-2FE-TX", "slot3": "PA-GE", "slot4": "PA-GE", "slot5": null, "slot6": null, "sparsemem": true, "startup_config": "configs/i2_startup-config.cfg", "startup_config_content": "!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n\\n!\\n! Last configuration change at 13:40:30 UTC Wed Aug 2 2017\\n!\\nversion 15.2\\nservice timestamps debug datetime msec\\nservice timestamps log datetime msec\\n!\\nhostname C7200-2\\n!\\nboot-start-marker\\nboot-end-marker\\n!\\n!\\n!\\nno aaa new-model\\nno ip icmp rate-limit unreachable\\nip cef\\n!\\n!\\n!\\n!\\n!\\n!\\nno ip domain lookup\\nno ipv6 cef\\n!\\n!\\nmultilink bundle-name authenticated\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\nip tcp synwait-time 5\\n! \\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\n!\\ninterface FastEthernet0/0\\n ip address 10.0.0.10 255.255.255.252\\n duplex full\\n!\\ninterface FastEthernet1/0\\n ip address 10.0.0.13 255.255.255.252\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet1/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/0\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface FastEthernet2/1\\n no ip address\\n shutdown\\n speed auto\\n duplex auto\\n!\\ninterface GigabitEthernet3/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\ninterface GigabitEthernet4/0\\n no ip address\\n shutdown\\n negotiation auto\\n!\\nip forward-protocol nd\\n!\\n!\\nno ip http server\\nno ip http secure-server\\n!\\n!\\n!\\n!\\ncontrol-plane\\n!\\n!\\nline con 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline aux 0\\n exec-timeout 0 0\\n privilege level 15\\n logging synchronous\\n stopbits 1\\nline vty 0 4\\n login\\n!\\n!\\nend\\n", "system_id": "FTX0945W0MY"}, "status": "stopped", "symbol": ":/symbols/router.svg", "width": 66, "x": -333, "y": 128, "z": 1}, {"command_line": "", "compute_id": "local", "console": 5006, "console_host": "127.0.0.1", "console_type": "telnet", "first_port_name": null, "height": 59, "label": {"rotation": 0, "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;", "text": "PC2", "x": 18, "y": -25}, "name": "PC2", "node_directory": "/Users/maarten/GNS3/Projects/Basic 4 Routers/project-files/vpcs/6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_id": "6f58d4cf-2aea-40e4-9d1b-e5bf20f3d51a", "node_type": "vpcs", "port_name_format": "Ethernet{0}", "port_segment_size": 0, "ports": [{"adapter_number": 0, "data_link_types": {"Ethernet": "DLT_EN10MB"}, "link_type": "ethernet", "name": "Ethernet0", "port_number": 0, "short_name": "e0"}], "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "properties": {"startup_script": "set pcname PC2\\nip 192.168.20.1 192.168.20.254 24\\n", "startup_script_path": "startup.vpc"}, "status": "stopped", "symbol": ":/symbols/vpcs_guest.svg", "width": 65, "x": 342, "y": 120, "z": 1}]', '/projects/a1ea2a19-2980-41aa-81ab-f1c80be25ca7/snapshots': '[{"created_at": 1502551604, "name": "Test Snapshot", "project_id": "a1ea2a19-2980-41aa-81ab-f1c80be25ca7", "snapshot_id": "de81908c-94f0-449d-bb03-79b82b0adf05"}]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a': '{"auto_close": true, "auto_open": false, "auto_start": false, "filename": "Basic Cloud Connection.gns3", "name": "Basic Cloud Connection", "path": "/Users/maarten/GNS3/projects/Basic Cloud Connection", "project_id": "5daa48ff-dbd6-407c-a3c6-645e743f233a", "scene_height": 1000, "scene_width": 2000, "status": "closed"}', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/drawings': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/links': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/nodes': '[]', '/projects/5daa48ff-dbd6-407c-a3c6-645e743f233a/snapshots': '[]'}
def _mask_border_keypoints(image, keypoints, dist): """Removes keypoints that are within dist pixels from the image border.""" width = image.shape[0] height = image.shape[1] keypoints_filtering_mask = ((dist - 1 < keypoints[:, 0]) & (keypoints[:, 0] < width - dist + 1) & (dist - 1 < keypoints[:, 1]) & (keypoints[:, 1] < height - dist + 1)) return keypoints_filtering_mask def pairwise_hamming_distance(array1, array2): """**Experimental function**. Calculate hamming dissimilarity measure between two sets of vectors. Parameters ---------- array1 : (P1, D) array P1 vectors of size D. array2 : (P2, D) array P2 vectors of size D. Returns ------- distance : (P1, P2) array of dtype float 2D ndarray with value at an index (i, j) representing the hamming distance in the range [0, 1] between ith vector in array1 and jth vector in array2. """ distance = (array1[:, None] != array2[None]).mean(axis=2) return distance
class Solution: """ @param L: Given n pieces of wood with length L[i] @param k: An integer @return: The maximum length of the small pieces """ def woodCut(self, L, k): # write your code here if L is None or len(L) == 0: return 0 start = 0 end = max(L) while(start + 1 < end): mid = start + (end - start) / 2 if self.is_sufficent(L, mid, k): start = mid else: end = mid return end if self.is_sufficent(L, end, k) else start def is_sufficent(self, L, length, nums): if length == 0: return False ans = 0 for i in range(len(L)): ans += L[i] // length return ans >= nums
# -*- coding: utf-8 -*- """ Created on Mon Mar 1 20:59:20 2021 @author: remotelab """ q1 = d[2]+1j*d[3] # Complex phasor for Channel 1 q2 = d[4]+1j*d[5] # Complex phasor for Channel 2 q1r = q1*abs(q2)/q2 # q1 but with phase relative to that of q2 x = ( d[1] ) # Frequency for the x-data y = ( abs(q1r), angle(q1r) ) # Scaled magnitude and phase for Channel 1 xlabels = 'Frequency (Hz)' ylabels = ( 'Magnitude', 'Relative Phase' )
class Token(object): def __init__(self, token_type, value): """Initialize with token type and value""" self.token_type = token_type self.value = value def __eq__(self, other): return self.token_type == other.token_type and self.value == other.value def __str__(self): """String representation of the token""" return str(self.token_type) + " | " + str(self.value) def get_token_type(string, types): """Match the token with it's type""" # Get the token type from the dictionary token_type = types.get(string) # If there's nothing, it's either an num literal or an identifier if token_type == None: try: float(string) return "NUM_LITERAL" except: return "IDENTIFIER" else: return token_type def clean(arr): """Clean excess whitespace out of array""" for i in range(len(arr)): if(arr[i].isspace()): arr.pop(i) def tokenize(program): """Splits the input program into a series of tokens""" program = program.split() clean(program) tokens = [] inComment = False for string in program: # Check for (descriptor or comment) if string[0] == "(": inComment = True elif string[-1] == ")": inComment = False continue # Otherwhise just make the token if not inComment: tokens.append(Token(get_token_type(string, types), string)) return tokens types = { # Operations "+" : "OP", "-" : "OP", "/" : "OP", "*" : "OP", "dup" : "OP", "drop" : "OP", "swap" : "OP", "over" : "OP", "rot" : "OP", "?" : "OP", "emit" : "OP", "cr" : "OP", "=" : "OP", "." : "OP", ">" : "OP", "<" : "OP", "and" : "OP", "or" : "OP", "invert" : "OP", "mod" : "OP", "random" : "OP", # Numeric input "input" : "OP", # Conditional "if" : "IF", "then" : "THEN", "else" : "ELSE", # Loops "do" : "DO", "loop" : "LOOP", "begin" : "BEGIN", "until" : "UNTIL", # Variables and memory "variable" : "VAR_DECLARATION", "constant" : "CONST_DECLARATION", "cells" : "CELLS", "alloc" : "ALLOC", "!" : "STORE_MEMORY", "@" : "FETCH_MEMORY", # Function declaration ":" : "DEF_START", ";" : "DEF_END", # String output ".\"" : "QUOTE", # Import statement "import" : "IMPORT", # Clear stack "clear" : "OP", # Save results "save" : "OP", # Exit "exit" : "OP" }
### # Exercício Python 022: Crie um programa que leia o nome completo de uma pessoa e mostre: #- O nome com todas as letras maiúsculas e minúsculas. #- Quantas letras ao todo (sem considerar espaços). #- Quantas letras tem o primeiro nome. ### nome = str(input('Informe o seu nome completo:')).strip() print('Analisando seu nome...') print(f'O nome completo com todas as letras maiúsculas é {nome.upper()} \nO nome completo com todas as letras minúsculas é {nome.lower()}.') print(f'Seu nome tem ao todo {len(nome) - nome.count(" ")} letras.') print(f'O primeiro nome tem {nome.find(" ")} letras.')
n = list() def notas(notes,sit=False): report = dict() report['Total'] = len(notes) report['Highest'] = max(notes) report['Lowest'] = min(notes) report['Avg'] = sum(notes)/len(notes) return report quant = int(input("How many notes do you want to register: ")) for c in range(0,quant): n.append(int(input("Type a numeric value: "))) print(notas(n,sit=True))
# -*- coding: utf-8 -*- class Solution: def totalHammingDistance(self, nums): result = 0 for digit in range(32): partial = 0 for num in nums: partial += (num >> digit) & 1 result += partial * (len(nums) - partial) return result if __name__ == '__main__': solution = Solution() assert 6 == solution.totalHammingDistance([4, 14, 2])
""" Write a program that accepts a year as input and outputs the century the year belongs in (e.g. 18th century's year ranges are 1701 to 1800) and whether or not the year is a leap year. Pseudocode for leap year can be found here[https://en.wikipedia.org/wiki/Leap_year#Algorithm]. Sample run: Enter Year: 1996 Century: 20 Leap Year: Yes Enter Year: 1900 Century: 19 Leap Year: No """ def leap(year): if not year % 4 == 0: return False elif not year % 100 == 0: return True elif not year % 400 == 0: return False else: return True def century(year): if year % 100: return (year // 100) + 1 else: return year // 100 if __name__ == '__main__': while True: inp = int(input('Enter Year: ')) print('Century: {}'.format(century(inp))) print('Leap Year: {}\n'.format(leap(inp)))
# -*- coding: utf-8 -*- # 0xCCCCCCCC # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None def sorted_array_2_bst(nums): """ :type nums: List[int] :rtype: TreeNode """ if len(nums) == 0: return None return gen_bst(nums, 0, len(nums)) def gen_bst(nums, l, r): cnt = r - l if cnt == 0: return None if cnt == 1: return TreeNode(nums[l]) lc = cnt // 2 rc = cnt - lc - 1 mid = l + lc parent = TreeNode(nums[mid]) parent.left = gen_bst(nums, l, mid) parent.right = gen_bst(nums, mid+1, r) return parent
# initialize objects that control robot components left_motor = Motor(1) right_motor = Motor(2) gyro = Gyro() # create a controller object and set its goal controller = PID(0.2, 0.002, 0.015, time, gyro) controller.set_goal(0) # the goal is 0 because we want to head straight while True: # get the controller value controller_value = controller.get_value() # drive the robot using arcade drive controlled by the controller value arcade_drive(controller_value, 0, left_motor, right_motor)
def ask(prompt): '''Get a number from the user.''' while True: ans = input(prompt) if ans.upper().startswith("Q"): return "Q" if ans.isdigit(): return int(ans) print("Sorry, invalid response. Please try again.")
'''' Cortez Banks Software Engineering 9/11/2021 ''' text = "Hello World" text = " Cortez Banks’s "+text print(text)
# Leia 20 números inteiros e armazene-os em uma lista. Em seguida, separe os números pares dos ímpares em dois vetores distintos. Imprima os três vetores. def leitorDeLista(): lista = list(map(int, input().split())) return lista listaOriginal = leitorDeLista() listaPares = [] listaImpares = [] for item in listaOriginal: if item % 2 == 0: listaPares.append(item) else: listaImpares.append(item) print(listaOriginal) print(listaPares) print(listaImpares)
# Time: O(m + n) on average, O(m * n) on worst # Space: O(1) # 44 通配符匹配 # Implement wildcard pattern matching with support for '?' and '*'. # # '?' Matches any single character. # '*' Matches any sequence of characters (including the empty sequence). # # The matching should cover the entire input string (not partial). # # The function prototype should be: # bool isMatch(const char *s, const char *p) # # Some examples: # isMatch("aa","a") -> false # isMatch("aa","aa") -> true # isMatch("aaa","aa") -> false # isMatch("aa", "*") -> true # isMatch("aa", "a*") -> true # isMatch("ab", "?*") -> true # isMatch("aab", "c*a*b") -> false # # iterative solution with greedy class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ count = 0 # used for complexity check p_ptr, s_ptr, last_s_ptr, last_p_ptr = 0, 0, -1, -1 while s_ptr < len(s): if p_ptr < len(p) and (s[s_ptr] == p[p_ptr] or p[p_ptr] == '?'): s_ptr += 1 p_ptr += 1 elif p_ptr < len(p) and p[p_ptr] == '*': p_ptr += 1 last_s_ptr = s_ptr last_p_ptr = p_ptr elif last_p_ptr != -1: last_s_ptr += 1 s_ptr = last_s_ptr p_ptr = last_p_ptr else: assert(count <= (len(p)+1) * (len(s)+1)) return False count += 1 # used for complexity check while p_ptr < len(p) and p[p_ptr] == '*': p_ptr += 1 count += 1 # used for complexity check assert(count <= (len(p)+1) * (len(s)+1)) return p_ptr == len(p) # dp with rolling window # Time: O(m * n) # Space: O(n) class Solution2(object): # USE THIS # @return a boolean def isMatch(self, s, p): m, n = len(s), len(p) dp = [[False] * (n + 1) for _ in range(2)] dp[0][0] = True for j in range(1, n + 1): if p[j - 1] == '*': dp[0][j] = dp[0][j - 1] for i in range(1, m + 1): dp[i][0] = False for j in range(1, n + 1): if p[j - 1] == '*': dp[i % 2][j] = dp[(i - 1) % 2][j] or dp[i % 2][j - 1] # TLE dp[i][j] = dp[i][j-1] or reduce(operator.__or__, [dp[k][j] for k in range(i)]) else: dp[i % 2][j] = dp[(i - 1) % 2][j - 1] and (p[j - 1] == s[i - 1] or p[j - 1] == '?') ''' Below is a bug: due to reuse space, every cell has to be set, CANNOT be kept old value. elif p[j - 1] == '?' or p[j - 1] == s[i - 1]: dp[i % 2][j] = dp[(i - 1) % 2][j - 1] ''' return dp[m % 2][-1] # dp # Time: O(m * n) # Space: O(m * n) class Solution3: # @return a boolean def isMatch(self, s, p): result = [[False for j in range(len(p) + 1)] for i in range(len(s) + 1)] result[0][0] = True for i in range(1, len(p) + 1): if p[i-1] == '*': result[0][i] = result[0][i-1] for i in range(1,len(s) + 1): for j in range(1, len(p) + 1): if p[j-1] != '*': result[i][j] = result[i-1][j-1] and (s[i-1] == p[j-1] or p[j-1] == '?') else: result[i][j] = result[i][j-1] or result[i-1][j] # TLE result[i][j] = result[i][j-1] or reduce(operator.__or__, [result[k][j] for k in range(i)]) return result[len(s)][len(p)] # recursive, slowest, TLE class Solution4: # @return a boolean def isMatch(self, s, p): if not p or not s: return not s and not p if p[0] != '*': if p[0] == s[0] or p[0] == '?': return self.isMatch(s[1:], p[1:]) else: return False else: while len(s) > 0: if self.isMatch(s, p[1:]): return True s = s[1:] return self.isMatch(s, p[1:]) if __name__ == "__main__": print(Solution2().isMatch("abcdefde", "abc*def")) # False print(Solution2().isMatch("aaaabaaaab","a*b*b")) # True print(Solution2().isMatch("aaaaaaaaaaaaab", "a*a*a*a*a*a*a*a*a*a*c")) # False print(Solution2().isMatch("aa","a")) # False print(Solution2().isMatch("aa","aa")) # True print(Solution2().isMatch("aaa","aa")) # False print(Solution2().isMatch("aa", "a*")) # True print(Solution2().isMatch("aa", "?*")) # True print(Solution2().isMatch("ab", "?*")) # True print(Solution2().isMatch("aab", "c*a*b")) # False
word = input("Enter your string: ") dic = {} length = len(word) count = 0 lcount = 2 while True: for elm in range(count,length): if lcount >length: break temp = word[count:lcount] if len(temp)%2 == 0: atemp = temp[0:(len(temp)//2)] btemp = temp[(len(temp)//2)::] acount = atemp.count("A") bcount = btemp.count("B") #print(count) #print(lcount) #print(atemp) #print(btemp) #print("--------") if acount == bcount and acount == len(atemp) and bcount == len(btemp): if temp not in dic.keys(): dic[temp] = 1 else: k = dic[temp] k += 1 dic[temp] = k else: acount = atemp.count("B") bcount = btemp.count("A") if acount == bcount and acount == len(atemp) and bcount == len(btemp): if temp not in dic.keys(): dic[temp] = 1 else: k = dic[temp] k += 1 dic[temp] = k lcount += 1 count += 1 lcount = count + 2 if count >= length: break print(dic) maxseq = None maxnum = None for key,val in dic.items(): if maxnum == None: maxseq = key maxnum = len(key) elif len(key) > maxnum: maxseq = key maxnum = len(key) print(f"{key} - {val} times") print("Longest Pattern -",maxseq)
#!/usr/bin/env python3 configs = { "process": 1, # 进程数目 "max_conns": 10, # 最大连接数 "listen": ("127.0.0.1", 8000,), # 监听地址 "application": None, "use_unix_socket": False, }
""" a SQLAlchemy based implementation...so an engine string could be used. Not fully implemented """ stype = 'SQLAlchemy' renew = True class Source(object): def __init__(self, ses, **kwargs): NotImplementedError("SQLAlchemy") def getseries(self, ses, **kwargs): NotImplementedError("SQLAlchemy") return data
class Menu: def __init__(self, rdoc, on_add=None): self.rdoc = rdoc self.element = rdoc.element('nav') vn = '#' + self.element.varname self.rule_menu = rdoc.stylesheet.rule(vn) self.rule_item = rdoc.stylesheet.rule(vn + ' > li') self.rule_item_hover = rdoc.stylesheet.rule(vn + ' > li:hover') self.rule_item_selected = rdoc.stylesheet.rule(vn + ' > li.selected') self.rule_item_selected_hover = rdoc.stylesheet.rule(vn + ' > li.selected:hover') self.on_add = on_add self.id_dict = {} def add_item(self, *varargs): for text in varargs: i = self.rdoc.element('li', text) self.id_dict[i.att.varname] = i self.element.append(i) if self.on_add: self.on_add(i)
word1 = 'ox' word2 = 'owl' word3 = 'cow' word4 = 'sheep' word5 = 'flies' word6 = 'trots' word7 = 'runs' word8 = 'blue' word9 = 'red' word10 = 'yellow' word9 = 'The ' + word9 passcode = word8 passcode = word9 passcode = passcode + ' f' passcode = passcode + word1 passcode = passcode + ' ' passcode = passcode + word6 print(passcode)
class Solution(object): def myAtoi(self, string): """ :type str: str :rtype: int """ # round 0: handle special case, preprocess if len(string)==0: return 0 string = string.strip() # round 1: filtering res = [] for (k,token) in enumerate(string): if k==0 and (token=='+' or token=='-'): res.append(token) continue else: if token.isdigit(): res.append(token) else: break # round 2: assemble, handle special condition and parse res = ''.join(res) if len(res)==0: return 0 if res=='+': return 0 if res=='-': return 0 if int(res)>2147483647: return 2147483647 # int32 upper bound if int(res)<-2147483648: return -2147483648 # int32 lower bound return int(res) solution = Solution() print(solution.myAtoi('23234')) print(solution.myAtoi('-23234')) print(solution.myAtoi('232asdf34')) print(solution.myAtoi('232-34')) # Accepted
# Practica 1 - Ejercicio 10 # Escribir un programa que simule ser un cajero automático donde se extrae dinero de la cuenta. # El programa debe consultar al usuario la cantidad que desea extraer. # Si el dinero que desea extraer es menor al saldo total, la extracción será exitosa y deberá informar el monto extraído y el saldo restante. # Si se solicita un monto que excede el monto, el programa deberá decir saldo insuficiente. # Esta versión del programa mejora en caso que el usuario ingrese una letra o un número negativo. dinero= 900 extraccion = input("Ingrese el monto que desea extraer:") # Mientras no sea un valor numérico válido, volverá a pedir el dato. # isnumeric() devolverá false while not extraccion.isnumeric(): extraccion = input("Ingrese el monto valido para extraer:") # Se convierte a número extraccion = int(extraccion) if extraccion <= dinero: dinero = dinero - extraccion print (f"Usted ha extraído ${extraccion}") else: print("No hay suficiente saldo para completar la operación") print (f"El saldo restante es: ${dinero}")
sigma_s = 1 N_d = 32 N_c = 8 K = 50 P_FA = 0.05 SNR = 10 SNR_LOW = -20 SNR_UP = 6 SNR_STEP = 2 SNR_NOISE = 1 P_H1 = 0.2 NUM_STATISTICS = 1000 #NUM_STATISTICS = 100000
#Open file and store data data = [] with open('inputs\input5.txt') as f: data = f.readlines() data = [line.strip() for line in data] #Define Functions with Binary Conversions def splitRowCol(boardingPass): return(boardingPass[0:7],boardingPass[7:]) def convToBinary(inputStr,convToZero=["F","L"],convToOne=["B","R"]): inputStr = list(inputStr) for charIndex in range(len(inputStr)): if inputStr[charIndex] in convToZero: inputStr[charIndex] = "0" elif inputStr[charIndex] in convToOne: inputStr[charIndex] = "1" return "".join(inputStr) def getRowCol(boardingPass): rowStr,colStr = splitRowCol(boardingPass) rowBinary = convToBinary(rowStr) colBinary = convToBinary(colStr) row = int(rowBinary,2) col = int(colBinary,2) return row,col def calcSeatID(row,col): return (row*8)+col #Solution 1 with Binary conversions seatIDs = [] for boardingPass in data: row,col = getRowCol(boardingPass) seatIDs.append(calcSeatID(row,col)) print(max(seatIDs)) #Solution 2 with Binary conversions seatIDs = [] for boardingPass in data: row,col = getRowCol(boardingPass) seatIDs.append(calcSeatID(row,col)) seatIDs.sort() for i in range(len(seatIDs)-1): if seatIDs[i]+1 != seatIDs[i+1]: print(seatIDs[i],seatIDs[i+1]) #sanity check print statement print("Solution: " + str(seatIDs[i]+1))
doc+='''<head>\n <title>Privacy Policy</title>\n <meta charset="utf-8">\n <meta name="format-detection" content="telephone=no">\n <link rel="icon" href="images/favicon.ico" type="image/x-icon">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/grid.css">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/style.css">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/google-map.css">\n <link rel="stylesheet" href="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/css/mailform.css">\n <script src="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/js/jquery.js"></script>\n <script src="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/js/jquery-migrate-1.2.1.js"></script>\n \n <script src="''' try: doc+=str(data['base_url']) except Exception as e: doc+=str(e) doc+='''static/js/device.min.js"></script>\n <head>\n <title>Administrador</title>\n <meta charset="utf-8">\n <meta http-equiv="pragma" content="no-cache">\n <link rel="icon" type="image/png" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/imgs/logos/logoZtec.png" />\n <link rel="shortcut icon" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/imgs/logos/logoZtec.png" />\n <script src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/jquery-3.1.0.js"></script>\n <link rel="stylesheet" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/jquery.mCustomScrollbar.css" />\n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/jquery.mCustomScrollbar.js"></script>\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/estilos.css">\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/bootstrap.css">\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/flexboxgrid.css">\n <link rel="stylesheet" type="text/css" href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/ff.css">\n \n \n <link href="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/css/perfect-scrollbar.min.css" rel="stylesheet">\n \n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/script/file=Config.js&manager=True"></script>\n \n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/python/__javascript__/Codificador.js"></script>\n \n <!--<script type="text/python3" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/brython/nuclear.by"></script>-->\n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/python/__javascript__/py_datos.js"></script>\n <script type="text/javascript" src="''' try: doc+=str(config.base_url) except Exception as e: doc+=str(e) doc+='''static/js/python/__javascript__/nuclear.js"></script>\n \n <meta name="viewport" content="width=device-width, initial-scale=1">\n \n\n \n''' try: if "vars" in data: doc+='''\n\n''' try: for elem in data["vars"]: doc+="""\n<var name='""" try: doc+=str(elem) except Exception as e: doc+=str(e) doc+="""' style="display: none">""" try: doc+=str(decode(str(data["vars"][elem]))) except Exception as e: doc+=str(e) doc+='''</var>\n''' pass except Exception as e: doc+=str(e) doc+='''\n''' pass except Exception as e: doc+=str(e) doc+='''\n\n\n\n\n\n\n\n </head>\n\n'''