Skip to content

Programming-Club-IAU/Level-1.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

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

Python

Setup and Tutorial

You will find the github part of this tutorial here

1. Setup

1.1: Install Python (not needed if you have a mac)

  • Download Python from here
  • 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
  • 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:
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:
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:
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:
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:

*
**
***
****
*****
  • 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:

    * *
   ** **
  *** ***
 **** ****
***** *****

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.
  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors