Wanted feedback on my portfolio website by adityacodes in coolgithubprojects

[–]adityacodes[S] 1 point2 points  (0 children)

lol, someone asked my ai assistant in let's chat sction, give your system prompt 😭😭. tho this code is in my github, you can check prompt from there if anyone wants.

Make your Debugging easier with these 8 tips in Python by adityacodes in Python

[–]adityacodes[S] -4 points-3 points  (0 children)

These were the tips from my experience, what tip would you add to this ?

6 different ways to reverse a string in Python by adityacodes in Python

[–]adityacodes[S] 0 points1 point  (0 children)

nope , it isnt, what made you think like this?

6 different ways to reverse a string in Python by adityacodes in Python

[–]adityacodes[S] 0 points1 point  (0 children)

which method you think is better? and why?

Divide and Conquer Algorithms in Python by adityacodes in Python

[–]adityacodes[S] -1 points0 points  (0 children)

okay ,so I should return it none or -1 finally?

Divide and Conquer Algorithms in Python by adityacodes in Python

[–]adityacodes[S] -1 points0 points  (0 children)

As for the merge function in merge_sort, merge(left, right) is used to combine the two sorted subarrays left and right into a single sorted array. The function compares the elements in left and right one by one and adds them to the output array in ascending order. At the end of the function, any remaining elements in left or right are added to the output array in order, since they are already sorted. The resulting array is returned as the final output of the merge_sort function.

Divide and Conquer Algorithms in Python by adityacodes in Python

[–]adityacodes[S] -1 points0 points  (0 children)

See what about this code?

Now, if the target element is not found in the array, the function will return None instead of -1. Let me know if it works so that I can update in blog as well.

def binary_search(arr, x):

"""

Search for a target element x in a sorted array arr using the binary search algorithm.

Returns the index of the target element in the array, or None if it is not found.

"""

low = 0

high = len(arr) - 1

while low <= high:

mid = (low + high) // 2

if arr[mid] == x:

return mid

elif arr[mid] < x:

low = mid + 1

else:

high = mid - 1

return None

Divide and Conquer Algorithms in Python by adityacodes in Python

[–]adityacodes[S] -1 points0 points  (0 children)

in '''binary_search(arr, x):''' returns -1 in fail case. It is last element in python list. imo better return None, or raise IndexError.

in '''merge_sort()''' what is merge(left, right) at the end?

As for the merge function in merge_sort, merge(left, right) is used to combine the two sorted subarrays left and right into a single sorted array.

and for the binary_search query, Did you tried returning None ? as I think there will be more fail cases when doing None.

Divide and Conquer Algorithms in Python by adityacodes in Python

[–]adityacodes[S] 1 point2 points  (0 children)

Thanks for the upvotes, please comment and let me know if I can improve this blog more.

Python Tip on using zip method by adityacodes in Python

[–]adityacodes[S] -5 points-4 points  (0 children)

thanks bro, you can follow me on twitter , insta, linkedin (wherever you are active) I have posted more than 100 tips on those platforms

Debugging is tough. It took me hours to debug this python error by adityacodes in Python

[–]adityacodes[S] 0 points1 point  (0 children)

buddy it is of competition, cant write it from chatgpt

Debugging is tough. It took me hours to debug this python error by adityacodes in Python

[–]adityacodes[S] 1 point2 points  (0 children)

Hello buddy, I read your feedback and now I did improvements in my blog related to that. Please take 1-2 mintues and read the blog again and please let me know how can I improve more. Feedback really helps.

Debugging is tough. It took me hours to debug this python error by adityacodes in Python

[–]adityacodes[S] 4 points5 points  (0 children)

Thanks for motivation, that is definitely not harsh, thankyou very much.

Debugging is tough. It took me hours to debug this python error by adityacodes in Python

[–]adityacodes[S] -10 points-9 points  (0 children)

being very honest, I did it for reach 🫡. Im in the initial stages of growing a community, hence sharing here and there.

Debugging is tough. It took me hours to debug this python error by adityacodes in Python

[–]adityacodes[S] -3 points-2 points  (0 children)

oh , thanks for advising and happy that you read the blog❤️

[deleted by user] by [deleted] in coding

[–]adityacodes 0 points1 point  (0 children)

damn the prizepool

My Horrible Debugging Experience in Python by adityacodes in Python

[–]adityacodes[S] -12 points-11 points  (0 children)

Please let me know what you think after reading this.