python online formatter code example

Example 1: formatter in python

#TO  know this execute  and check
username,password = "GOOGLE","google"
#a. %  first type
print("User name=%s User password=%s"%(username,password))
#b. {}  second type
print("User name={} User password={}".format(username,password
#c. f  third type
print(f"User name={username} User password={password}")
print(f"User name={username} \nUser password={password}"

Example 2: online python formatter and compiler

12345678910111213141516171819class BaseConnection:    def _init_(self, credentials):        self.rs_connection = RedshiftConnection(credentials)    def set_timeout(self, timeout=10):        self.rs_connection.timeout = timeout        class MyDBConnection(BaseConnection):    def _init_(self, credentials):        self.rs_connection = RedshiftConnection(credentials)        super.__init__(self, credentials)            def set_timeout(self, timeout=20):        self.rs_connection.timeout = timeoutcredentials = {'username': 'user1', 'password': 'pass1'}my_db_conn = MyDBConnection(credentials)my_db_conn.set_timeout()print(my_db_conn.rs_connection.timeout)X