2
$\begingroup$

I'm a high school student who has learned Java with the AP Computer Science A curriculum at school. My CS class used the University of Washington's Practice-it site for practicing Java. I was wondering whether there was a similar open-to-public site for practicing Python, but I was unable to find a Python-practice website that matched Practice-it at the scale and quality of the problems. Could anyone provide some suggestions as to which website I could use?

The reason why I want to study Python is because I wish to take an introductory class to deep learning on Coursera that uses Python. But because I only learned Java in high school, I studied Python on my own, and was looking for a website where I could practice writing programs in Python. Also, because I am looking into becoming a data scientist, I am taking the applied data science course provided by UMichigan on Coursera

The most complicated Java program that I wrote was a 321-line long superclass and a corresponding 60-line client code that when executed, produces an interactive four-in-a-row game.

$\endgroup$
3
  • 1
    $\begingroup$ I have some ideas to give you guidance, but they aren't an answer to your question. But I'd need to know more about why you want to learn Python specifically. The insight I have is that learning a lot of languages at an elementary level isn't really a CS education. But if Python is truly important to you then the answers would be different. Can you edit the question to say more? BenI. also has some ideas that may complement mine. $\endgroup$
    – Buffy
    Mar 18 at 19:34
  • 1
    $\begingroup$ It might actually help to know the size of the largest, most complex, Java program you've written. $\endgroup$
    – Buffy
    Mar 18 at 19:40
  • $\begingroup$ @Buffy Thank you for your reply, Dr. Buffy--I edited my question as you requested. This year, I was accepted into an economics major program at a university, but I am thinking about double majoring in computer science. The reason why I wanted to study economics was because I was interested in applying mathematics to study society. But after I read more about Lee Sedol's loss to Alphago back in 2016, I wanted to learn more about deep learning and A.I.--two fields of computer science that also frequently use mathematics. $\endgroup$
    – J1J1P13
    Mar 22 at 10:47
1
$\begingroup$

This not-quite-answer hopes to give you some guidance on your self learning, beyond what you ask. But first, learning Python to fulfill another purpose, such as taking a course that requires it, is fine. Need driven learning, as it were.

But you have only written small (tiny, actually) programs in Java, certainly too small to teach you the advantages of OO programming in any language. And learning a lot of languages to write small programs is definitely NOT a CS education. In fact programming, in any language, is only a small part of a CS education, and only a tool for a larger purpose.

I suggest that, pretty soon you branch out. One way is to take on a really big project; maybe 50 pages of needed code. But you will also need a good grounding in data structures and algorithms (that is two things, not one) if you don't already have that. You will need those in spades to become a data scientist. You should also, probably soon, take a course in database (both theory and practice, not just SQL).

I suggest, also, that while learning Python after Java, that you focus on their differences, not their similarities. They are, in many ways quite similar, but the fact that Python checks the types of things only at runtime (Java at compile time) requires a different mind set. The syntactic differences are minor by comparison. Do a search for "pythonic" to get a sense about how a skilled Python programmer thinks.

But the key point here is "lots of languages does not a computer scientist make". Go deep in some language before you try to go broad. Otherwise you are just paddling in the kiddie pool.

As to the question itself, no, I don't have a website to suggest. But if you have a good Java site you can answer the questions with a Pythonic view. You can, and should, build yourself a testing framework in which to test your answers to many (most?) of the questions to assure that you get what you expect, even if it is harder to test your style. For that, a critique by an expert would be most helpful, provided you can find someone.

$\endgroup$
1
  • $\begingroup$ Thank you for the detailed response, Dr. Buffy. I took a careful look at the courses offered at my university's computer science department, and it appears that data structure, algorithms, and databases are courses offered to sophomores and juniors. If possible, I will attempt to preview those subjects, which I think would be a wise thing to do before I challenge myself to a project of such scale. Thank you again for your response. $\endgroup$
    – J1J1P13
    Mar 24 at 15:40
2
$\begingroup$

I didn't spend a huge amount of time looking over the practiceit resource you linked, but I glanced at a few problems, and they seemed similar to http://codingbat.com, which has exercises in both Java and Python.

$\endgroup$
1
  • $\begingroup$ Thank you for the reply--I checked the website, and it seemed to be a useful tool..! $\endgroup$
    – J1J1P13
    Mar 22 at 9:08
2
$\begingroup$

Assuming that you have solved some of the problems in Java, you have an "oracle" for your python solution. Rework a problem in Python and compare the results of your two solutions. The advantage is that since you have a basic idea of an algorithm to solve the problem, you can concentrate more on how to express the algorithm in a different language. If the web site gives you both the test cases and expected results, you are half way there. If not, you may also need to add code for you to test your Java solution independently of the web site.

You will need a method of testing your python solution. Building the code necessary to test your solution and thinking up test cases is an incredibly valuable skill to learn. You might try rolling your own (learn how to use command line parameters) or learn to use one of the unit testing frameworks (search for python unit testing). In either case you will need to come up with test cases and feed them to your code. You can validate your python solution by comparing its result to the "oracle" result.

You may find that you are initially writing Java code in python. This is natural as one transitions between languages. Over time (and by code reading other python examples) you will find yourself thinking in python. You might also look at https://openbookproject.net/thinkcs/python/english3e/ and https://openbookproject.net/thinkcs/python/english3e/ which are two similar texts (viewable free online) that approach the same material in both Java and Python.

$\endgroup$
1
  • $\begingroup$ Actually, I recommend against this. Accept Python for what it is. Pretend you don't actually know Java when solving problems. $\endgroup$
    – Buffy
    Mar 22 at 16:17
1
$\begingroup$

Hackerrank has good basic programming questions

Codewars is great for having a sense of a group and have a healthy competition. The dashboard will show your score and ranking between friends and same institution.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.