Thursday, February 28, 2019

STRINGS & CONSOLE OUTPUT

STRINGS & CONSOLE OUTPUT

What i did today...

  • When entering a variable, you can just type the word on to the system. String Value goes behind the variable.
  • This code breaks because Python thinks the apostrophe in 'There's' ends the string. So we can do this to fix it: There\'s
  • Each character in a string is assigned a number. This number is called the indexThis is because in Python indices begin counting at 0.
EX:


  • String methods let you perform specific tasks for strings.
  1. 1. len()-output will be the number of characters of strings in the variable. ex: print len(parrot)
  2. 2. lower()-get rid of all the capitalization in your strings.  Enter behind variable in print. ex: print parrot.lower()
  3. 3. upper()-make a string completely upper case. ex: print parrot.upper()
  4. 4. str()-turns non-strings into strings. ex: str(2)-turn 2 into "2"
  5.  5. The % operator after the string is used to combine a string with variables. The % operator will replace the %s in the string with the string variable that comes after it. ex:

What did I learn...

  I learned to use string to do specific tasks in Python Language. The main use of the strings is to organize the words in human language into the language that the computer can read and do work with it. And it is easy for us to read as well comparing to other programming language.

What I'll be doing tomorrow...
  I will be studying about DATE AND TIME in Python language.





Wednesday, February 27, 2019

Project: Creating a tip calculator


The procedure of creating a tip calculator through Python Language.
Only have to type out the instructions and the system will calculate it for us.


Tuesday, February 26, 2019

Python Language

Python Language

What is Python?

  • used in software development
  • used in web development (server-side)
  • used in mathematics
  • used in system scripting
  • has a simple syntax similar to the English language
  • allows developers to write programs with fewer lines than some other programming languages
  • runs on an interpreter system, meaning that code can be executed as soon as it is written
  •  designed to for readability
  • new lines to complete a command
  • relies on indentation, using white-space, to define scope
  • to create web applications
  • alongside software to create workflows
  • connect to database systems
  • handle big data and perform complex mathematics
  • rapid prototyping, or for production-ready software development
  • Python (.py)
NoteThere are two different Python versions. Both Python 2 and Python 3 are used throughout the globe. The most significant difference between the two is how you write a print statement. In Python 3, print has parentheses().

Writing a comment in Python Language:
use # or """___"""
Print messages start line with the word print
If the printed two quotes does not make sense to each other the Python language will determined it as error.

What did I learn?

  The Python Language is a lot easier to read comparing to other coding languages therefore it's easier to learn. Most of the exercises in this lesson is all about writing a comment or printing a statement. And also learning different ways of typing the instructions into the system.

What I'll be doing tomorrow...

   I will be moving onto the next chapter in the Python language---

Strings & Console Output


Monday, February 25, 2019

HTML exercise notes

HTML exercise Notes


  1. Preserve all spaces and linebreaks when the element is displayed  <pre></pre>\
  2. Use CSS to center align the paragraph. 

 <p style="text-align:center;">This is a paragraph.</p>
3.  Highlight the word "FUN" in the text below.
 <p>
    HTML is <mark>FUN</mark> to learn!
 </p>
4. Apply subscript formatting to the number "2" in the text below.
 <p>
    H<sub>2</sub>O is the scientific term for water.
 </p>
5. Add a line through (strikeout) the letters "blue" in the text below.
 <p>
    My favorite color is <del>blue</del>red.
 </p>
6. Use an HTML element to add quotation marks around the letters "cool".
  <p>
    I am so <q>cool</q>.
  </q>
7. Add the proper HTML element to it, and specify that it is quoted from the following URL:
  <blockquote cite=""></blockquote>
8. Make the text below direction go right-to-left.
<bdo dir="rtl"></bdo>
9. Use an HTML element to provide the specified abbreviation of "WHO".
<abbr title=""></abbr>
10. comment tag
<!--      -->
11. 

Friday, February 22, 2019

Learn the Command Line---MANIPULATION ls, revisited

Learn the Command Line---MANIPULATION ls, revisited

