Python:
list[::-1]
Ruby:
list.reverse
Python:
list[1:4]
Ruby:
list[1..4]
Python:
print("Hello World")
Ruby:
puts "Hello World"
Python:
fruits = ["apple","banana","cherry"]
for x in fruits:
print(x)
Ruby:
fruit = ["apple", "banana", "cherry"]
each {|x| print x }
Python:
fruits = ["apple","banana","cherry"]
a = list(fruits)
print(a)
a.reverse()
print(a)
Ruby: