Python Forum
Program that allows to accept only 10 integers but loops if an odd number was entered
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program that allows to accept only 10 integers but loops if an odd number was entered
#3
Hi @gachicardo , you are almost there. You missed one detail:
(Feb-24-2022, 05:15 AM)gachicardo Wrote: to accept only 10 integers on a list
So there must be a list. Define an empty list at the start of your program like "result_list = []".
Then in the "while" loop after you decided the entered number is allowable, append this number to the list AND increase the counter.
Because you increase the counter, the "while" loop will stop in time.

Also note this:
(Feb-24-2022, 05:15 AM)gachicardo Wrote: will not be accepted because it is the third odd integer
So you need to refuse a number if "odd_count == 3". Not "> 3".
gachicardo likes this post
Reply


Messages In This Thread
RE: Program that allows to accept only 10 integers but loops if an odd number was entered - by ibreeden - Feb-24-2022, 09:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Program to check whether a number is palindrome or not PythonBoy 18 2,923 Sep-12-2023, 09:27 AM
Last Post: PythonBoy
  Help needed for a program using loops PythonBoy 5 1,458 Sep-10-2023, 06:51 AM
Last Post: PythonBoy
  Python Program to Find the Factorial of a Number elisahill 2 1,489 Nov-21-2022, 02:25 PM
Last Post: DeaD_EyE
  I will accept any help with this task (compression code) Malin3k 3 2,356 Feb-10-2021, 10:20 AM
Last Post: Larz60+
  How can details be dynamically entered into a list and displayed using a dictionary? Pranav 5 2,989 Mar-02-2020, 10:17 AM
Last Post: buran
  How to collect all integers with minimum number of rounds? meknowsnothing 6 3,357 Jun-11-2019, 08:36 PM
Last Post: jefsummers
  MyProgrammingLab wont accept anything I put in chicks4 2 11,637 Feb-10-2019, 11:44 PM
Last Post: chicks4
  Program that displays the number with the greatest amount of factors ilusmd 3 2,866 Nov-01-2018, 08:28 PM
Last Post: ichabod801
  Program to print: Last Name, ID, Mobile Number, All panick1992 14 9,935 Mar-15-2017, 02:46 PM
Last Post: panick1992

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020