What I did today...
---the ls command has several more options. Here are three common options:
-a - lists all contents, including hidden files and directories
-l - lists all contents of a directory in long format
-t - order files and directories by the time they were last modified.
ls -alt---ls -alt lists all contents, including hidden files and directories, in long format, ordered by the date and time they were last modified.
Here's what each column means(from left to right):
  • 1. Access rights. These are actions that are permitted on a file or directory.
  • 2. Number of hard links. This number counts the number of child directories and files. This number includes the parent directory link (..) and current directory link (.).
  • 3. The username of the file's owner. Here the username is cc.
  • 4. The name of the group that owns the file. Here the group name is eng.
  • 5. The size of the file in bytes.
  • 6. The date & time that the file was last modified.
  • 7. The name of the file or directory.
How to navigate to the drama/biopic/ directory?
   cd ../drama/biopic/
cp command copies
mv move files
rm removes deletes files and directories
The -r is an option that modifies the behavior of the rm command. The -r stands for "recursive," and it's used to delete a directory and all of its child directories.

NotesBe careful when you use rm! It deletes files and directories permanently. There isn't an undelete command, so once you delete a file or directory with rm, it's gone.

What did I learn...
   I learned more about how Command Line works and got lots of practice from the lessons. During the lesson, I found some serious problems about the website. It sometimes automatically resets the lessons and made me lose all my progress.

What I'm doing tomorrow...
   Because of the problems that I found about the Codecademy website, I've been thinking about changing my learning progress to another website such as w3schools.


Thursday, February 21, 2019

Learn the Command Line

Learn the Command Line

  The command line

  • a Text interface for your computer.
  • Navigate through files and folders on your computer
  • the command line is fully text-based.
  • run programs
  • Write scripts to automate common tasks
  • Use terminal
  • Combine simple commands to handle difficult tasks – making it an important programming tool.

What I did today...

$---shell prompt---appears when the terminal is ready to accept a command
ls, the command line looks at the folder you are in, and then "lists" the files and folders inside it. It also gives the range of years and the type of files in the next line.
EXAMPLE:

pwd stands for "print working directory"
    >>outputs the name of the directory you are currently in, called the working directory.
cd stands for "change directory"---switches you into the directory you specify. When a file, directory or program is passed into a command, it is called an argument.
EXAMPLE:
Here the 2015 directory is an argument for the cd command.

cd .. navigates up from jan/memory/ to jan/.
mkdir command stands for "make directory"---takes in a directory name as an argument, and then creates a new directory in the current working directory.

touch command creates a new file inside the working directory---takes in a filename as an argument, and then creates an empty file in the current working directory.
EXAMPLE:
Here we used touch to create a new file named keyboard.txt inside the 2014/dec/ directory.
  • filesystem organizes a computer's files and directories into a tree structure. It starts with the root directory. Each parent directory can contain more child directories and files.

And it turns into the following in the computer.

What I learned today...
   I've learned five commands commonly used to navigate the filesystem from the command line. Which is pwd, ls, cd, mkdir, and touch. With all the commands that I've learned, it allows me tonavigate through files and folders on the computer in different ways.

What I'll be doing tomorrow...

 The MANIPULATION of  ls, revisited.

Wednesday, February 20, 2019

Quiz report (HTML)

   After the lesson I did on Codecademy, I looked up a quiz for the HTML unit that I just learned on another website called w3schools. and the result was pretty good. After the quiz, I also did corrections and notes on a separate word document.


Thursday, February 14, 2019

C++ COMPILE & EXECUTE

C++ COMPILE & EXECUTE

   C++ is a compiled language. That means that to get a C++ program to run, you must first translate it from the human-readable form to something a machine can "understand." That translation is done by a program called a compiler.

What did I do

 Code → Save → Compile → Execute
  1. Code — writing the program
  2. Save — saving the program
  3. Compile — compiling via the terminal
  4. Execute — executing via the terminal
Compile (编译) hello.cpp using the terminal.
g++ hello.cpp

Execute(执行): To execute the new machine code file, all you need to do is type ./ and the machine code file name in the terminal:
./a.out
The a stands for "assembler" and the out stands for "output". 
  • -Single line comment can be done using //.
  • -Multi-line comment can be done using /* */.

Note: Codes in the terminal can not be erased once summitted, so if you made a mistake, you'll have to reset the whole thing.

LEARN THE COMMAND LINE