I have to write a simple program in python 3.6 that takes the user input and computes the value of n+n*n+n*n*n+n*n*n*n.
So if the user enters 7, then the following should be printed to the console 7+7*7+7*7*7+7*7*7*7 = 2800.
How do i accomplish this with the print function?
So far i have tried the following:
input_int = int(input("Please enter a value: "))
result_int = input_int + input_int * input_int + input_int * input_int * input_int + input_int * input_int * input_int * input_int
print(input_int + input_int * input_int + input_int * input_int * input_int + input_int * input_int * input_int * input_int, " = ", result_int)
and doesn't give me what i want.
input_intto string, and use+to concatenate them.input_intcome from? Where is your calculation forresult_int?+or*symbols in the output. Think through the steps of the problem logically.