Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 33 additions & 11 deletions Part-1-Functions
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,25 @@
# arrayCheck([1, 1, 2, 4, 1]) → False
# arrayCheck([1, 1, 2, 1, 2, 3]) → True

def arrayCheck(nums):
# CODE GOES HERE
def arrayCheck(num):
i=0
while(i!=4):
if (num[i]==1 and num[i+1]==2 and num[i+2]==3):
break
else:
i=i+1
if (i==4):
print("false")
else:
print("True")
num=[]
for i in range(5):
a=int(input("enter: "))
num.insert(i,a)
i=i+1
print(num)
arrayCheck(num)



#####################
Expand Down Expand Up @@ -57,8 +74,19 @@ def stringBits(str):
# end_other('abc', 'abXabc') → True


def end_other(a, b):
# CODE GOES HERE
def end_other(a,b):
if a[-1]==b[-1]:
print("true")
else:
print("false")

x=str(input("Enter 1st string: "))
y=str(input("Enter 2nd string: "))
x=x.lower()
y=y.lower()
print("strings are: ",x,y)
end_other(x,y)


#####################
## -- PROBLEM 4 -- ##
Expand All @@ -71,14 +99,8 @@ def end_other(a, b):
# doubleChar('AAbb') → 'AAAAbbbb'
# doubleChar('Hi-There') → 'HHii--TThheerree'

#def doubleChar(str):
def doubleChar(str):
# CODE GOES HERE
def doubleChar(string):
for i in string:
print(i*2, end="")

str1=str(input("Enter a string: "))
doubleChar(str1)


#####################
Expand Down