I am trying to loop a simple exception. I tried to put a while loop, but I keep
getting syntax issues. I also tried to alternatively use something on the lines
of while number != int also with no avail.
def main():
print(\t\tWelcome to Blackjack!\n)
names = []
try:
I am trying to use a __str__ method to display the values of attribute mood =
self.hunger + self. boredom.
When I try to execute I get this error:
Traceback (most recent call last):
File C:/Users/Vincent/Documents/Programming Tutorials/Python Programming for
the Absolute Beginner - Project
| JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423
-Original Message-
From: tutor-bounces+ramit.prasad=jpmchase@python.org
[mailto:tutor-bounces+ramit.prasad=jpmchase@python.org] On Behalf Of
Vincent
@python.org] On Behalf Of
Vincent Balmori
Sent: Thursday, June 30, 2011 1:49 PM
To: tutor@python.org
Subject: [Tutor] Blackjack Betting
I have been working on another challenge that involves improving the
Blackjack program so the players can wager an amount. If a player loses
I was able to get the program started without errors now. What is left now is
to:
Having the stash change after winning and losing. No matter what, the value
in stash stays the same. The conditional statement I made which prevents
players with no money from playing is dependent on this.
After
Also I must be doing something wrong if I have to enter a bet = Bet() into
each function where it is used. I tried putting Bet into the other classes'
arguments but it did not have any effect.
Emile van Sebille wrote:
On 7/1/2011 12:51 AM Andre Engels said...
In this case, the error
I am working on the card game of war challenge where each player is given a
single card and the highest value wins. I keep getting a Type Error since
for the moment since the values of the cards cannot be compared due to their
types. I am thinking of creating a Card_Value class that will give
I have been working on another challenge that involves improving the
Blackjack program so the players can wager an amount. If a player loses they
will be removed from the game. I keep getting the error: “NameError: global
name 'bet' is not defined.” I know I came across this error before in a
Alan Gauld wrote:
Vincent Balmori vincentbalm...@yahoo.com wrote
I'm on the Critter Caretake problem that involves handling more than
one
critter. I have looked At David Merrick's threads for some answers,
Given that David hasn't solved the problem yet that may not
be the best source
boundary as
well.
http://old.nabble.com/file/p31932639/TV.py TV.py
Noah Hall-3 wrote:
On Sun, Jun 26, 2011 at 2:02 AM, Vincent Balmori
vincentbalm...@yahoo.com wrote:
It's working better now. The problem I have left is that I have to set
the
channel and volume values in a range (for both I
I'm on the Critter Caretake problem that involves handling more than one
critter. I have looked At David Merrick's threads for some answers, but the
difference is that he created a whole new class to handle it, while I only
made more critter objects. The only problem I have left is to have my
The question for this is to make a program that simulates a TV by creating it
as an object. The user should be able to to enter a channel and or raise a
volume. Make sure that the Channel Number and Volume stay within valid
ranges. Before I can even start correcting my code this error shows up. I
adding/subtracting the value and the only way I can think how is to use a
list and then have the function replace the value each time. I'm sure there
is a better way though.
http://old.nabble.com/file/p31928968/TV TV
Alan Gauld wrote:
Vincent Balmori vincentbalm...@yahoo.com wrote
Before I can
I have to improve the trivia_challenge program so each question has a
different point value. I added a point into the text file after each
category line, so the next_block() can call it. Whenever the program
calculates the 'score = point' in main() it comes up with TypeError:
unsupported operand
***ignore the point = point line in the next_block() function.
--
View this message in context:
http://old.nabble.com/Trivia-tp31917610p31917637.html
Sent from the Python - tutor mailing list archive at Nabble.com.
___
Tutor maillist -
try:
point = int(next_line(the_file))
If x is a string that can be interpreted as an integer number, int(x) is
that integer number; if the string is not the representation of an integer,
this will lead to a ValueError.
--
André Engels, andreeng...@gmail.com
It's working fine now with the
explain more on what you mean by this?
Alan Gauld wrote:
Vincent Balmori vincentbalm...@yahoo.com wrote
It's working fine now with the scoring, but now at the end of the
program
for some reason I get this error message:
/Users/vincentbalmori/Desktop/Python/py3e_source/chapter07
understand how it works better.
def ask_number(question, low, high, step = 1):
Ask for a number within a range.
response = None
while response not in range(low, high, step):
response = int(input(question))
return response
-Vincent
Alan Gauld wrote:
Vincent Balmori
I answered another question that says Modify the guess_number program so
that the program's code is in a function called main(). Don't forget to call
main() so you can play the game. It seems to be working fine, but I would
like to have a second opinion if there was a better way to put it
From Steven D'Aprono:
* change the ask_number function
to accept a fourth argument;
* make it optional rather than
required;
* give it a sensible default
value;
* within the function, that value
must then be passed to range
Okay, I think I understand it better for the quesiton:
Improve the
def spam(n=3):
Return n slices of yummy spam.
return spam *n
And here it is in use:
spam(4)
'spam spam spam spam '
spam() # just use the default
'spam spam spam '
Can you see what I did to set the default value for n? Read the function
definition line def spam... carefully.
--
I am still working on that one question in the absolute beginners with the the
ask_number function and step value. Honestly, I still have no idea what to do.
This is one of my many attempts, but I know that it's wrong.
def ask_number(question, low, high):
Ask for a number within a range.
The question to that code I am trying to solve is
Improve the function ask_number() so that the function can be called with a
step value. Make the default value of step 1.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription
I am stuck on a question for Absolute Beginner's. I googled this and there have
been others who have not understood the question and I am also not clear on the
question he is asking. This function is a part of a tic tac toe
program.Improve
the function ask_number() so that the function can be
I'm stuck on two problems from the Absolute Beginners book. The first is
simple.
I am trying to print all the words in the list in random order without repeats,
but it always shows None for some reason.
#Program prints list of words in random order with no repeats
import random
#List of
Hello. Right now I am learning the python language through Python Programming
for the Absolute Beginner 3rd Edition. I am having trouble with one question in
Ch. 4 #3, which says Improve 'WordJumble so that each word is paired with a
hint. The player should be able to see the hint if he or she
For the Absolute Beginner 3rd Edition book, I am having trouble with another
question, which says create a game where the computer picks a random word and
the player must guess that word. The computer tells the player how many letters
are in the word. Then the player gets 5 chances to ask if a
Hello. Right now I am learning the python language through Python Programming
for the Absolute Beginner 3rd Edition. I am having trouble with one question in
Ch. 3 #2, which says Write a program that flips a coin 100 times and then
tells
you the number of heads and tails. Right now I am having
28 matches
Mail list logo