# Expected expression and “(“ was not closed error in Python script

**URL:** <https://discuss.python.org/t/expected-expression-and-was-not-closed-error-in-python-script/34505>\
**Category:** Python Help\
**Created:** [September 24, 2023, 4:58am UTC](https://discuss.python.org/t/expected-expression-and-was-not-closed-error-in-python-script/34505 "2023-09-24T04:58:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thatgirlniecie](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@thatgirlniecie](https://discuss.python.org/u/thatgirlniecie)\
**Post date:** [September 24, 2023, 4:58am UTC](https://discuss.python.org/t/expected-expression-and-was-not-closed-error-in-python-script/34505/1 "2023-09-24T04:58:57Z")

</div>

# 6. Create a variable named number\_of\_guesses and assign 0 to it.

# Put the answer on the next line.

“number\_of\_guesses” \>=0

# 7. Print a string which includes the player\_name variable. It should say: player\_name, I am guessing a number between 1 and 10!

# Put the answer on the next line.

print(“Shaunice”+ “, I am guessing a number between 1 and 10!”)  
print("Hi, " + “Shaunice” + “! I am guessing a number between 1 and 10!”)

# 8. Create a WHIlE Loop. Give the user 5 attempts to guess the number. If the number is too low print Your guess is too low. If the number is too high print Your guess is too high. Create a break if the user answers it correctly.

“python”  
while “number\_of\_guesses” \< 5:  
guess = int(input("Guess a number: "))  
number\_of\_guesses = “number\_of\_guesses” + 6  
if guess \< numbers: + 2  
print(“Your guess is too low.”)  
“python”  
elif guess \> numbers + 7:  
print(“Your guess is too high.”)  
else  
print(“Congratulations! You guessed the number correctly!”)  
break

# 9. if/else Statements - Verifying if the user has guessed the number or not.. If they did…then print a message for them along with the number of tries. If the player couldnt guess the number at the end…print the number along with a message.

“python”  
if “number\_of\_guesses” == 3:  
“python”  
print(“Sorry, you couldn’t guess the number. It was”, 2)  
else:  
print(“Congratulations, you guessed the number”, numbers, “correctly in”, “number\_of\_guesses”, ()“4 tries!”())()

---

<div class="post-metadata">

**Author:** ![barry-scott](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@barry-scott](https://discuss.python.org/u/barry-scott)\
**Post date:** [September 24, 2023, 7:58am UTC](https://discuss.python.org/t/expected-expression-and-was-not-closed-error-in-python-script/34505/2 "2023-09-24T07:58:04Z")

</div>

Please format your code so we can read it easily.  
See [About the Python Help category](https://discuss.python.org/t/about-the-python-help-category/42) that describes how to do this.

---

<div class="post-metadata">

**Author:** ![RonnyPfannschmidt](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ronnypfannschmidt/32/1714_2.png) [@RonnyPfannschmidt](https://discuss.python.org/u/RonnyPfannschmidt)\
**Post date:** [September 24, 2023, 8:21am UTC](https://discuss.python.org/t/expected-expression-and-was-not-closed-error-in-python-script/34505/3 "2023-09-24T08:21:18Z")

</div>

The very last line has to many parens, clean them up
