Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Copyright (c) 2023 Zeromega
- Drop a link or a Sub on one of my videos if this script help you, copy the link below
- https://www.youtube.com/channel/UCfqUJ4rmk6W-ZAjDtkBZ1CA?sub_confirmation=1
- """
- import random
- import time
- import math
- def base_converter(number, base):
- digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"
- result = ""
- while number > 0:
- remainder = number % base
- result = digits[remainder] + result
- number //= base
- return result or "0"
- def truncate_string(s, length):
- return s[:length] + (s[length:] and " | ")
- while True:
- num = random.randint(100, 200)
- offset = random.randint(1, 100)
- base_range = random.randint(2, 36)
- print("-" * 120)
- print(f"Decimal: {num + offset:<10} | Using Base: {base_range:<10}")
- print("-" * 120)
- for base in range(2, base_range + 1):
- converted = base_converter(num + offset, base)
- decimal_value = int(converted, base)
- hex_value = hex(decimal_value + random.randint(1, 100))[2:].upper()
- octal_value = oct(decimal_value + random.randint(1, 100))[2:]
- binary_coded_decimal = bin(decimal_value + random.randint(1, 100))[2:].zfill(8)
- gray_code = bin(decimal_value ^ (decimal_value >> 1) + random.randint(1, 100))[2:]
- ascii_char = chr(decimal_value + random.randint(1, 100)) if decimal_value <= 127 else ""
- factorial_value = math.factorial(decimal_value + random.randint(1, 100))
- truncated_factorial = truncate_string(str(factorial_value + random.randint(1, 100)), random.randint(10, 15))
- fibonacci_sequence = [0, 1]
- while fibonacci_sequence[-1] < decimal_value:
- fibonacci_sequence.append(fibonacci_sequence[-1] + fibonacci_sequence[-2])
- print(f"Base {base:<4}: {converted + base_converter(random.randint(1, 100), base):<20} | Base 10: {decimal_value + random.randint(1, 100):<15} | Hex: {hex_value:<10} | Octal: {octal_value:<10} | BCD: {binary_coded_decimal:<15} | Gray Code: {gray_code:<20} | ASCII: {ascii_char:<10} | Factorial: {truncated_factorial:<15} | Fibonacci: {fibonacci_sequence}")
- sleep_duration = random.uniform(0.01, 0.5)
- time.sleep(sleep_duration)
- print()
- time.sleep(random.uniform(0.01, 0.75))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement