1. IntroductionPython is a portable, dynamic, extensible, free language that allows (without impose it) a modular and object-oriented approach to programming. Python is developed since 1989 by Guido van Rossum and many volunteer contributors.
Here is an overview of some features of the Python language.
JavaScript is used in millions of web pages to improve their design. This is an additional programming layer that adds to the language HTML 1. HTML is the basic language that any web page should use:
in addition to its role as a word processor, this language allows you to surf through hypertext links. As for JavaScript, it was designed to give more interactivity to HTML pages. The script word indicates that it is a simplified programming language which runs locally on the computer that is reading the web page. This language, like HTML, does not require the purchase of any license to use it. Initially, JavaScript was developed by Netscape, but now most browsers for browsing the Internet are compatible with JavaScript.
Here is an overview of some features of the JavaScript language.
It is important to make it clear that even though the names are very close, Java and JavaScript are two very different languages. Java is developed by Sun Microsystems and is a much more powerful and complex programming language than JavaScript. Java can be compared to the C ++ language
2. The program "Hello World!"This is the first program a user creates when making a contact withan unknown programming language. It consists of displaying the text "Hello World!".
Here are the steps to follow, under Windows, in order to operate this program.
<html>
<body>
<script src="hello.js"></script>
</body>
</html>
II) File Hello.js
document.write("Hello World!")
3 . Double-click the page.html file icon to run the Internet Explorer by default. The hello.js script will be automatically interpreted.
The <html> ... </ html>tag tells the Internet Explorer that the file is written in HTML. As for the <body> ... </ body> tag, it indicates that it is the body of the HTML document. Finally, the <script src = 'hello.js'> </ script> tag tells the Internet Explorer that we will have to interpret in JavaScript the contents of the file hello.js.
In the hello.js file, the JavaScript document.write command allows you to write on the page.HTML displayed by the Internet Explorer.
When planning, always comment on what the program does it is quickly understandable. Companies like Google engage only programmers who have a clear and readable code (so well documented). Now, a comment is easy to put: any text that follows // is not interpreted by JavaScript.
Nevertheless, // only works for one line. If you want to write a comment several lines, we can also use / * to start the comment and* / for finish it. Here are two ways to write a comment on multiple lines.
| Sample1 | Sample2 |
|---|---|
// This is a comment | / * This is a comment on several lines * / |
// on multiple lines |
Not to be confused with the language comment tags that are the following and operate independently of the number of lines.
<! - This is a comment in HTML ->
Here are the steps to follow, under Windows, in order to operate this program.
print ("Hello World!")hello.py and click on the green iconplay button (all right on the image below).Hello World !, below the symbols >>>Python Interpreter at the bottom of the screen.Alternative. When you want to test a command in Python, you can directly type it in the Python Interpreter window. The result is instantaneous.
In Python, a comment is easy to put: all the text that follows is not interpreter.
The PyScripter program allows to put several lines in comments. For this, just select them and use the keyboard shortcut CTRL- '(the key next from 0). This shortcut acts as a switch and comments / uncommitted lines selected. It is set to add or remove a ## pair and does not interfere with simple comments #.
| Sample1 | Sample2 |
|---|---|
# This is a comment | ## This is a comment |
# on multiple lines | ## on multiple lines |
The advantage of the second version is that pressing CTRL- 'will remove the comment and a second press allows to put it back.
Tutorial Continued in next post.