Problem Solving With Python: Program 0

The problem statement:

The task is to write a Python program that displays a list of numbers from 4 to 9. Next to each number, the program will also display its square. The square of a number is computed by multiplying it with itself like so. 4 x 4 = 16. Here, 16 is the square of 4.

The following is the expected approximate output of program 0:

    4 16
    5 25
    6 36
    7 49
    8 64
    9 81

The Solution:

def program_0():
    number = 4
    print(number, number * number)

    number = 5
    print(number, number * number)

    number = 6
    print(number, number * number)

    number = 7
    print(number, number * number)

    number = 8
    print(number, number * number)

    number = 9
    print(number, number * number)

if __name__ == '__main__':

How do I setup?

Follow the steps at this link to get started. When following the instructions assume that your machine does not already have Python installed so that you follow the instructions for downloading Python and making sure you install version 3.10. Ignore the details of the program in this example and instead focus on running the program in their example.

How do I run the program?

Running the code. If you followed the steps from the setup section than you should now how to create a file and run a Python program in Python. In your python project create a module (file) called Type the code in this file as shown and run the program. If your setup was successful then the Python interpreter should have run your program that generates some output within PyCharm.

What is a code interpreter?

The Python Interpreter is a program that reads and execute Python code. In order for the interpreter to be able to do its job, the program that we write must follow a set of rules. Code indentation is one of these rules. Violation if this or any programming rules will result in a program that does not execute or, even worse, a program that executes incorrectly.

What is a variable?

A variable is a name for a physical location within the computer that can reference either a single piece of data like a number or a character or data structures that can hold multiple pieces of data. In our program we define the variable number that holds a single number. As the name implies, a variable can be changes by our program as it is running. Our program first defines this variable number by assigning the number 4 to it. Our program then changes the value that our variable is referencing with the use of the assignment operator.

Why use a variable at all? 

Variables will allow us to write code that is concise, descriptive and reusable. The importance of these ideas will become more evident as we write programs with increasing complexity.

What is an assignment operator?

The assignment operator, denoted by =, is used to assign a value to variables. The following is a general form of an Assignment Statement.

variable_name = expression

What are Python Keywords? 

Python keywords are reserved words that should not be used except for its explicitly defined usage. The keywords used in this program are the following.

  1. def is used to define the start of a function.
  2. if is used to test a condition. In our case it is used to test if the variable __name__ is equal to the string __main__. If it is then the next indented lines are executed by the interpreter. In our case, our function, program_0() is executed, resulting in an output that is generated by our program.

What is a function? 

A function is a building block of a program; they are used to define code that is reusable and can be called anywhere within your program. Note how we first write our display logic in def program_0()... then further down we call it. Suppose we wanted to display the same values again immediately below the first program output. This can be accomplished in one of two ways. We can either modify our program to display the values twice or simply call our program immediately following the first call like so.

if __name__ == '__main__':

Hence, code reuse!

What is a built-in function?

Python is shipped with many standard built in functions. Our program the built-in print(...) function to display our values to the monitor. We can pass any number of variables to the print function with the use of a comma. The print function will display the variables passed to it by inserting a single space between them. The print function will also add to the end a newline character so that the display system will print the next values on a new line.

Page with links to the entire series can be found here

Are you having any issues running or understanding the program? Please, add a comment explaining where you are stuck or where the tutorial is not clear so we can improve it.

Obtain a Student Visa to Study in the USA (PART 2)

Part Two:

This is our second post in our obtaining a student visa to study in the USA series. Your can read our first post here.

What is the Form I-20 and How to Receive it?

All F-1 visa category (and M-1) students that study in the USA need a Form I-20, "Certificate of Eligibility for Nonimmigrant Student Status". Once accepted into a Student and Exchange Visitor Program, international students will receive a Form I-20 from their designated school official (DSO). This will be one of the important Forms that you as the student should keep that safe as you will need it throughout your international student life.

Process to Obtain an I-20:
  1. Receive an I-20 application from the School via Email.
  2. Complete, Print, and Sign the application. 
  3. Recent Bank Statements from you or your sponsors showing that you are financially able to pay your school tuition, fees and life expenses for the years you plan on attending the school.
  4. Send a copy of your valid passport along with completed and signed I-20 application, and financial documents to designated school office (DSO) at the school you will be attending via Email.

Obtain a Student Visa to Study in the USA

Are you interested in knowing how to obtain a student visa in order to study at a university in the USA? If so then read about the steps I took in obtaining a student visa in order to study at the one of the largest public universities in America, The City University of New York (CUNY).

This post is a bit unusual in the sense that we typically don't cover non-tech related stuff on this blog but given my experience in this area I thought that this might benefit our readers. So, in this and upcoming posts I will walk you through the step by step process of applying for a student visa, entering into the USA, and give you some pointers on what to do during and after your studies are complete and you've earned a degree.

How to Setup Angular CLI

Angular is one of the third top front-end frameworks in 2020. Angular is a TypeScript-based open-source web application framework led by the Angular Team at Google.

In this tutorial we are going to show you a step by step guide to setting up your environment for Angular development and a simple hello-world application.

Wikileaks Vault 7: CIA Tips for Git Workflow

Wikileaks has begun dumping a large number of files on the CIA's hacking tools. The dump is called Vault 7. It is a goldmine, not only for information about the CIA's activities, but also for information on things like how to set up a development environment or properly use Git in your everyday programming workflow. Here are a couple highlights from some cursory searches of the document dump:

CIA Git Tutorials

CIA Vim Tutorials

CIA Setting Up a Development Environment

Hide My IP Address: How to Browse a Website without Visiting It

In this article, we'll provide a few tips and tricks on how to use a couple simple advanced web searches to browse a website without actually visiting the target site, effectively remaining invisible to the site's proprietors. Maybe the website is blocked on the computer you are using. Maybe the site seems somewhat sketchy and you want to check it out before you actually visit it. Maybe you want to read some content on the site, while depriving them of your own web traffic. Maybe you don't want the site's proprietors to know your IP address. Whatever the case may be, if you have access to Google, you may very well be able to see the content you are looking for without ever connecting to the site in question.

County Government Computer System Taken Over by Ransomware

From The Newark Advocate:
A computer virus discovered late Tuesday night caused Licking County government to shut down its computers and phone systems indefinitely to prevent the virus from spreading, protect data and preserve evidence. The FBI and Bureau of Criminal Investigation have been notified. 
The virus, accompanied by a financial demand, is labeled ransomware, which has hit several local governments in Ohio and was the subject of a warning from the state auditor last summer.