Think - A language for learning computational thinking
Project description
Think
Think is an educational programming language designed to teach computational thinking through problem decomposition. It helps users break down complex problems into manageable parts while providing interactive feedback and explanations.
Features
- Structured Problem Solving: Break down problems into objectives, tasks, subtasks, and steps
- Interactive Execution: Run your code and see results in real-time
- Explain Mode: Get detailed explanations of what each part of your code does
- Jupyter Integration: Use ThinkPy directly in Jupyter notebooks
- Educational Focus: Learn computational thinking concepts through hands-on coding
Installation
# Clone the repository
git clone https://github.com/yourusername/think.git
cd think
# Install the package
pip install -e .
Quick Start
Here's a simple ThinkPy program that calculates student grades:
objective "Calculate student grades"
task "Data Collection":
step "Get scores":
scores = [85, 92, 78, 90, 88]
task "Analysis":
subtask "Calculate Average":
total = sum(scores)
avg = total / len(scores)
return avg
step "Determine Grade":
final_score = Calculate_Average()
decide:
if final_score >= 90 then:
grade = "A"
elif final_score >= 80 then:
grade = "B"
else:
grade = "C"
run "Data Collection"
run "Analysis"
Language Structure
Core Concepts
-
Objective: The main goal of your program
objective "Your goal here"
-
Task: Major components of your solution
task "Task Name": # steps or subtasks
-
Subtask: Reusable pieces of code
subtask "Subtask Name": # statements return result
-
Step: Specific actions
step "Step Name": # statements
Control Flow
-
Decide (If/Else):
decide: if condition then: # statements elif another_condition then: # statements else: # statements
-
Loopd:
for num in numbers: # statements end for index, value in enumerate(items): print(index, value) end for _, value in enumerate(items): print(value) end
Data Types
- Numbers:
42,3.14 - Strings:
"Hello, World!" - Lists:
[1, 2, 3, 4, 5] - Variables:
score = 85 - Dictionaries `{'key': 'value'}
Jupyter Notebook Usage
-
Load the ThinkPy extension:
%load_ext thinkpy.jupyter_magic
-
Write ThinkPy code in cells:
%%thinkpy --explain objective "Your program objective" # ... rest of your code
Built-in Functions
sum(list): Calculate the sum of a listlen(list): Get the length of a listprint(value): Display a value
Examples
Temperature Analysis
objective "Analyze temperature data"
task "Data Collection":
step "Get readings":
temps = [72, 75, 68, 70, 73]
task "Analysis":
subtask "Calculate Average":
total = sum(temps)
avg = total / len(temps)
return avg
subtask "Find High":
max_temp = temps[0]
for index, value in enumerate(temps):
decide:
if temps[index] > max_temp then:
max_temp = temps[index]
end
return max_temp
run "Data Collection"
run "Analysis"
Grade Calculator
objective "Calculate final grades"
task "Setup":
step "Initialize data":
scores = [85, 92, 78]
weights = [0.3, 0.4, 0.3]
task "Calculate":
subtask "Weighted Average":
total = 0
for index in range(3):
total = total + (scores[index] * weights[index])
end
return total
run "Setup"
run "Calculate"
Development
Running Tests
python -m pytest tests/
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to all contributors to this project
- Inspired by Python and educational programming concepts
- Built with PLY (Python Lex-Yacc)
Support
For support, feature requests, or bug reports:
- Check the documentation
- Open an issue on GitHub
- Contact the maintainers
Made with ❤️ for teaching computational thinking
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file think_lang-0.1.9.tar.gz.
File metadata
- Download URL: think_lang-0.1.9.tar.gz
- Upload date:
- Size: 30.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a0fbb631ff06f9e77648cc56a7d8e33e42d8f2a2dbed5b87387438d5433d8a5
|
|
| MD5 |
51bdabdbcc6255d42c013b926bb5cb24
|
|
| BLAKE2b-256 |
88810bc0c40a0a420e6c67ebf30d32caf004a3ded0d1be94421be43f094a0bcb
|
File details
Details for the file think_lang-0.1.9-py3-none-any.whl.
File metadata
- Download URL: think_lang-0.1.9-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ef83fb76d01ce77077946038294c7a4ea32222b5dc20b0e0710fa4b03d8cbaa
|
|
| MD5 |
c5e5f501109b7f07ec298eaced59fd88
|
|
| BLAKE2b-256 |
953a776b6c72f12dcd761c7146fcb8ad0be198c6547b8cbe91eff0c8a7144c68
|