Jump to content

What to do next in python ?

So, Im going to be attending college within a few months doing a bachelors in computer science engineering, I have nothing good to do in these months so i thought why not level up my skills a little, which I don't really have any except the python I learnt in school, now it's not much but I know basic stuff (if/elses, loops ,lists/tupples/dictionaries,functions, handling text files/binary files/csv files) and using mysql library to handle some dbms stuff, i wanna learn some more but ii don't know what to learn where to learn from, I want to get into making atleast 1 small project, I am really interested in ML and would also like to try some Iot stuff with a raspberry pi, but i have no idea how to go on about those things, what libraries to learn, and where and how should I learn them, I've been using IDLE to do python until now, so I have no idea what code editor should I even use, please help me out.

 

Link to comment
Share on other sites

Link to post
Share on other sites

Learning basic data structures will get you ahead quite a bit.

 

Trees, lists, graphs, etc. 

 

These are tools that are all integral to learning computer science, algorithms and maths.

 

Then learning traversal methods for each and how to manipulate them will also be wildly helpful.

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 3600 || GPU: RTX 3070|| Memory: 32GB @ 3200 || Cooler: Scythe Big Shuriken || PSU: 650W EVGA GM || Case: NR200P

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, Slottr said:

Learning basic data structures will get you ahead quite a bit.

 

Trees, lists, graphs, etc. 

 

These are tools that are all integral to learning computer science, algorithms and maths.

 

Then learning traversal methods for each and how to manipulate them will also be wildly helpful.

I can do lists, Stacks and Queues which were in my syllabus, I gotta learn trees and graphs

Link to comment
Share on other sites

Link to post
Share on other sites

My thing was compression ... try to write a small program to compress a file using some basic compression algorithms like RLE , building a dictionary of words you detect in a text file and using  fewer bits to the most often used words,  LZW , LZ77/LZSS ...

 

I found this series of lectures quite easy to understand and actually wrote the LZW / compress for fun in PHP and wrote a version of LZ77 for one of my projects

 

VIdeo below is lesson 3, skipped the intro lesson 2 ... if you're interested I'd suggest watching lessons 2 to 5 and lesson 10 (LZ** schemes)

 

 

One of the easiest compression schemes I'm aware of is one that was used in a lot of DOS games in the past, or some variations of this:

 

Your compressed file will be something like this :

 

4 or 8 bytes - the original file size

multiple groups of  9 to 17 bytes of compressed data.

 

Each group consists of :

1. One byte which contains up to 8 "flags"

2. Up to "8" encoded sequences, one for each "flag" in the first byte:

2.1  if bit is 0, that means no compression, just copy one byte, uncompressed

2.2 if bit is 1, that means compressed content, 2 bytes, a pair of  length + distance

