Learn Python with HackInScience
Written by Nikos Vaggalis   
Friday, 02 July 2021

HackInScience is a code challenge site that is mostly oriented towards learning than competing with others for a top ranking despite the presence of a Leaderboard. It's a playground of fun Python exercises, each with a user-friendly correction bot.

pythonexbanner

In order to showcase this, let's look at a simple exercise,"Characters counting" which requires writing code to "Print the number of characters in the given paragraph".

The screen is split into the vertical sections. The left side contains the description of what we ought to do in order to solve the challenge, as well as helpful advice, that is pointers to the things you should employ:

Advice
You'll need the len function, which can measure almost anything: lists, strings, …

If you feel lost, you should start by reading the string tutorial.

and a little tutorial on "How do functions work"

How do functions work

A function is a named thing, that take a value (or multiple ones), do something with it, and often give back another value.

A basic example would be the max function that take multiple values and give back the biggest one, the syntax is:

max(1, 5, 2)
and it would give back 5.

As such it prepares you to go and type the code in the center section of the screen,the Text editor, which is a in browser playground which compiles your code and gives you immediate feedback

print len(whetting_your_appetite)

File "./snippet.py", line 7
print len(whetting_your_appetite)
^
SyntaxError: invalid syntax

However the help when something goes wrong does not just confine itself in mere syntax errors, but through the use of friendly you get more context sensitive advice.For example in the for novices exercise Print 42, this is the message you get if you forget the parentheses:

However, the amount of the help and advice that is being offered varies from exercise to exercise. That said,the exercises are grouped into 5 logically divided sections of increasing difficulty:

1.Python — Basics

2.Python — Training

3.Python — Algorithms

4.Python — Command line

5.Python and Numpy

For instance you'll find exercises like: 

  • Print 42
  • Counting Words
  • Print sorbet flavors
  • Temperatures
  • Print every two letters pairs
  • Doing HTTP requests
  • Check if a number is prime
  • Flatten lists
  • Roman Numerals
  • Lambda expressions
  • Print the first parameter

 and so on.

The site is totally free and doesn't even require an email to create an account or for using it. However when you sign up you can then check other's peoples' solutions as well as participate in the ranking.

Check it out at https://www.hackinscience.org/

 hackinsciencesq

More Information

HackInScience

Related Articles

A Crash Course on Python By Google

YouTube Courses On C++, Python and Blazor

Fly Over the Moon With Microsoft And Python

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Introduction to Machine Learning with Scikit-Learn
14/07/2021

A free course on the fundamentals of Machine Learning with Python, taught by Kevin Markham founder of Data School, helps you ease your way into ML and scikit-learn, one of the best-known libraries for [ ... ]



GitLab 14 Offers DIY DevOps Alternative
28/06/2021

GitLab, the web-based repository manager for Git, has been updated with improvements designed to give teams an alternative to maintaining DIY DevOps chains. GitLab supports concurrent devops and issue [ ... ]


More News

square

 



 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Friday, 02 July 2021 )