# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab.research.google.com/github/nksharma063/it-cert-automation-practice/blob/master/copypastecodeforfuturehelp.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>

# + colab={"base_uri": "https://localhost:8080/"} id="y9_MDm0KEZt4" outputId="c79c337e-4ce0-48b9-d4c1-9f19ea14d2a7"
PlayListRatings = [10, 9.5, 10, 8, 7.5, 5, 10, 10]
i = 0
Rating = PlayListRatings[i]
while(Rating >= 6):
    print(Rating)
    Rating = PlayListRatings[i]
    i = i + 1

# + colab={"base_uri": "https://localhost:8080/"} id="7G8UGKH8czUD" outputId="bea0cb3e-52d7-4082-de28-57d84c1ba5a2"
# Write your code below and press Shift+Enter to execute

squares = ['orange', 'orange', 'purple', 'blue ', 'orange']
new_squares = []

i = 0
while squares[i] == "orange":
    new_squares.append(squares[i])
    i = i + 1
print(new_squares)

# + colab={"base_uri": "https://localhost:8080/"} id="WxEMLTqUc2fH" outputId="57695289-9362-456b-e6c8-6041eb660c77"
squares = ['orange', 'orange', 'purple', 'blue ', 'orange']
new_squares = []
i = 0
while(squares[i] == 'orange'):
    new_squares.append(squares[i])
    i = i + 1
print (new_squares)


# + id="AWS5tM-sdqvN"
class analysedText(object):
    
    def __init__ (self, text):
        # remove punctuation
        formattedText = text.replace('.','').replace('!','').replace('?','').replace(',','')
        
        # make text lowercase
        formattedText = formattedText.lower()
        
        self.fmtText = formattedText
        
    def freqAll(self):        
        # split text into words
        wordList = self.fmtText.split(' ')
        
        # Create dictionary
        freqMap = {}
        for word in set(wordList): # use set to remove duplicates in list
            freqMap[word] = wordList.count(word)
        
        return freqMap
    
    def freqOf(self,word):
        # get frequency map
        freqDict = self.freqAll()
        
        if word in freqDict:
            return freqDict[word]
        else:
            return 0


# + id="FYilpUkqiTD8"
class Rectangle(object):
    
    def __init__(self,width=2,height =3,color='r'):
        self.height=height 
        self.width=width
        self.color=color
    
    def drawRectangle(self):
        import matplotlib.pyplot as plt
        plt.gca().add_patch(plt.Rectangle((0, 0),self.width, self.height ,fc=self.color))
        plt.axis('scaled')
        plt.show()


# + id="8p8S4YXTicyJ"
class Points(object):
  def __init__(self,x,y):

    self.x=x
    self.y=y

  def print_point(self):

    print('x=',self.x,' y=',self.y)

p1=Points("A","B")
p1.print_point()


# + id="ZbhyOmtAifZM"
class Points(object):
  def __init__(self,x,y):

    self.x=x
    self.y=y

  def print_point(self):

    print('x=',self.x,' y=',self.y)

p2=Points(1,2)

p2.x=2

p2.print_point()

# + colab={"base_uri": "https://localhost:8080/"} id="wh11q3s64Zwp" outputId="00efc8fa-d786-47a6-e77d-bfd9e3b560a8"
a = 1

try:
    b = int(input("Please enter a number to divide a"))
    a = a/b
except ZeroDivisionError:
    print("The number you provided cant divide 1 because it is 0")
except ValueError:
    print("You did not provide a number")
except:
    print("Something went wrong")

# + colab={"base_uri": "https://localhost:8080/"} id="QSHHKWb64a8v" outputId="01eaf99e-4037-491c-ae28-efac63f5b9cf"
a = 1

try:
    b = int(input("Please enter a number to divide a"))
    a = a/b
except ZeroDivisionError:
    print("The number you provided cant divide 1 because it is 0")
except ValueError:
    print("You did not provide a number")
except:
    print("Something went wrong")
else:
    print("success a=",a)

# + colab={"base_uri": "https://localhost:8080/"} id="wv5XDsGg5cUM" outputId="15c94e52-7df8-4e77-ed25-c85a4a885fab"
a = 1

try:
    b = int(input("Please enter a number to divide a"))
    a = a/b
except ZeroDivisionError:
    print("The number you provided cant divide 1 because it is 0")
except ValueError:
    print("You did not provide a number")
except:
    print("Something went wrong")
else:
    print("success a=",a)
finally:
    print("Processing Complete")

StarcoderdataJupyterScriptsDedupFiltered