5:
{{ range . -}}
{{- "" -}} Name : {{ .Name }}, Category: {{ .Category }} Price:
{{- printf "$%.2f" .Price -}}
{{ end }}
6:
There area {{ len . }} products in the source data .
First product is {{ index . 0 }}
{{ range slice . 3 5 -}}
{{- "" -}} Name : {{ .Name }}, Category: {{ .Category }} Price:
{{- printf "$%.2f" .Price -}}
{{ end }}
7 and 8:
{{ range . -}}
{{ if lt .Price 100.00 -}}
{{- "" -}} Name : {{ .Name }}, Category: {{ .Category }} Price:
{{- printf "$%.2f" .Price -}}
{{ else if gt .Price 1500.00 -}}
Expensive Product: {{ .Name }} ({{ printf "$%.2f" .Price }})
{{ else -}}
Midrange Product: {{ .Name }} ({{ printf "$%.2f" .Price }})
{{ end -}}
{{ end }}