'SQLite3: Find a user based on their ID using a function

I want to make a function:

def UserGameDetails(UserID):

SQL = '''SELECT U.FirstName, U.LastName, COUNT(*) AS TotalGames
         FROM User U INNER JOIN Game G
         ON U.Id = G.UserId
         WHERE U.Id = ? '''

As you can see, the function can be called by writing for example: UserGameDetails(3), and you will recieve all relevant information for the user with ID 3.

How can I make it so that my function knows that what the user puts in the brackets, is the UserID it is looking for?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source