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
Show hidden characters
| {"variables": {}, "globals": {}, "rules": [{"scope": "0.matched.color.rainbow", "background": "#212122", "foreground": "#FF0000", "name": "rainbow_color_matched_no_0"}, {"scope": "1.matched.color.rainbow", "background": "#212122", "foreground": "#FF6A00", "name": "rainbow_color_matched_no_1"}, {"scope": "2.matched.color.rainbow", "background": "#212122", "foreground": "#FFD800", "name": "rainbow_color_matched_no_2"}, {"scope": "3.matched.color.rainbow", "background": "#212122", "foreground": "#00FF00", "name": "rainbow_color_matched_no_3"}, {"scope": "4.matched.color.rainbow", "background": "#212122", "foreground": "#0094FF", "name": "rainbow_color_matched_no_4"}, {"scope": "5.matched.color.rainbow", "background": "#212122", "foreground": "#0041FF", "name": "rainbow_color_matched_no_5"}, {"scope": "6.matched.color.rainbow", "background": "#212122", "foreground": "#7D00E5", "name": "rainbow_color_matched_no_6"}, {"scope": "unmatched.color.rainbow", "background": "#212121", "foreground": "#FF0000", "name": "rai |
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
| #!/usr/bin/env python3 | |
| import sys | |
| def gcd(x, y): | |
| """Compute GCD = Greatest Common Divisor of x and y.""" | |
| if x < y: | |
| x, y = y, x |
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
| /* Solution for 'Supervisor & cooperating workers' pattern #6 | |
| * The program creates 4 anonymous pipes (1 for reading, 1 for reading, for each process. You have 2 processes => 2 x 2 = 4 anoynmous pipes) | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> |
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
| #!/usr/bin/env python3 | |
| import sys | |
| def solve_equation(a, m, totient): | |
| k = 1 | |
| result = a ** k % m | |
| while result != 1 and k <= totient: |
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
| #!/usr/bin/env python3 | |
| import sys | |
| def solve_equation(a, m): | |
| k = 1 | |
| result = a ** k % m | |
| while result != 1: |
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
| #!/usr/bin/env python3 | |
| from bokeh.plotting import figure, show, output_file | |
| from json import load | |
| output = 'plot.html' | |
| json_file = 'info.json' | |
| def identify_month_by_number(number: str) -> str: |
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
| #!/usr/bin/env python3 | |
| import json | |
| from collections import Counter | |
| filename = 'info.json' | |
| def identify_month_by_number(number: str) -> str: | |
| """Take the number of the month as a string and return its name.""" |
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
| #!/usr/bin/env python3 | |
| import json | |
| filename = "info.json" | |
| def write_birthday(data: dict) -> None: | |
| """Write birthday of a scientist to a json file on the disk.""" | |
| with open(filename, 'w') as json_file: |
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
| #!/usr/bin/env python3 | |
| if __name__ == '__main__': | |
| birthdays = {'Albert Einstein': '03/14/1879', | |
| 'Benjamin Franklin': '01/17/1706', | |
| 'Ada Lovelace': '12/10/1815'} | |
| print('>>> Welcome to the birthday dictionary. We know the birthdays of:') | |
| for i in birthdays: | |
| print(i) |
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
| #!/usr/bin/env python3 | |
| ''' | |
| Contents of Practice_Python.functions: | |
| from random import choice | |
| # Used for Hangman series | |
| def pick_random_word() -> str: |
NewerOlder