I'm fairly new to Python and I'm trying to create a game where you simulate a 6 sided die roll. The user has to guess a number and the program should tell them if their guess was right or wrong. The problem I have run into is that my program always says the user guessed wrong even when they guessed correctly. I'm just not sure what the problem is. The issue persists no matter what sort of loop I use.
def main():
#importing random
import random
#creating random numbers 1-6 inclusive
roll = random.randint(1, 6)
print(roll)
#taking user input
user_guess = input("Guess a number between 1 and 6: ")
if user_guess == roll:
print("You guessed correctly!")
else:
print("Better luck next time.")
main()