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
32 changes: 28 additions & 4 deletions Part-1-Functions
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,22 @@
# arrayCheck([1, 1, 2, 1, 2, 3]) → True

def arrayCheck(nums):
# CODE GOES HERE

num=[1,2,4,3]
c=0
s=0
print(num)
for i in num:
if num[s]==1:
if num[s+1]==2:
if num[s+2]==3:
c=1
s=s+1
if c==1:
print("true")
else:
print("false")

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The program is wrong



#####################
## -- PROBLEM 2 -- ##
Expand All @@ -38,7 +52,13 @@ def arrayCheck(nums):
# stringBits('Heeololeo') → 'Hello'

def stringBits(str):
# CODE GOES HERE
str="siddharth"
s=0
n=len(str)
for i in range(len(str)):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you use "n" variable if your not using it in range!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

print(str[s])
s=s+2

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you run the program? It's not correct, there's a possibility of index out of bounds error



#####################
Expand Down Expand Up @@ -120,4 +140,8 @@ def fix_teen(n):
# count_evens([1, 3, 5]) → 0

def count_evens(nums):
# CODE GOES HERE
for i in count_evens
if count_evens[i]%2==0:
count=count+1

return count
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Program's wrong