New to Python and programming, following an exercise from a book.
The program should take a value and keep printing "to the power of '+1' " on every new line, using WHILE.
My code:
x = 2
def powerof2_table_while(victim):
line=1
result=victim**(line)
while result < 100:
""" want to write: 1.: 2 to the power of 1 is 2
2.: 2 to the power of 2 is 4
3.: 2 to the power of 3 is 8 """
print (line,".:\t", victim, "to the power of\t",line,"\t is", result)
line=line+1
return line
return line
resultat=powerof2_table_while(x)
print(resultat)
Instead of returning the table of line + victim to the power of (line) it gives back only the first line and then stops.
May I humbly ask for a help? Thanks a lot!