User Tools

Site Tools


competitive_programming:linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
competitive_programming:linux [2018/08/13 16:15]
jguerin Added examples related to Python interpreter, some ideas to cover in later sections.
competitive_programming:linux [2018/08/15 10:48] (current)
jguerin Moved Python section down to deemphasize it.
Line 4: Line 4:
 This section assumes a basic working knowledge of Unix development including the use of an command-line editor (e.g., [[https://www.gnu.org/software/emacs/tour/|Emacs]], Vim), basic Unix commands and utilities (e.g., ls, cd, man), and development toolchains (g++, Python3, Make). This section assumes a basic working knowledge of Unix development including the use of an command-line editor (e.g., [[https://www.gnu.org/software/emacs/tour/|Emacs]], Vim), basic Unix commands and utilities (e.g., ls, cd, man), and development toolchains (g++, Python3, Make).
  
-===== Python3 Extras ===== 
-==== Interactive Interpreter ==== 
-The Python3 interactive interpreter (typically invoked with ''python3'' on the command line) allows for the entry of arbitrary Python3 commands, making it a great calculator and a great place to test simple ideas. 
  
-==== Interactive Interpreter: Loops ==== +===== Pipes and Redirects ===== 
-<code python> +Pipes ''|'' and redirects ''>'' are common tools for creating basic workflows by manipulating input and output of programs and files or streamsLike many  
->>> from math import * + 
->>> for i in range(10): +In order to illustrate the use of pipes and redirectsconsider the following  
-...  print(int(log(2**i, 10))+1end=' ') # single space before the print() to simulate indentation + 
-...                                       # additional lines in the loop here or <returnto end +===== Command Line Utilities ===== 
-1 1 1 1 2 2 2 3 3 3 >>>+<code
 +time
 </code> </code>
  
-The above fragment computes powers of two, and then uses the decimal logarithm to compute the number of digits in each power.+<code> 
 +wc 
 +</code>
  
-This can be extended to basic nested structures. +<code> 
-<code python+man
->>> for i in range(3): +
-...  for j in range(3):             # preceded by a single space +
-...   print(i, j, sep=',', end=" ") # preceded by two spaces +
-...                                 # single <return> keystroke +
-0,0 0,1 0,2 1,0 1,1 1,2 2,0 2,1 2,2 >>>+
 </code> </code>
  
-If you are looking to do anything more complicated, it is likely that you should create a temporary '''.py''' file.+===== Bash Scripts =====
  
-==== Interactive Interpreter: Importing Files ==== +===== Python3 Command-Line Arguments =====
-The ''import'' statement can be used to import arbitrary Python3 files, which can be useful for quick unit tests (and doesn't require further file manipulation to drive tests).+
  
 Consider the Python code: Consider the Python code:
Line 46: Line 40:
 </code> </code>
  
-===== Pipes and Redirects ===== 
-Pipes ''|'' and redirects ''>'' are common tools for creating basic workflows by manipulating input and output of programs and files or streams. Like many  
- 
-In order to illustrate the use of pipes and redirects, consider the following  
- 
-===== Command Line Utilities ===== 
-<code> 
-time 
-</code> 
- 
-<code> 
-wc 
-</code> 
- 
-<code> 
-man 
-</code> 
  
 ===== Additional Resources ===== ===== Additional Resources =====
Line 77: Line 54:
 /tmp/ /tmp/
 </code> </code>
 +
 +
 +
  
competitive_programming/linux.1534194919.txt.gz · Last modified: 2018/08/13 16:15 by jguerin