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.


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:

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/


More Information


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.


A Programming Career - Insights From JetBrains

Why did  you choose to become a software developer? Did you switch from another career field? What aspects of your job are the most important? And do you code on weekends? See how your answers re [ ... ]

Google Summer of Code Turns 20 In 2024

The application window for Open Source organizations to be involved in the 2024 GSoC is now open with a deadline of February 6. This year Google is looking to bring more open source projects in the AI [ ... ]

More News

raspberry pi books



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

Last Updated ( Friday, 02 July 2021 )