From 265db1feeffa5700ce24bcc8a61af42cc992ea89 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Fri, 7 Apr 2017 19:20:00 -0400 Subject: [PATCH] user input --- python.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/python.md b/python.md index 38a23c8..16070f4 100644 --- a/python.md +++ b/python.md @@ -12,6 +12,7 @@ 1. Access an element of a list 1. Perform a set of commands depending on a situation 1. Repeatedly perform a set of commands +1. Get user input ## Print a message @@ -93,15 +94,10 @@ a = [ ] ``` -You can conceptualize an list of lists however you want +You can conceptualize a list of lists however you want + +**ACTIVITY: How would you change the previous example so that each inner list is a column?** -```python -a = [ - [1, 4, 7, 10], #first column - [2, 5, 8], #second column - [3, 6, 9], #third column -] -``` ## Access an element of a list Lists have elements stored at numerical indexes, starting at 0 @@ -149,3 +145,12 @@ while a < 20: print "the value of a is currently: " + str(a) a = a + 1 ``` + +## Get user input + +You can get user input from the command like so: + +```python +user_input = raw_input("Please enter something: ") +print "you entered: " + user_input +```