To print first 10 multiples of a number entered by the users

0 Malay Anand · May 18, 2015
ok, here i am trying to print the multiple of any number upto 10, that the users enter. 
But it keeps giving me an error. 
Don't know what the heck is wrong. Please help! 

LANGUAGE : Python written in PyCharm 3.4

------CODE STARTS------- 

# getting input number to calculate the desired table 
table_number = input("Enter a number: ") 

# calculator to cget the required table after getting the input from the user in the above line 
def table_calculator(table_number): 
for x in range((table_number * 10) + 1): 
if x % table_number is 0: 


Post a Reply


Oldest  Newest  Rating
0 Colonel Panic · May 18, 2015
#1 Your code is not in a code block, nor is it indented.  This is all left justified. Indentation is important in python. So none of this can be figured out. 

#2 What error?  For us to debug an error, we have to see the error.  Errors are information about what went wrong, maybe its telling you that you need indentation. :)

Simple code for multiples:
num = input("Enter a Num: ")

for i in range(1,10):
    print i * num
0 Jeroen Castelein · May 18, 2015
Even though your way of approaching the problem isn't the most logical one as the previous replier stated, it should still calculate the multiples correctly. The error I got when implementing your code was that the value in table_number is a string while it needs an integer.

The simplest way to change this is by casting the string to an integer and changing the first line to:
table_number = int(input("Enter a number: "))
  • 1



This section is all about snakes! Just kidding.

Bucky Roberts Administrator