Number Guess 14/28


#1

I am building a program that rolls a pair of dice and asks the user to guess the sum for this exercise.
I don’t really understand the purpose of line 14 in the code that I attached below.
The purpose of line 14, according to the instruction is to "Store the returned value into a variable called guess" but I’m still a bit confused. ‘guess’ is already defined on line 6, so why do we need line 14? Thank you in advance :slight_smile:

“”“Number Guess Game”""
from random import randint
from time import sleep

def get_user_guess():
guess = int(raw_input("Guess a number: "))
return guess

def roll_dice(number_of_sides):
first_roll=randint(1,number_of_sides)
second_roll=radiant(1,number_of_sides)
max_val = number_of_sides * 2
print “Maximum value is %d” %max_val
guess = get_user_guess()


#2

The variable in line 6 is local so not the same as the one in line 14.


#3

Wouldn’t the code still work without line 14?


#4

It is needed since it is the function call. We will need a link to the lesson to be able confirm.