Variable and string help.

This is the place for queries that don't fit in any of the other categories.

Variable and string help.

Postby Snazzell » Tue Aug 27, 2013 5:16 pm

Hello, I'm new to Python. And I'm having a problem which I can't seem to fix. The internet doesn't have it either..

I'm doing this code:

Code: Select all
myscore=1000
message='I scored %s points!'
print(message % myscore)



But when i press enter, it brings up this.
"multiple statements found while compiling a single statement"

What do I do to get rid of this? :? :?:
Last edited by metulburr on Tue Aug 27, 2013 5:18 pm, edited 1 time in total.
Reason: added code tags
Snazzell
 
Posts: 2
Joined: Tue Aug 27, 2013 5:10 pm

Re: Variable and string help.

Postby metulburr » Tue Aug 27, 2013 5:19 pm

But when i press enter, it brings up this.
"multiple statements found while compiling a single statement"

press enter on what? Meaning what IDE are you using? What version of Python are you using? And just for full info, what Operating System are you on?
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1387
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Variable and string help.

Postby Snazzell » Tue Aug 27, 2013 5:23 pm

As in enter I mean I press the "enter" button on the keyboard.

I am using Python IDE, 3.3.2
And I am using Windows 7 64x
Snazzell
 
Posts: 2
Joined: Tue Aug 27, 2013 5:10 pm

Re: Variable and string help.

Postby metulburr » Tue Aug 27, 2013 5:34 pm

how are you executing the code? Via interpreter, an IDE, command prompt?
Is that the full traceback error?

By IDE i mean, http://wiki.python.org/moin/IntegratedD ... vironments

Also is that the entire code?

EDIT:
Do you get the same error with the code:
Code: Select all
print('I scored {} points!'.format(1000))
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1387
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Variable and string help.

Postby micseydel » Tue Aug 27, 2013 6:10 pm

I believe this may be one of the rare times in a programming forum where a screenshot isn't a bad idea.
Join the #python-forum IRC channel on irc.freenode.net!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
micseydel
 
Posts: 1222
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 2 guests