Loading...
More Python Posts
# Input for row and columnR = int(input())C = int(input())# Using list comprehension for inputmatrix = [[int(input()) for x in range (C)] for y in range(R)]
class Rectangle:passclass Square(Rectangle):passrectangle = Rectangle()square = Square()print(isinstance(rectangle, Rectangle)) # Trueprint(isinstance(square, Rectangle)) # Trueprint(isinstance(square, Square)) # Trueprint(isinstance(rectangle, Square)) # False
class Solution(object):def floodFill(self, image, sr, sc, newColor):R, C = len(image), len(image[0])color = image[sr][sc]if color == newColor: return imagedef dfs(r, c):if image[r][c] == color:image[r][c] = newColorif r >= 1: dfs(r-1, c)if r+1 < R: dfs(r+1, c)if c >= 1: dfs(r, c-1)if c+1 < C: dfs(r, c+1)dfs(sr, sc)return image
# function which return reverse of a stringdef isPalindrome(s):return s == s[::-1]# Driver codes = "malayalam"ans = isPalindrome(s)if ans:print("Yes")else:print("No")
import osimport sysimport argparseimport jsonimport csvimport getpassimport stringimport randomimport refrom datetime import datetimeimport ldapimport requestsfrom requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnings(InsecureRequestWarning)from requests.auth import HTTPBasicAuthimport validatorsdef 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"create_connection_request = requests.post(CREATE_CONNECTION_URL, headers=json_header, params=query_parm_payload, data=payload_data, verify=False)create_connection_result = create_connection_request.status_codeif create_connection_result == "200":print("Successfully created computer: " + computer)else:print(create_connection_request.json())return create_connection_result
#question1.pydef rose(n) :if n==0 :yield []else :for k in range(0,n) :for l in rose(k) :for r in rose(n-1-k) :yield [l]+[r]+[r]def start(n) :for x in rose(n) :print(x) #basically I am printing x for each rose(n) fileprint("starting program: \n")start(2) # here is where I call the start function