Python Forum
How to Display Multiple Time Tables With While Loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Display Multiple Time Tables With While Loop
#1
I'm trying to write a code which prompts the user to enter a number, then prints its ten-times tables, before moving onto another number (with sentinel value). My code here is not working. The inner while loop is not executing the second time and instead it is simply taking an input, then asking for another input, and again, and again. Any ideas on how to fix this?:

num = int()
counter = int()
counter = 0
counter2 = int()
counter2 = 0


number = num

while counter2 != -1:
    num = int(input("\nEnter a Number: "))   
    counter2 += 1
    while counter <= 9 and num != 1:
        number = num * (counter + 1)
        print(number, end = " ")
        counter += 1
        number = num * (counter + 1)
[python][python]
[/python][/python]
Reply


Messages In This Thread
How to Display Multiple Time Tables With While Loop - by ZQ12 - Nov-10-2019, 03:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to display <IPython.core.display.HTML object>? pythopen 3 45,887 May-06-2023, 08:14 AM
Last Post: pramod08728
  Multiple.ui windows showing at the same time when I only want to show at a time eyavuz21 4 1,015 Dec-20-2022, 05:14 AM
Last Post: deanhystad
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,646 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Multiple Loop Statements in a Variable Dexty 1 1,198 May-23-2022, 08:53 AM
Last Post: bowlofred
  Multiple user defined plots with secondary axes using for loop maltp 1 1,433 Apr-30-2022, 10:19 AM
Last Post: maltp
  Real time Detection and Display Gilush 0 1,781 Feb-05-2022, 08:28 PM
Last Post: Gilush
  How to make for loop display on 1 Line Extra 3 1,421 Jan-12-2022, 09:29 PM
Last Post: Extra
  Slittping table into Multiple tables by rows drunkenneo 1 2,034 Oct-06-2021, 03:17 PM
Last Post: snippsat
  Display table field on multiple lines, 'wordwrap' 3python 0 1,763 Aug-06-2021, 08:17 PM
Last Post: 3python
  Trying to separate a loop across multiple threads stylingpat 0 1,670 May-05-2021, 05:21 PM
Last Post: stylingpat

Forum Jump:

User Panel Messages

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