₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,324,993 members, 8,419,843 topics. Date: Thursday, 04 June 2026 at 01:56 AM

Toggle theme

Help With Python Program (simple While Loop) - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingHelp With Python Program (simple While Loop) (2348 Views)

1 Reply (Go Down)

Help With Python Program (simple While Loop) by hegelian(op): 8:38am On Oct 15, 2016
can you guys please check while this python program aint running beyound the print(plugged it in) expression??....am just a begginner

#simplewhile loop program
print('please help my computer is not coming up')
rabiu = False
while not rabiu:
print('system help: does the computer make any sound?')
choice = input('or the fan workind?(y/n): ')
if choice == 'n':
choice = input('system help: is the computer plugged in (y/n) :')
if choice == 'n':
print('plugged it in')
else:
choice = input('system help: is the computer switched on (y/n): ')
if choice == 'n':
print('switched in on')
else:
choice = input('system help: is the fuse ok (y/n): ')
if choice == 'n':
print('system help: replace the swtich and switched it on')
else:
rabiu = True
print('system help: contact system engineer for repair')

else:
rabiu = True
print('contact technician for answer')
Re: Help With Python Program (simple While Loop) by 4kings: 12:13pm On Oct 15, 2016
Your code is syntactically correct but not logical.
You should give decisions for different or wrong responds e.g y or int
Apart from that nothing is wrong, except maybe ur spacing.

Re: Help With Python Program (simple While Loop) by Nobody: 10:02pm On Oct 15, 2016
The poster above me is right about your indentation.
At the end of the screenshot, you add
else:
print "Invalid response"
continue

A feedback would be nice

Re: Help With Python Program (simple While Loop) by hegelian(op): 7:05am On Oct 16, 2016
thank you guys.....am studying the correction now
Re: Help With Python Program (simple While Loop) by hegelian(op): 7:16am On Oct 16, 2016
Gaara101:
The poster above me is right about your indentation.
At the end of the screenshot, you add
else:
print "Invalid response"
continue

A feedback would be nice
am not at break statement yet...am still stucked at the nested loop...but am looking into it though...thanks very much
Re: Help With Python Program (simple While Loop) by Nobody: 10:33am On Oct 16, 2016
hegelian:
am not at break statement yet...am still stucked at the nested loop...but am looking into it though...thanks very much
I shouldn't have included the break statement.
Any line that has a break statement, replace with rabiu = True
Re: Help With Python Program (simple While Loop) by Ihinmi(m): 1:38am On Oct 26, 2016
Gaara101:
The poster above me is right about your indentation.
At the end of the screenshot, you add
else:
print "Invalid response"
continue

A feedback would be nice
please which version should I use as a starter python 3 or 2. Thanks.
Re: Help With Python Program (simple While Loop) by Nascimento(m): 6:50am On Oct 27, 2016
Ihinmi:
please which version should I use as a starter python 3 or 2. Thanks.
Use any version. The version doesn't matter. Though I'd recommend python 3, because it's the future. The main thing is to know how to solve problems in python.
1 Reply

A Python Program To Check The Risk Of Corona Virus.Help! How To Make Your Java Or Python Program Become A Real Android App?How To Run Python Program On Android234

Nigeria Mern Stack And Javascript Developers ThreadOpay Account Number IssueHow I Got Scammed By A Guy I Met On Nairaland