Skip to content
Snippets Groups Projects
Commit 2878d473 authored by cprutean's avatar cprutean
Browse files

Update file CodeExamples.ipynb

parent 21280ba9
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:52c89cc7 tags:
# Code Examples
The code examples are grouped together along certain themes. They can all be accessed below:
- ## Conditionals
Set of examples to demonstrate conditional statements (if elif else).
Take these and work / modify them and explore what happens:
> [OneWayConditional](OneWayConditional.ipynb): Simple one way (if) conditional.
> [TwoWayConditional](TwoWayConditional.ipynb): Simple two way (if else) conditional
> [TwoWayConditional](TwoWayConditional.ipynb): Simple two way (if else) conditional.
> [RootTwo](RootTwo.ipynb): Simply math.sqrt(x)**2 = x test to show the dangers of using test on floats; also the solution.
> [ThreeWayConditional](ThreeWayConditional.ipynb): Basic if elfi else structure, look at this carefully and understand it.
> [ComplexQuadrant](ComplexQuadrant.ipynb): Determine the quadrant of a complex numbers with a conditional chain in a function with multiple return options.
> [InsideSphere](InsideSphere.ipynb): Two way conditional in function and main program to test if a point is within a sphere.
> [FunctionCall](FunctionCall.ipynb): Example with function calls if conditional tests, a bit tricky, but important concepts here.
- ## File
Set of examples for reading and writing to simple text file.
> [ReadTextFile](ReadTextFile.ipynb): Read a text file and print out again (discussed "\n" problem with print()).
> [WriteFile](WriteFile.ipynb): Writes a bit of text (and culture) to a file. (this write / overwrites "burns.txt").
> [RangeLooptoFile](RangeLooptoFile.ipynb): Write data to a file from a a loop.
> [RangeLooptoFile](RangeLooptoFile.ipynb): Write data to a file from a loop.
> [LineCount](LineCount.ipynb): Open a file and countv the number of lines (with error trap for wrong filename).
> [ImageShow](ImageShow.ipynb): Read and display an image file using Matplotlib.
Data supplied
> burns.txt A bit of culture !!!
> cosdata.txt Output from RangeLooptoFile.py
> sample.txt Data for Checkpoint 4
> stones.jpg Stones on Scottish beach
> [burns.txt](burns.txt): A bit of culture !!!
> [cosdata.txt](cosdata.txt): Output from RangeLooptoFile.py
> [sample.txt](sample.txt): Data for [Checkpoint 4](../Checkpoints/Checkpoint4.ipynb).
> [stones.jpg](stones.jpg): Stones on Scottish beach.
- ## Format
Example Python programs to show formatted output.
> [FloatFormat](FloatFormat.ipynb): Example of formatting floats with .format()
> [IntegerFormat](IntegerFormat.ipynb): Example of specifying and printing int in various bases.
- ## Functions
- Format
- Functions
- Further Functions
- Getting Started
- Lists
- Loops
- Maths
- MoreComplex
- Objects
- Plotting
- Scope
Index of all code examples:
- [AppendFunction](AppendFunction.ipynb)
- [ComplexQuadrant](ComplexQuadrant.ipynb)
- [CosPlot](CosPlot.ipynb)
- [Ellipse](Ellipse.ipynb)
- [ExtractSublist](ExtractSublist.ipynb)
- [FlightPlot](FlightPlot.ipynb)
- [FloatFormat](FloatFormat.ipynb)
- [FunctionCall](FunctionCall.ipynb)
- [FunctionPlot](FunctionPlot.ipynb)
- [GaussianNoisePlot](GaussianNoisePlot.ipynb)
- [GuessGame](GuessGame.ipynb)
- [Hello](Hello.ipynb)
- [ImageShow](ImageShow.ipynb)
- [InsideSphere](InsideSphere.ipynb)
- [IntegerFormat](IntegerFormat.ipynb)
- [LineCount](LineCount.ipynb)
- [MakeandAppendList](MakeandAppendList.ipynb)
- [OneWayConditional](OneWayConditional.ipynb)
- [PiExample](PiExample.ipynb)
- [PlanckPlot](PlanckPlot.ipynb)
- [PrintList](PrintList.ipynb)
- [QuadraticFunction](QuadraticFunction.ipynb)
- [QuadraticPlot](QuadraticPlot.ipynb)
- [RangeLoop.ipynb](RangeLoop.ipynb)
- [RangeLooptoFile](RangeLooptoFile.ipynb)
- [RangeLooptoList](RangeLooptoList.ipynb)
- [ReadScope](ReadScope.ipynb)
- [ReadTextFile](ReadTextFile.ipynb)
- [ReadingIntandFloat](ReadingIntandFloat.ipynb)
- [ReadingIntandFloatMain](ReadingIntandFloatMain.ipynb)
- [ReadingandFormatFloats](ReadingandFormatFloats.ipynb)
- [ReadingandFormatFloatsMain](ReadingandFormatFloatsMain.ipynb)
- [ReadingandPrintingFloats](ReadingandPrintingFloats.ipynb)
- [ReadingandPrintingFloatsMain](ReadingandPrintingFloatsMain.ipynb)
- [ReadingandPrintingStrings](ReadingandPrintingStrings.ipynb)
- [ReadingandPrintingStringsMain](ReadingandPrintingStringsMain.ipynb)
- [RootTwo](RootTwo.ipynb)
- [SimpleEllipse](SimpleEllipse.ipynb)
- [SortFunction](SortFunction.ipynb)
- [SphereVolume](SphereVolume.ipynb)
- [TemperatureConverter](TemperatureConverter.ipynb)
- [ThreeWayConditional](ThreeWayConditional.ipynb)
- [TwoWayConditional](TwoWayConditional.ipynb)
- [Vector](Vector.ipynb)
- [WhileLooptoList](WhileLooptoList.ipynb)
- [WriteFile](WriteFile.ipynb)
%% Cell type:code id:6b3360a6 tags:
``` python
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment