₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,060 members, 8,420,091 topics. Date: Thursday, 04 June 2026 at 11:12 AM

Toggle theme

Help With This Python Problem - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHelp With This Python Problem (1617 Views)

1 Reply

Help With This Python Problem by Nobody: 8:49pm On Jul 26, 2012
This is the exercise:
.
Create a list that contains the names of 5 students of a class
( do not ask for input to do that, simply create the list)
print the list.
Ask the user to input one more name and append it to the list.
Print the list.
Ask the user to input a number.
Print the name that has that number as index.

Add "John Smith" and "Mary Miller" at the beginning of the list.
Print the list.
.
.
My code:
.
names= ['Michael Dow', 'Cynthia James', 'Jonathan Mills', 'Peter Parker', 'Sidney Lee']
.
print(names)
.
names2= input('Please enter one More Name: ')
.
names.append(names2)
.
print(names)
.
#i have a problem with this part- donno how to go about it{any help?}.
.
names.insert(0,John Smith)
.
names.insert(1,Mary Miller)
.
print(names)
.
.
I need HELP with the bolded..
Any ideas?
Any special function that i don't know about?
Re: Help With This Python Problem by Seun(mod): 9:01pm On Jul 26, 2012
number = input('Please enter an index')
print(names[index])
Re: Help With This Python Problem by Nobody: 8:53am On Jul 27, 2012
Seun:
number = input('Please enter an index')
print(names[index])
thanks man.
You're the best.
1 Reply

I Need HELP With This Python ProblemPlease Help With This Python CodePls Help With Python Problem234

Can Someone Please Explain MESH NETWORKING To MeAndela Is Partnering With Lagos State GovernmentHow Do I Remove BIOS Password