Skip to main content

Practice with exbook Package

The package exbook is used for practicing basic Python programming. So far there are totally 36 questions with different difficulty levels. For the purpose of practicing, you are recommended to only use basic built-in functions like find(), min(), max() and sum(). Imported packages or more advanced functions or methods, such as sort(), argmin(), or split() should be avoided.

Steps of running exbook

Step 1: import the exercise book

from exbook import book as eb

len(eb)
36

The variable eb is a tuple containing 36 questions.

Step 2: print questions

Each question can be retrieved by the corresponding indices, and can be printed by the function print().

print(eb[0])        # Print the first question
Define a function with two strings to be the input arguments. The output is 
the summation of the numerical values of the input strings. For example, if 
the input strings are "3.5"and "2.7", then the output is 6.2, as a floating
point number.
Input1: str Input2: str Output: float
Test 1: 3.5 2.7 6.2

Data Type Conversion: Easy

The printed question information includes: 1) the description of the question; 2) sample inputs and outputs; and 3) the ID and difficulty level of the question.

Step 3: write a function to solve the question

def dtc(string1, string2):
    
    return float(string1) + float(string2)

Step 4: check the correctness of the question

The exbook package checks the correctness of the user-defined functions by a number of hidden tests. These tests can be run by the method check().

eb[0].check(dtc)
You passed 3 of the 3 tests. 
The solution is correct

In case you want to know what is wrong with the tests, you may specify the argument cheat=True to show the results of these hidden tests.

eb[0].check(dtc, cheat=True)
Input 1: str Input 2: str Your output Correct output: float Correct
Test 1: 3.5 2.7 6.2 6.2 True
Test 2: 1.2 5 6.2 6.2 True
Test 3: 2 4 6.0 6 True
You passed 3 of the 3 tests. 
The solution is correct

Metadata

Release files for exbook 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for exbook 0.0.5
File Size Uploaded Provenance Actions
exbook-0.0.5.tar.gz 11.6 kB Without provenance Details for exbook-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for exbook 0.0.5
File Interpreter ABI Platform Actions
exbook-0.0.5-py3-none-any.whl Python 3 none any Details for exbook-0.0.5-py3-none-any.whl

Total release size: 22.6 kB

Release files / exbook-0.0.5.tar.gz

Download URL exbook-0.0.5.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e4c40ba01c6f48feda3fdda265a12132bcc5a8490d2863bc53c7b48f610fd704
BLAKE2b-256 checksum
How to use checksums
cd6221b1f7742461733fb78993affc642fdd6db1232380bdf9b58f95fe0af640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.7

Release files / exbook-0.0.5-py3-none-any.whl

Download URL exbook-0.0.5-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d052792d6928ebb627bf4524cad59cbac41993024ba2b47ef3e78167e758398
BLAKE2b-256 checksum
How to use checksums
6f10bb3140978602ad8ff33dbb93d5f10d9653697e1500003d74c39fe0dd2f56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.7

Security for exbook 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page