A variable like user_num can store a value like an integer. Extend the given program as indicated.
Output the user's input. (2 pts) Output the input squared and cubed. Hint: Compute squared as user_num * user_num. (2 pts) Get a second user input into user_num2, and output the sum and product. (1 pt)
Given:
user_num = int(input('Enter integer:\n'))
Type your code here
I have no idea where to start. I have looked through my resources and I dont know which coding formula to follow.
1 Answer
user_num = int(input('Enter integer:\n'))
print(user_num) # Output the user's input
print(user_num * user_num) # Output the input squared
print(user_num * user_num * user_num) # Output the input cubed
user_num2 = int(input('Enter another integer:\n')) # Get a second user input into user_num2
print(user_num + user_num2) # output the sum
print(user_num * user_num2) # output the product