Homework Discussions for the Basic Python Workshop

Screenshot 2022-02-20 022850

@yeskaydeee To demonstrate what is happening behind the scenes, I have inserted ‘A’ at the start and ‘B’ at the end of the same string.

You can observe from my output that we do not have a colon at the start and also we do not have a colon in the next line when ‘B:’ ends. So, what’s happening?

A string is a list. In your case, the very first character (at index 0) and the very last character stored in the string is not ‘H’ and ‘s’ respectively, but a newline character\n’. So, what does a newline character do? As its name suggests it takes the cursor to a new line. Our program will treat it as a character just like it treats ‘a’, ‘b’, ‘c’ or ‘d’. The difference comes when it will be printed. You can see ‘a’ but you can’t see a newline character unless you have a frame of reference.

So, in your program, a newline character is printed first which essentially means your print cursor moves to a new line, then a colon is printed as we have explicitly mentioned that after printing each character, end with a colon (end=’:’). After that ‘H’ is printed and ends with a colon. Therefore, we get ‘:H:’. The same process repeats till we print ‘s:’. After that our program encounters a newline character again which is the last character in our string, prints that (takes us to a new line) and then prints the colon and finally comes out of the loop.

In my case, ‘A’ and ‘B’ are respectively the very first and very last characters in the string. Now, you can make out the difference.

I hope it helps!

1 Like

ohhh now i understand,
thank you very much for explaining in detail :slightly_smiling_face:

Q1. when using split on string , it creates a list type, due to which i am unable to use lower

Q2. Do we have to store the words (split and then lowercase ) in worddict? and it should be dict type?


is this fine???

@yeskaydeee Yup, looks good to me.

hi @bbhaskar8 i have submitted the homework before deadline, but i am unable to see them under certificate section

@yeskaydeee Apologies for the delay. We are evaluating the homeworks. Will be releasing the certificates soon.

Hi @bbhaskar8 , where can I access the recording of the session?

@rohit251102 You can access the recording of the workshop on this thread here.

@adityadoomra10 Instead of running a loop over all the characters in word_string, it is better to run the loop over punctuation. Just a performance hit!!

1 Like

Hi @sainath.tulluri, thank you for completing the homework. Please submit the homework notebook link in the google form linked on top of this page. You will be eligible for the certificate for the workshop only if you submit the link on that form.
Also, please remove the link to your notebook from your post as the entire homework sharing is not encouraged here, any discussion of doubts related to homework is highly encouraged and appreciated.

Histogram with the frequency count

Done, Thank you for notifying me. I have submitted the google form earlier, still it is not evaluated

I submitted my HW long back. When will I get my certificate. Please let me know the same.

Ankit

Hey guys, I just finished writing the code for the homework and finished the quiz as well. I am not sure if there is a separate link for the workshop held on 12th March 2022 or the link mentioned here is where I need to submit the homework. Please get back to me so I can submit the homework asap in case there is a separate link for today’s work shop.

I was able to remove the punctuation which was muddying up the dataset but used a slightly different method from what was discussed in the forum since I already had a list of all the words which were not in the stop_words list.
I looped through the words in the list and then looped through the characters in the current word, checking if they were in the punctuation list. Then just simply replace the punctuation with - “”.

Can this could be sped up using some sort of vectorized implementation, If anyone has any ideas I would like to know.
Thanks,
Vrish

univ workshop homework final result

@vrishbhanu28 Hi, you can submit your homework on this google form https://forms.gle/Yne98J3LqR2jQg5d9 apart from that we highly appreciate the efforts you put in while doing it. You could always look up to new and optimized ways to perform the same thing. Happy Learning!

@bbhaskar8 hi, i haven’t got homework till now. Cohort 2

@yeskaydeee The homework notebook can be accessed from the github repository. Or you can directly access it on Colab here.

The homework submission form is linked here. The deadline for submission is Sunday 20th Mar at 11.59PM IST.

but i had submitted for python last month

@yeskaydeee You meant Certificates then, right? Allow me some time, I will check with the backend team and update you. For your information, homework submitted until last week have been evaluated.