User:Euna/prototyping 13: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
=Prototyping 1 ( | =Prototyping 1 (21/09/2020)= | ||
==JupiterLab== | ==JupiterLab== | ||
- command language : pythone (also, wiki language. ex. instead of #, use ==headline==) | - command language : pythone (also, wiki language. ex. instead of #, use ==headline==) <br> | ||
- run on offline + in browser (easy to publish) <br> | |||
- run on offline + in browser (easy to publish) | - have its library, with ? at the end (ex. random?), we get its explanation <br> | ||
- with "enter", change the line in the cell <br> | |||
- have its library, with ? at the end (ex. random?), we get its explanation | - "enter + shift", command to execute the command -> on the next line, spit out the output immediately (like javascript console) <br> | ||
- with "enter", change the line in the cell | |||
- "enter + shift", command to execute the command -> on the next line, spit out the output immediately (like javascript console) | |||
- consist of "Console" and "Notebook" | - consist of "Console" and "Notebook" | ||
Line 25: | Line 20: | ||
<b>Notebook</b> | <b>Notebook</b> | ||
- for hybrid publishing interface (but +, console) | - for hybrid publishing interface (but +, console) <br> | ||
- fast editing and publishing possiblle ( faster than using hub) <br> | |||
- fast editing and publishing possiblle ( faster than using hub) | - Text (Markdown) + Code (Python) <br> | ||
- modifying / rerunning the cell is possible | |||
- Text (Markdown) + Code (Python) | |||
- modifying / rerunning the cell is possible | |||
<b>Phython code</b> | <b>Phython code</b> | ||
- https://docs.python.org/3/tutorial/classes.html#class-objects | - https://docs.python.org/3/tutorial/classes.html#class-objects <br> | ||
- "17" + 29 -> error / "17" + "29" -> 1729 <br> | |||
- "17" + 29 -> error / "17" + "29" -> 1729 | - x=x+1 same with x+=1 <br> | ||
- type : str (for text ex. "17"), int(number), float(number with fractional parts), boolean(true/false), list <br> | |||
- x=x+1 same with x+=1 | - calculation with text is not possible (sauf, * ex."hello"*2 -> hellohello) <br> | ||
- x=["a", "b", "c"] -> x[1]=b / x[-1]=c(negative number starts from the end) <br> | |||
- type : str (for text ex. "17"), int(number), float(number with fractional parts), boolean(true/false), list | - print() -> empty line output <br> | ||
- calculation with text is not possible (sauf, * ex."hello"*2 -> hellohello) | |||
- x=["a", "b", "c"] -> x[1]=b / x[-1]=c(negative number starts from the end) | |||
- print() -> empty line output | |||
- for For, the space before inner-command is important | - for For, the space before inner-command is important | ||
<source lang=python> | <source lang=python> | ||
Line 65: | Line 48: | ||
</source> | </source> | ||
- input random | - input random<br> | ||
random.random -> 0.234546546678<br> | |||
random.random -> 0.234546546678 | random.randint(0,5) -> 4 (random number between 0-4)<br> | ||
random.randint(0,len(x)) -> 1 (number between 0-2)<br> | |||
random.randint(0,5) -> 4 (random number between 0-4) | random.choice(x) -> c<br> | ||
random.randint(0,len(x)) -> 1 (number between 0-2) | |||
random.choice(x) -> c | |||
==Generated poem== | ==Generated poem== | ||
- A house of dust by Alison Knowles https://hub.xpub.nl/bootleglibrary/read/465/pdf | - A house of dust by Alison Knowles https://hub.xpub.nl/bootleglibrary/read/465/pdf <br> | ||
- My generated poem input and output | - My generated poem input and output | ||
Revision as of 00:35, 24 September 2020
Prototyping 1 (21/09/2020)
JupiterLab
- command language : pythone (also, wiki language. ex. instead of #, use ==headline==)
- run on offline + in browser (easy to publish)
- have its library, with ? at the end (ex. random?), we get its explanation
- with "enter", change the line in the cell
- "enter + shift", command to execute the command -> on the next line, spit out the output immediately (like javascript console)
- consist of "Console" and "Notebook"
Console
-like terminal, command line interface. direct way to see the result, but, cannot be saved
Notebook
- for hybrid publishing interface (but +, console)
- fast editing and publishing possiblle ( faster than using hub)
- Text (Markdown) + Code (Python)
- modifying / rerunning the cell is possible
Phython code
- https://docs.python.org/3/tutorial/classes.html#class-objects
- "17" + 29 -> error / "17" + "29" -> 1729
- x=x+1 same with x+=1
- type : str (for text ex. "17"), int(number), float(number with fractional parts), boolean(true/false), list
- calculation with text is not possible (sauf, * ex."hello"*2 -> hellohello)
- x=["a", "b", "c"] -> x[1]=b / x[-1]=c(negative number starts from the end)
- print() -> empty line output
- for For, the space before inner-command is important
for x in "Michael":
print(f"hello {x}")
print("End")
-> hello M
hello i
...
hello l
End # appeals only at the end
- input random
random.random -> 0.234546546678
random.randint(0,5) -> 4 (random number between 0-4)
random.randint(0,len(x)) -> 1 (number between 0-2)
random.choice(x) -> c
Generated poem
- A house of dust by Alison Knowles https://hub.xpub.nl/bootleglibrary/read/465/pdf
- My generated poem input and output
import random
from random import choice
ani = ("mosquitos", "pigs", "kangaroos", "tunas", "cats")
cha = ("blue", "laziest", "numbest", "most stinky", "dullest")
for x in range (10) :
n = random.randint(3, 30) # when the number is too big, doesn't give a sufficient random one (like, 99999 -> always, a number of 5 ciphers)
a = choice(ani)
c1 = choice(cha)
c2 = list(cha) # to remove an element in tuple, must change to list (list = ["",""], tuple = ("","")
c2.remove(c1) # c2 is a list except the result of c1
c2 = choice(c2)
print(f"Amongst the numbers of {n} of {a},")
print(f"the {c1} one and {c2} one are selected as the king and queen of {a}!")
print()
Amongst the numbers of 5 of mosquitos, the blue one and dullest one are selected as the king and queen of mosquitos! Amongst the numbers of 13 of cats, the laziest one and dullest one are selected as the king and queen of cats! Amongst the numbers of 12 of cats, the dullest one and most stinky one are selected as the king and queen of cats! Amongst the numbers of 11 of kangaroos, the numbest one and blue one are selected as the king and queen of kangaroos! Amongst the numbers of 7 of cats, the dullest one and blue one are selected as the king and queen of cats! Amongst the numbers of 26 of tunas, the laziest one and numbest one are selected as the king and queen of tunas! Amongst the numbers of 6 of tunas, the laziest one and dullest one are selected as the king and queen of tunas! Amongst the numbers of 13 of pigs, the numbest one and dullest one are selected as the king and queen of pigs! Amongst the numbers of 4 of kangaroos, the numbest one and blue one are selected as the king and queen of kangaroos! Amongst the numbers of 18 of pigs, the laziest one and blue one are selected as the king and queen of pigs!