This is a simple program that prints a Staircase of a given size.
- Basic Python syntax
- Using loops
- Using functions
- Git and Github
- Git Tutorial (w3schools.com)
- How to Use Git and GitHub – Introduction for Beginners (freecodecamp.org)
- Learn Git Branching (Interactive tutorial)
- Git - Basic Branching and Merging (git-scm.com)
- Pull Requests in VS Code - YouTube
You will find the github part of this tutorial here
- Download Python from here
- Install Python
- Open a terminal and type
python --versionto check if Python is installed
- You can use any text editor you like, but I recommend using Visual Studio Code
- Download and install Visual Studio Code
- Open Visual Studio Code and install the Python extension
- Open Visual Studio Code
- Click on the "Explorer" icon on the left
- Click on the "New File" icon
- Save the file as
square.py
- Type the following code in
square.py:
print("Hello, World!")- Open a terminal and navigate to the folder where
square.pyis located - Type
python square.pyto run the program - You should see
Hello, World!printed in the terminal
- Type the following code in
square.py:
for i in range(5):
print("Hello")- Run the program again
- You should see
Helloprinted 5 times in the terminal
- Type the following code in
square.py:
def print_hello(size):
for i in range(size):
print("hello")
print_hello(5)- Run the program again
- You should see
Helloprinted 5 times in the terminal
- Type the following code in
square.py:
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
Helloprinted X times in the terminal - Replace
Xwith the number you entered - If you entered
5, you should seeHelloprinted 5 times in the terminal
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.
- 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:
*
**
***
****
*****- 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
- The program should print both sides of the staircase.
Example:
* *
** **
*** ***
**** ****
***** *****- 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.
- The pull request title should be in the following format:
<your-name> - <project-name>. You can check how to make a pull request in section 2.1.5. 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.