pimento[~]$ atom requestChar.py pimento[~]$ python3 requestChar.py main pimento[~]$ python3 requestChar.py Enter a string: bee bop bee bop pimento[~]$ python3 requestChar.py Enter a string: bee bop First character: b pimento[~]$ python3 requestChar.py Enter a string: banana First character: b pimento[~]$ python3 requestChar.py Enter a string: bee bop First character: b Traceback (most recent call last): File "requestChar.py", line 12, in main() File "requestChar.py", line 10, in main lastCharacter = string[lengthOfString] NameError: name 'lengthOfString' is not defined pimento[~]$ python3 requestChar.py Enter a string: bee bop First character: b Traceback (most recent call last): File "requestChar.py", line 12, in main() File "requestChar.py", line 10, in main lastCharacter = string[lengthOfString] IndexError: string index out of range pimento[~]$ python3 requestChar.py Enter a string: bee bop First character: b pimento[~]$ python3 requestChar.py Enter a string: bee bop First character: b Last character: p pimento[~]$ python3 requestChar.py Enter a string: bee bop First character: b Middle character: Last character: p pimento[~]$ python3 requestChar.py Enter a string: dasaryu@!!@@#%!$%&*(^!%&*) First character: d Middle character: % Last character: ) pimento[~]$ python3 stringLoop.py pimento[~]$ python3 stringLoop.py Enter a string: hello Enter a number of times: 3 hello hello hello pimento[~]$ python3 charLoop.py pimento[~]$ python3 charLoop.py Enter a string: hello h e l l o pimento[~]$ python3 charLoop.py Enter a string: hello h he hel hell hello pimento[~]$ python3 Python 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> greeting = "hello" >>> "The greeting is %s"%(greeting) 'The greeting is hello' >>> name = "billy" >>> "The greeting is %s, %s"%(greeting, name) 'The greeting is hello, billy' >>> "The greeting is %s, %s"%(name, greeting) 'The greeting is billy, hello' >>> num= 30 >>> "The greeting is %s, %s. The cost is %d"%(name, greeting, num) 'The greeting is billy, hello. The cost is 30' >>> "The greeting is %s, %s. The cost is %d"%(name, num, greeting) Traceback (most recent call last): File "", line 1, in TypeError: %d format: a number is required, not str >>> "The greeting is %s, %s. The cost is %20d"%(name, greeting, num) 'The greeting is billy, hello. The cost is 30' >>> "The greeting is %s, %s. The cost is %-20d"%(name, greeting, num) 'The greeting is billy, hello. The cost is 30 ' >>> "The greeting is %s, %s. The cost is %2d. Float example %2f"%(name, greeting, num, 2/3) 'The greeting is billy, hello. The cost is 30. Float example 0.666667' >>> "The greeting is %s, %s. The cost is %4d. Float example %4f"%(name, greeting, num, 2/3) 'The greeting is billy, hello. The cost is 30. Float example 0.666667' >>> "The greeting is %s, %s. The cost is %4d. Float example %4.2f"%(name, greeting, num, 2/3) 'The greeting is billy, hello. The cost is 30. Float example 0.67' >>>