## print colored text to IDE terminal

0 likes • Jun 1, 2023 • 0 views
Python

## More Python Posts

#### Return Letter Combinations

0 likes • Nov 18, 2022 • 0 views
Python
`# @return a list of strings, [s1, s2]def letterCombinations(self, digits):    if '' == digits: return []    kvmaps = {        '2': 'abc',        '3': 'def',        '4': 'ghi',        '5': 'jkl',        '6': 'mno',        '7': 'pqrs',        '8': 'tuv',        '9': 'wxyz'    }    return reduce(lambda acc, digit: [x + y for x in acc for y in kvmaps[digit]], digits, [''])`

#### Print pyramid pattern

0 likes • Nov 19, 2022 • 0 views
Python
`def print_pyramid_pattern(n):         # outer loop to handle number of rows    # n in this case    for i in range(0, n):             # inner loop to handle number of columns        # values changing acc. to outer loop        for j in range(0, i+1):                     # printing stars            print("* ",end="")              # ending line after each row        print("\r") print_pyramid_pattern(10)`

#### Factorial of N

0 likes • Nov 19, 2022 • 0 views
Python
```import math
def factorial(n):    print(math.factorial(n))    return (math.factorial(n))    factorial(5)factorial(10)factorial(15)```

#### Untitled

0 likes • Apr 21, 2023 • 0 views
Python
`print("hellur")`

#### Create a Floyd’s Triangle

0 likes • May 31, 2023 • 0 views
Python
```def generate_floyds_triangle(num_rows):    triangle = []    number = 1    for row in range(num_rows):        current_row = []        for _ in range(row + 1):            current_row.append(number)            number += 1        triangle.append(current_row)    return triangle

def display_floyds_triangle(triangle):    for row in triangle:        for number in row:            print(number, end=" ")        print()

# Prompt the user for the number of rowsnum_rows = int(input("Enter the number of rows for Floyd's Triangle: "))
# Generate Floyd's Trianglefloyds_triangle = generate_floyds_triangle(num_rows)
# Display Floyd's Triangledisplay_floyds_triangle(floyds_triangle)```

#### guacamole LDAP creation

0 likes • Nov 18, 2022 • 0 views
Python
```import osimport sysimport argparseimport jsonimport csvimport getpassimport stringimport randomimport re
from datetime import datetimeimport ldapimport requestsfrom requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnings(InsecureRequestWarning)from requests.auth import HTTPBasicAuthimport validators

def create_guac_connection(BASE_URL, auth_token, ldap_group, computer, guac_group_id):    '''    creates a guac connection    '''    json_header = {'Accept': 'application/json'}    query_parm_payload = { 'token': auth_token }
payload_data = {   "parentIdentifier":guac_group_id,   "name":computer,   "protocol":"vnc",   "parameters":{      "port":"5900",      "read-only":"",      "swap-red-blue":"",      "cursor":"",      "color-depth":"",      "clipboard-encoding":"",      "disable-copy":"",      "disable-paste":"",      "dest-port":"",      "recording-exclude-output":"",      "recording-exclude-mouse":"",      "recording-include-keys":"",      "create-recording-path":"",      "enable-sftp":"true",      "sftp-port":"",      "sftp-server-alive-interval":"",      "enable-audio":"",      "audio-servername":"",      "sftp-directory":"",      "sftp-root-directory":"",      "sftp-passphrase":"",      "sftp-private-key":"",      "sftp-username":"",      "sftp-password":"",      "sftp-host-key":"",      "sftp-hostname":"",      "recording-name":"",      "recording-path":"",      "dest-host":"",      "password":"asdasd",      "username":"asdasd",      "hostname":"nt72310.cvad.unt.edu"   },   "attributes":{      "max-connections":"",      "max-connections-per-user":"1",      "weight":"",      "failover-only":"",      "guacd-port":"",      "guacd-encryption":"",      "guacd-hostname":""   }}    CREATE_CONNECTION_URL = BASE_URL + "/api/session/data/mysql/connections"