Member Avatar for zahra97

see first elif statement for syntax error, where have i gone wrong??
this is only a section of code, help very much appreciated.

if dice == dice2 : print ("The scores on both dice remain constant, no changes are made.") elif dice > dice2 : print ("The scores of the two dice thrown are not the same.") print (a, "'s new strength is", difference, "+", c "and the new skill value is", difference2, "+", cc) elif dice < dice2 : print ("The scores of the two dice thrown are not the same.") print (b, "'s new strength is", difference, "-", d "and the the new skill value is", difference2, "-", dd) else : print ("I think we have an error!") 
Member Avatar for sepp2k

The problem is c "and the new skill value is": there's only a space between c and the string - no comma.

Member Avatar for snippsat

Same after "d" missing comma.
Learn to use string formatting.

>>> a = 100 >>> difference = 'high' >>> print('The gap between {} and 1000000 is {}'.format(a, difference)) The gap between 100 and 1000000 is high 

http://ebeab.com/2012/10/10/python-string-format/

A good Python editor will spot error like this for you.
Pycharm has now a Free Community Edition,that's good.

Member Avatar for Daemon_CC

Missing Comma in two lines:

c "and the new skill value is"

d "and the the new skill value is"
may be syntax error is due to the missing commas in above two statements...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.