# CS 101 Lab: Week # 2 <ul class="pager"> <li><a href="../w01/">← Previous lab</a></li> <li><a href="../w03/">Next lab →</a></li> </ul> It is planned to cover the following during the second week CS101 lab. --- ## Outline: 1. [Video](https://www.youtube.com/watch?v=4eNTlwnnhss) about basic components of computer ([local link](Computer_Basics__Inside_a_Desktop_Computer.mp4)), 2. Opening the desktop to physically show the different components of classic desktop. More details here on [www.gcfLearnFree.org/computerbasics/5](http://www.gcflearnfree.org/computerbasics/5.2), 3. Introduction to variables (numbers, strings) with the syntax: `year = 2015`, 4. Getting numbers and strings as input from users (`raw_input`, `input`), 5. Programs to calculate area of rectangle, square and triangle, 6. How to access (and why you should do it) the *Python* [help](https://docs.python.org/2/) and documentation with [*Spyder IDE*](https://pythonhosted.org/spyder/)? 7. Introduction to [**Variable Explorer**](https://pythonhosted.org/spyder/variableexplorer.html) and [**File Explorer**](https://pythonhosted.org/spyder/explorer.html) in *Spyder IDE*, representation of the "*internal*" memory (live memory), 8. **Homework:** Read these 2 pages on the Python documentation: [appetite](https://docs.python.org/2/tutorial/appetite.html) and [tutorial](https://docs.python.org/2/tutorial/introduction.html#strings) (about strings). --- ### Example program (for the square) ```python # -*- coding: utf8 -*- print "Computing the area of a square:" size = input("Enter the size (in meter) of the side of your square please: ") area = size * size # also possible with: size ** 2 print "That square has size", area, "m²." ``` --- ### Example program (for the rectangle) ```python # -*- coding: utf8 -*- print "Computing the area of a rectangle:" width = input("Enter the first side (in meter) of your rectangle please: ") height = input("Enter the first side (in meter) of your rectangle please: ") area = width * height print "That rectangle has size", area, "m²." ``` --- <ul class="pager"> <li class="previous"><a href="../w01/">← Previous lab</a></li> <li class="next"><a href="../w03/">Next lab →</a></li> </ul>