Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# CODEOWNERS: set the repository owners who should be requested for review
* @YOUR_GITHUB_USERNAME
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Bug report
about: Create a report to help us improve
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. ...
2. ...

**Expected behavior**
A clear and concise description of what you expected to happen.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for this project
---

**Is your feature request related to a problem? Please describe.**

**Describe the solution you'd like**

**Describe alternatives you've considered**
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Summary

Describe the change and why it was made.

## Checklist

- [ ] Tests added or updated
- [ ] Documentation updated as needed
30 changes: 30 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Python CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, 3.10, 3.11]

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run tests
run: |
pytest -q
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Create Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: "Automated release for ${{ github.ref_name }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
.venv/
venv/
ENV/
env/

# IDEs and system files
.vscode/
.idea/
.DS_Store
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

## Unreleased

- Initial repository cleanup: refactor scripts, add tests, CI, license.
7 changes: 7 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributor Covenant Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By
participating, you are expected to uphold this code. Please report
unacceptable behavior to the maintainers.

For the full text see: https://www.contributor-covenant.org/
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Thank you for considering contributing to this repository.

Guidelines
----------

- Open an issue to discuss larger changes before implementing them.
- Fork the repository and create a feature branch for your change.
- Keep changes small and focused; include tests for behavior changes.
- Run the test suite and ensure all checks pass before submitting a PR.

Running tests locally
---------------------

```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pytest
```
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Your Name

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
# basic-python-project
# hi frined,these project that i did it my self in python
# thanks for coming by!

Small collection of beginner Python utility scripts and exercises.

Badges
------

[![Python CI](https://github.com/ali-ezz/basic-python-project/actions/workflows/python-ci.yml/badge.svg)](https://github.com/ali-ezz/basic-python-project/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

Overview
--------

This repository contains a few small utilities:

- `from_roman_to_english.py` - convert Roman numerals to integers (`roman_to_int`).
- `max_number.py` - simple `find_max` helper.
- `number_to_words.py` - convert digits to spoken words.
- `roll_dice.py` - small `Dice` class that rolls six-sided dice.
- `sigma.py` - tiny example returning the string "sigma".
- `symbol_to_emoji.py` - map text emoticons to emoji characters.

Getting started
---------------

1. Create a virtual environment and activate it:

```bash
python -m venv .venv
source .venv/bin/activate
```

2. Install test dependencies:

```bash
pip install -r requirements.txt
```

Running tests
-------------

Run the test suite with:

```bash
pytest -q
```

Contributing
------------

See `CONTRIBUTING.md` for guidelines on submitting issues and pull requests.

License
-------

This project is licensed under the MIT License - see the `LICENSE` file for details.
74 changes: 33 additions & 41 deletions from_roman_to_english.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
count=0
i=0
s='XII'
while i<=len(s):
if 'CM' in s:
count+=900
s=s.replace("CM","")
elif 'IV' in s:
count+=4
s=s.replace("IV","")
elif 'IX' in s:
count+=9
s=s.replace("IX","")
elif 'XL' in s:
count+=40
s=s.replace("XL","")
elif 'XC' in s:
count+=90
s=s.replace("XC","")
elif 'CD' in s:
count+=400
s=s.replace("CD","")
i+=1
for item in s:
if item =='I':
count+=1
elif item =='V':
count+=5
elif item =='X':
count+=10
elif item =='L':
count+=50
elif item =='C':
count+=100
elif item =='D':
count+=500
elif item =='CM':
count+=400
elif item =='M':
count+=1000
print(count)
"""Utilities for converting Roman numerals to integers.

This module exposes a single function `roman_to_int` and a small
command-line entrypoint for quick manual use.
"""

from __future__ import annotations


def roman_to_int(s: str) -> int:
"""Convert a Roman numeral string to an integer.

Handles standard subtractive notation (IV, IX, XL, XC, CD, CM).
Non-Roman characters are ignored (treated as 0).
"""
values = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
total = 0
prev = 0
for ch in reversed(s.strip().upper()):
val = values.get(ch, 0)
if val < prev:
total -= val
else:
total += val
prev = val
return total


if __name__ == "__main__":
import sys

arg = sys.argv[1] if len(sys.argv) > 1 else "XII"
print(roman_to_int(arg))
25 changes: 20 additions & 5 deletions max_number.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
def find_max(numbers):
max=numbers[0]
"""Utilities for finding the maximum value in a list."""

from __future__ import annotations


def find_max(numbers: list) -> int:
"""Return the maximum value from a non-empty list of numbers.

Raises `ValueError` when `numbers` is empty.
"""
if not numbers:
raise ValueError("numbers must not be empty")
Comment on lines +11 to +12
max_val = numbers[0]
for num in numbers:
if max <= num:
max =num
print(f"the ma x number in the list is = {max}")
if num > max_val:
max_val = num
return max_val


if __name__ == "__main__":
print(find_max([3, 1, 4, 2]))
Loading
Loading