You are viewing our Forum Archives. To view or take place in current topics click here.
Python Help Needed.
Posted:
Python Help Needed.Posted:
Status: Offline
Joined: Dec 27, 201112Year Member
Posts: 696
Reputation Power: 35
Status: Offline
Joined: Dec 27, 201112Year Member
Posts: 696
Reputation Power: 35
So, I Made this little calculator but whenever I open in the Python shell it works great. But when I Run it through CMD it exits itself after the last Question. I'm new to python so yeah..
Code right here.
It is just a Little Mining Calculator.
Code right here.
choice = raw_input('What do you want to train? ')
if choice =='Mining':
ore = raw_input('Which ore? ')
if ore == 'Iron':
currentxp = raw_input('How much XP do you have? ')
desiredxp = raw_input('How much xp do you want? ')
difference = int(desiredxp) - int(currentxp)
orecount = int(difference) / 35
print 'You need to Mine '+str(orecount)+' more iron ores'
elif ore == 'Coal':
currentxp = raw_input('How much XP do you have? ')
desiredxp = raw_input('How much xp do you want? ')
difference = int(desiredxp) - int(currentxp)
orecount = int(difference) / 50
print 'You need to Mine '+str(orecount)+' more Coal ores'
elif ore == 'Gold':
currentxp = raw_input('How much XP do you have? ')
desiredxp = raw_input('How much xp do you want? ')
difference = int(desiredxp) - int(currentxp)
orecount = int(difference) / 65
print 'You need to Mine '+str(orecount)+' more Gold ores'
elif ore == 'Mithril':
currentxp = raw_input('How much XP do you have? ')
desiredxp = raw_input('How much xp do you want? ')
difference = int(desiredxp) - int(currentxp)
orecount = int(difference) / 80
print 'You need to Mine '+str(orecount)+' more Mithril ores'
elif ore == 'Adamantite':
currentxp = raw_input('How much XP do you have? ')
desiredxp = raw_input('How much xp do you want? ')
difference = int(desiredxp) - int(currentxp)
orecount = int(difference) / 95
print 'You need to Mine '+str(orecount)+' more Adamantite ores'
elif ore == 'Runite':
currentxp = raw_input('How much XP do you have? ')
desiredxp = raw_input('How much xp do you want? ')
difference = int(desiredxp) - int(currentxp)
orecount = int(difference) / 125
print 'You need to Mine '+str(orecount)+' more Runite ores'
It is just a Little Mining Calculator.
#2. Posted:
Status: Offline
Joined: Feb 11, 201212Year Member
Posts: 577
Reputation Power: 26
Status: Offline
Joined: Feb 11, 201212Year Member
Posts: 577
Reputation Power: 26
use this:
This means the use has to hit enter to continue.
raw_input(" ")
This means the use has to hit enter to continue.
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Dec 27, 201112Year Member
Posts: 696
Reputation Power: 35
Status: Offline
Joined: Dec 27, 201112Year Member
Posts: 696
Reputation Power: 35
Artificial wrote use this:
raw_input(" ")
This means the use has to hit enter to continue.
Of Course, Thanks for the help. +rep for you.
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Dec 27, 201112Year Member
Posts: 696
Reputation Power: 35
Status: Offline
Joined: Dec 27, 201112Year Member
Posts: 696
Reputation Power: 35
This still doesn't work, It's not about the Raw Input. I'm Guessing it's the last line where it says how much ore's you have to mine.
You can't use this:
Because it will print out '+str(orecount)+'
Any help?
( This works Perfect in the Python shell, But it exits when It comes to the last line in CMD. )
You can't use this:
print "You need to Mine '+str(orecount)+' more Mithril ores"
Because it will print out '+str(orecount)+'
Any help?
( This works Perfect in the Python shell, But it exits when It comes to the last line in CMD. )
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.