mirror of
https://github.com/ossu/computer-science.git
synced 2025-03-02 19:29:22 -05:00
add example.py 01.01.02
This commit is contained in:
parent
d02643b78d
commit
a9e4befe28
@ -1,3 +1,14 @@
|
|||||||
x = 3; // Create variable and assign value 3 to it
|
x = 3; // Create variable and assign value 3 to it
|
||||||
|
|
||||||
x = x * x; // Bind x to value 9
|
x = x * x; // Bind x to value 9
|
||||||
|
|
||||||
console.log( x ); // print the x's value
|
console.log( x ); // print the x's value
|
||||||
|
|
||||||
|
process.stdout.write( 'Enter a number: ' ); // better way to print in the terminal
|
||||||
|
process.stdin.resume();
|
||||||
|
// convert the entered value from stream into a string
|
||||||
|
// process.stdin.setEncoding( 'utf8' );
|
||||||
|
process.stdin.on('data', function( inputText ) {
|
||||||
|
process.stdout.write( inputText.toString() );
|
||||||
|
process.exit();
|
||||||
|
});
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
x = 3 # create variable x and assign value 3 to it
|
||||||
|
x = x * x # bind x to value 9
|
||||||
|
print x
|
||||||
|
y = raw_input('enter a number:')
|
||||||
|
print type(y)
|
Loading…
x
Reference in New Issue
Block a user