Sunday, January 29, 2017

How to run a code in terminal

Save the python code and name it in some folder on your desktop.
Go to terminal, go to shell in the toolbar and then click on import
Import the code you want to run
To import code:
cd location of file (i.e. desktop, documents, photos)
cd the name of the folder your file is in
 
python file.py

Then run that code in terminal (you can run some codes directly from IDLE however it's easiest to just run from terminal)
Save that code in terminal into the same folder you saved the python code in
Open the folder, double click on the code from terminal
It should open up in a tab on safari or google chrome whichever is in your settings

https://en.wikibooks.org/wiki/Python_Programming/Creating_Python_Programs

Issues:
I keep getting up to the point where I import the direct file, however for some reason it keeps saying invalid syntax. I do not know why this keeps happening.

Monday, January 23, 2017

Biopython beginner coding

Right now I am struggling with allowing for user input to be directly placed into the code.
So this would print "hello parv" if I input my name. However, with me for some reason whenever I try to code this it just prints hello and doesn't take my input into account. I've looked at a few different tutorials for coding for inputs and every time I try it on IDLE, it doesn't work.
http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/io.html
Also, for some reason, I cannot import any modules. The website I look at for instruction which is directly from the python creators says you just write the keyword import followed by whatever you want to import. However, for some reason, it doesn't recognize the module I am trying to import, it seems like the IDLE program I am using to code is not attached to the python database.
https://docs.python.org/3/reference/import.html
I am starting to think that before I import a module I need to download it. However, now the issue is to find where I download the modules. From what I am currently reading on python, I might even need to download the ability to import.
https://docs.python.org/3/install/index.html?highlight=names%20modules

To do math on python:
From math import (enter math function)
ex) Enter the x value in radians not degrees.
You may not need to import from math depending on the function you are trying to complete.


https://docs.python.org/3.2/library/math.html#module-math

USER INPUT!
FINALLY FIGURED OUT HOW TO MAKE THE CODE TAKE USER INPUT. In order to make a function take user input you must have a question or statement followed by a ; or : or ? or ! some type of open end punctuation. Then you press enter, and beneath you can enter your input. Make sure the input matches the function perfectly.

BOLEAN PLUS USER INPUT

MORE complex Boolean with user input
 
Testing each of the conditions

https://docs.python.org/3/library/stdtypes.html
Python codes
https://wiki.python.org/moin/SimplePrograms