xxxxxxxxxx
link_to "allrecipes", "http://www.allrecipes.com", target: "_blank", class: "p-12 rounded-lg font-bold"
xxxxxxxxxx
link_to "External link", "http://www.rubyonrails.org/", target: "_blank", rel: "nofollow"
# => <a href="http://www.rubyonrails.org/" target="_blank" rel="nofollow">External link</a>
xxxxxxxxxx
from collections import namedtuple
Point = namedtuple('Point', 'x y')
p = Point(1, y=2)
p[0]
# 1
p.x
# 1
getattr(p, 'y')
# 2
p._fields # Or: Point._fields
# ('x', 'y')
xxxxxxxxxx
# tuples are immutable
# initialize tuple
scores = (10, 20, 30)
# check if 10 is in scores tutple
print(10 in scores)
# print all scores in tuple
for score in scores:
print(scores)
# print length of tuple
print(len(scores))
# print scores reversed
print(tuple(reversed(scores)))
# print scores reversed
print(scores[::-1])
# print first score by index
print(scores[0])
# print first two scores
print(scores[0:2])
# print tuple
thistuple = ("apple",)
print(type(thistuple))
#NOT a tuple
thistuple = ("apple")
print(type(thistuple))