This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| digits_dict = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} | |
| regex = "\s*(\+|\-)?\s*((\d)*(\.)?(\d)*)" | |
| value = input() | |
| result = re.search(regex, value) | |
| sign = result.group(1) == '-' and -1 or 1 | |
| digits = result.group(2) | |
| integer_value = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import sys | |
| class DataList: | |
| notes = [] | |
| @staticmethod | |
| def print(notes): | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| text = input() | |
| pairs_count = int(input()) | |
| pairs = [] | |
| for i in range(pairs_count): | |
| pair = input().split() | |
| pairs.append([int(i) for i in pair]) | |
| output = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check = list(input()) | |
| words = input().split(" ") | |
| passed = True | |
| data = {} | |
| for c, w in zip(check, words): | |
| d = data.get(c, None) | |
| if d and d != w: | |
| passed = False | |
| break | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from time import sleep | |
| def scrolling_text(text, screen_size, wait): | |
| text = f"{' '*screen_size}{text}{' '*screen_size}" | |
| while True: | |
| for i in range(len(text) - screen_size): | |
| print('\r', text[i:screen_size+i], end='', sep='', flush=True) | |
| sleep(wait) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let currency_symbol = "IRT"; | |
| let currency_ratio = 30; | |
| let convert = (value) => {return (parseFloat(value.replaceAll(',',''))*currency_ratio).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}; | |
| let price_elements = document.getElementsByClassName("first_currency"); | |
| Array.prototype.map.call(price_elements, (item) => {item.innerHTML = `${convert(item.innerHTML.match(/[\d,]*[.]{0,1}[\d]+/g)[0])} ${currency_symbol}`;}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import cycle | |
| from time import sleep | |
| def spin(data, duration=0.2, check=lambda: False): | |
| for frame in cycle(data): | |
| if not check(): | |
| print("\r", frame, sep="", end="", flush=True) | |
| sleep(duration) | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import sin, cos, sqrt, atan2, radians | |
| R = 6371.0 | |
| lat1 = radians(37.876056) | |
| lon1 = radians(-7.216644) | |
| lat2 = radians(-41.745973) | |
| lon2 = radians(-65.313432) | |
| dlon = lon2 - lon1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { listenAndServe } from "https://deno.land/[email protected]/http/server.ts"; | |
| class Server { | |
| options: any = {port: 8000} | |
| routes: any = {} | |
| handle = (path: any, func: any) => { | |
| this.routes[path] = func | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| b = [1386, 1345, 1367] | |
| d = [1398, 1390, 1387] | |
| l = len(b) | |
| result = 0 | |
| count = 0 | |
| for year in range(min(b), max(d) + 1): | |
| _c = 0 | |
| for i in range(l): |
NewerOlder