klasiter
Posts: 2
Joined: Fri Jul 17, 2015 6:15 pm

Python Tutorial Help

Fri Jul 17, 2015 6:18 pm

I've been using the python tutorial and i cannot figure out what I am supposed to do for the section of the tutorial which says:

# (name, age)
students = [
('Dave', 12),
('Sophia', 13),
('Sam', 12),
('Kate', 11),
('Daniel', 10)
]

# Now write a loop to print each of the students' names and age

Please Help!

User avatar
elParaguayo
Posts: 1943
Joined: Wed May 16, 2012 12:46 pm
Location: London, UK

Re: Python Tutorial Help

Fri Jul 17, 2015 9:51 pm

Which tutorial are you using? Rather than just give you an answer, it would be much better to point you to the relevant bits in the tutorial.
RPi Information Screen: plugin based system for displaying weather, travel information, football scores etc.

klasiter
Posts: 2
Joined: Fri Jul 17, 2015 6:15 pm

Re: Python Tutorial Help

Sat Jul 18, 2015 5:01 am

sorry, I should have specified. I am using the python tutorial from the raspberry pi website.

https://www.raspberrypi.org/learning/python-intro/

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: Python Tutorial Help

Sat Jul 18, 2015 6:36 am

Have a look at #17, it shows how to iterate through a list, and #20, which shows how to extract information from a complex type.

Return to “Python”