rby_pyt_syntax Flashcards
1
Q
!/usr/bin/python
print “Hello, Python!”
A
!/usr/bin/ruby -w
puts “Hello, Ruby!”;
2
Q
!/usr/bin/python
import subprocess
subprocess.Popen( ''' echo hi there echo lo there ''', shell = True )
A
!/usr/bin/ruby
print «EOC
echo hi there
echo lo there
EOC
3
Q
#!/usr/bin/python # has new line before and after print ''' blah, blah blah, blah '''
A
!/usr/bin/ruby
print «_space;EOF
blah, blah
blah, blah
EOF
no space after «
4
Q
!/usr/bin/python
no BEGIN or END
A
!/usr/bin/ruby
puts “This is main Ruby Program”
END { puts "Terminating Ruby Program" } BEGIN { puts "Initializing Ruby Program" }
5
Q
!/usr/bin/python
# First comment print "Hello, Python!" # second comment
# This is a comment. # This is a comment, too. # This is a comment, too. # I said that already.
A
#!/usr/bin/ruby # First comment puts "Hello, Ruby!" # second comment
=begin This is a comment. This is a comment, too. This is a comment, too. I said that already. =end