diff --git a/Screenshot 2024-02-17 000702.png b/Screenshot 2024-02-17 000702.png new file mode 100644 index 0000000..b3fb5bb Binary files /dev/null and b/Screenshot 2024-02-17 000702.png differ diff --git a/readme.md b/readme.md deleted file mode 100644 index 5c8059c..0000000 --- a/readme.md +++ /dev/null @@ -1,157 +0,0 @@ -# Level 1 Task 1: Print a Staircase - -## Overview - -This is a simple program that prints a Staircase of a given size. - -## Learning Objectives - -- Basic Python syntax -- Using loops -- Using functions - -## Resources - -### Online Resources - -#### Github - -- [Git and Github](https://www.youtube.com/watch?v=tRZGeaHPoaw) -- [Git Tutorial (w3schools.com)](https://www.w3schools.com/git/default.asp) -- [How to Use Git and GitHub – Introduction for Beginners (freecodecamp.org)](https://www.freecodecamp.org/news/introduction-to-git-and-github/) -- [Learn Git Branching](https://learngitbranching.js.org/) (Interactive tutorial) -- [Git - Basic Branching and Merging (git-scm.com)](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging) -- [Pull Requests in VS Code - YouTube](https://www.youtube.com/watch?v=LdSwWxVzUpo) - -#### Python - -- [Python Tutorial (w3schools.com)](https://www.w3schools.com/python/default.asp) -- [Python Video](https://www.youtube.com/watch?v=lk2rWa4iM68) -- [Python for Beginners (freecodecamp.org)](https://www.freecodecamp.org/news/ultimate-beginners-python-course/) - -## Setup and Tutorial - -You will find the github part of this tutorial [here](https://github.com/Programming-Club-IAU/git-and-github) - -### 1. Setup - -#### 1.1: Install Python (not needed if you have a mac) - -- Download Python from [here](https://www.python.org/downloads/) -- Install Python -- Open a terminal and type `python --version` to check if Python is installed - -#### 1.2: Install a Text Editor - -- You can use any text editor you like, but I recommend using [Visual Studio Code](https://code.visualstudio.com/) -- Download and install Visual Studio Code -- Open Visual Studio Code and install the Python extension - -### 2. Tutorial - -#### 2.1: Creating a new Python file - -- Open Visual Studio Code -- Click on the "Explorer" icon on the left -- Click on the "New File" icon -- Save the file as `square.py` - -#### 2.2: Basic Python - -- Type the following code in `square.py`: - -```python -print("Hello, World!") -``` - -- Open a terminal and navigate to the folder where `square.py` is located -- Type `python square.py` to run the program -- You should see `Hello, World!` printed in the terminal - -#### 2.3: Using Loops - -- Type the following code in `square.py`: - -```python -for i in range(5): - print("Hello") -``` - -- Run the program again -- You should see `Hello` printed 5 times in the terminal - -#### 2.4: Using Functions - -- Type the following code in `square.py`: - -```python -def print_hello(size): - for i in range(size): - print("hello") - -print_hello(5) -``` - -- Run the program again -- You should see `Hello` printed 5 times in the terminal - -#### 2.5: Getting Input from the User - -- Type the following code in `square.py`: - -```python -def print_hello(size): - for i in range(size): - print("hello") - -size = int(input("Enter the size of the square: ")) -print_hello(size) -``` - -- Run the program again -- You should see `Hello` printed X times in the terminal -- Replace `X` with the number you entered -- If you entered `5`, you should see `Hello` printed 5 times in the terminal - -## Project Overview - -Your task is to write a program that prints a Staircase of a given size. The program should take the size of the Staircase as input from the user and print the Staircase accordingly. - -### Requirements - -- The program should take the size of the Staircase as input from the user -- The program should print a Staircase of the given size - -Example: -```bash -* -** -*** -**** -***** -``` - -- The program should use a function to print the Staircase -- The program should use loops to print the Staircase -- The program should be written in Python - -### Bonus - -- The program should print both sides of the staircase. - -Example: -```bash - * * - ** ** - *** *** - **** **** -***** ***** -``` - -## Submission Guidelines - -- The app should be pushed to Github and a pull request should be created. You can check how to push your code to Github in section [2.1.2 Add Changes](https://github.com/Programming-Club-IAU/git-and-github#212-add-changes). -- The pull request title should be in the following format: ` - `. You can check how to make a pull request in section [2.1.5. Create a pull request](ttps://github.com/Programming-Club-IAU/git-and-github#215-create-a-pull-request). -- The pull request description should contain the following: - - A description of the changes made. - - A screenshot of the app running in the terminal. diff --git a/task1cst.py b/task1cst.py new file mode 100644 index 0000000..154d610 --- /dev/null +++ b/task1cst.py @@ -0,0 +1,15 @@ +def staircase(size): + for i in range(size): + for j in range((size-i)+1): + print(" ",end="") + for j in range(i+1): + print("*",end="") + + print(" ",end="") + + for j in range(i + 1): + print("*", end="") + print() + +size=int(input("what is size of the stair ?")) +staircase(size) \ No newline at end of file