2.2.1 : length : 4 bits : how many characters to copy  (4 bits means up to 15 characters + 2 = 17 characters, because you'll only use this if at least 2 characters were found in previously encoded content)

2.2.2 : distance : 12 bits : how many characters in the past to look for this sequence of up to 17 characters to copy it

 

repeat creating such groups until you decode as many bytes as the file size

 

So for example, let's say you want to compress "abcabcx" - 7 characters 

This would be compressed into

 

1: file size : 0 , 0 , 0 , 7  (4 bytes)

2. the flags byte : 0 0 0 1 0 0 0 0  (copy "a", copy "b", copy "c", compress "abc", copy "x", 3 bits of padding )

 

You keep an array of 4096 characters, a history of what you already compressed.

 

So you read the first character "a". The history is empty, so you have no choice but to copy it to output, so you set the first flag bit to 0, and your first sequence is "a" and you put "a" in the first position in the array.

Read the next character "b",  you look in the array and you only have "a" there, so no match, set the 2nd flag bit to 0, add the sequence "b" to memory and also add the character "b" to the array.

Read the next character "c", you look in the array and you only have "ab" there, so set the 3rd flag bit to 0, add the sequence "c" to memory and also add the character "c" to the array.

Now you read the fourth character "a" and you look back in the array and see all the positions where you have "a" ,,, happens to be only one, "a" is at offset 0 but there could be multiple positions. Now the tricky part is that you read ahead and see if you can find a longer match .. so you read b and have the sequence "ab" which still exists, you read one more character and you have "abc" which still exists , you read one more character ad you have "abcx" which no longer exists, so you revert back to "abc" which is 3 characters.  You can now compress this to two characters using 4 bits for length (3-2 = 1) and distance is 3 as in "go back 3+1 = 4 characters" , you add the 2 byte sequence, you add the 1 bit to the flags, and you add "abc" to the array.

Now your array is "abcabc"

You're back to reading the "x" character, you look in the array and there's no "x", so you add a 0 flag, and add x to array and as a sequence

You've reached the end of file, so you add 3 bits of padding to the flags bit and you output the flags byte and the 5 sequences.

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

One of the things I did when I was learning how to program seriously was implement various sorting algorithms. I wrote a program to generate random numbers, strings, etc. and write it to a file, then another program that reads the file and sorts the data in whatever order you choose. It's good practice for learning how to work with data and think about the performance of various algorithms. For example, when I was testing out insertion sort on a large file - maybe 10s of GBs? - my program ran for 8 hours before I shut it down. In contrast, radix sort took only 5 minutes to sort the entire file. However, for smaller sets of data, insertion sort could be faster since radix sort needs lots of overhead to run.

 

Something in this area that I never got around to, but would be a good exercise, is to make it so that your sorting code can accept ANY data type whose objects can be compared to one another.

 

 

 

Computer engineering grad student, cybersecurity researcher, and hobbyist embedded systems developer

 

Daily Driver:

CPU: Ryzen 7 4800H | GPU: RTX 2060 | RAM: 16GB DDR4 3200MHz C16

 

Gaming PC:

CPU: Ryzen 5 5600X | GPU: EVGA RTX 2080Ti | RAM: 32GB DDR4 3200MHz C16

Link to comment
Share on other sites

Link to post
Share on other sites

You can always just do leetcodes if all you want is a job/internship, just note these have absolutely nothing to do with your daily work as software engineer and developer, they are only good for technical interviews and if you are interested in competitive programming. 

 

Btw, whatever you are coding, follow these order of importance. 

 

1) make it work(solves the problem)

2) make it right(maintainable)

3) make it fast(performs)

 

1 is the most important because if it doesn't work, it won't matter what the other 2 are, your code goes straight into the garbage. Proof of concept comes first.

 

2 comes before 3 because writing high quality, readable, well architectured code is better than whatever speedy spaghetti you come up with. Think of this like food vs service in a resturant. Of course you will want attentive wait staff that service you properly but lets be real, the primary reason people go to a resturant is to eat. Businesses pay more for good quality code that wont cost them a fortune to train junior devs to maintain compare to whatever complicated stuffs that are faster at some neglible nano seconds. Reason is simple, if these spaghetti cant be easily modify to meet the new changing requirement without a full rewrite, it goes straight into the garbage. Luckily in the real world, you usually have some senior devs or code owners who would check these. They would probably reject your pull requests left and right and nitpick on everything in code reviews until you build up a good habit. Use a good linter/set compiler/interpreter to strict, treat all warnings as errors ect are all good pratice. 

 

Last if at all, is the speed and efficiency. In this day and age, if your application works fast enough, then this is all you need. It already performs. Don't fix what's not broken. Doing so greatly destroys 1 and 2 in that you end up with buggy code that doesn't work right or complex code that is unmaintainable.

This applies to competitive programming too. If your code doesn't pass tests and QA, no body cares if it is o(logn), n linear, or even constant complexity, it goes into the garbage. A working albeit slow solution scores way higher marks than a blazingly fast but incorrect one. It is literally a difference of score of 50/100 on the low end vs a score of 0/100. 

 

https://keyholesoftware.com/writing-quality-code-practicing-make-it-work-make-it-right-make-it-fast/#:~:text=When you think about it%2C this expresses the,errors%2C make it right%2C or make it maintainable.

 

Welcome to real world software engineering. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×