[Tutor] Beginning Python 3.4.0 Programmer:Stephen Mik: Cannot get input variable to make While Loop conditional to work

2014-04-21 Thread Stephen Mik
Dear Python Community:
    I am new to Python,with only about a month's experience. I am writing 
Python 3.4.0 code that apparently isn't doing what it should be doing. 
Specifically, I am inputting or trying to input,a Sentry Variable to a While 
Loop. I want to test out the Main program" While" Loop before I add an inner 
"While" Loop. The program I have written,when run on the Python 3.4.0 
Shell,does not stop for input of the "While" Sentry Variable,it just gives a 
program error: "Value of smv_grandVariable undefined". What am I doing wrong 
here? I'll try to post that part of the Code that is malfunctioning as well as 
Python Shell 3.4.0 Traceback Analysis. Please help if you can,this program is 
due on Thursday the 22nd of April,2014.#CS 110A Spring 2014 Sect 4988 Assignment 4
#MODIFIED GUESS MY NUMBER PROGRAM
#Date April ,2014
#Programmer Stephen W. Mik
#This program is modified after a version found
#in the TextBook "Python Programming 3rd Edition"
#by Michael Dawson Copyright 2010;ISBN-13: 978-1-4354-5500-9
#Or the Alternate ISBN-10: 1-4354-5500-2.
#It is based on the material found on page 50,and pages 81-84
#of the Book, along with a downloaded basic program Structyre
#"guess_my_number" ,found in the book companion's Website Files 
#"www.courseptr.com/downloads" Chapter 3.
##EXPLANATION OF GUESS MY 
NUMBER###
#This program uses a random number generator(supplied by Python 3.4.0) to
#to pick a changeable number between 1 and 60. The User is prompted to guess 
the number
#by inputting a guess at the prompt. The user is then advised whether the 
correct number
#has been guessed. If it has been guessed correctly,the user is congratulated. 
If the number
#has not been guessed correctly,the attempt is noted and quantified. then the 
user is told whether
# the guess number was too large (and then for the user to guess a lower 
number) or the number
#guessed was too small (and in this case for the user to guess a higher 
number). The number of
#attempted non-successful guesses is accumulated and totalled and then when 
finally the User guesses
#the correct number ; the guess attempts are outputted along with 
Congatulations. The User is queried
#if they want to play the game again,if not,the Program ends.
##
MAIN PROGRAM SECTION
#Use the random import module for a random number between 1 and 60

import random
print("\tWelcome to the Guess My Number Game! ")
print("\n The Mysterious Number to guess is between 1 and 60. ")
print("Try to guess the Mystery Number in as few tries as you can.\n")

#Enter Main Query Loop
print("Do you want to play the game?\n")
print("Enter a 1 to play or 0 to exit:")
 
input(smv_grandVariable)
while (smv_grandVariable == 1 and smv_grandVariable != 0):
#Enter the play games main loop area















#Take Control of the main While Loop
print("Do you want to run the Guess My Number game again? \n")
print("IF so, 1 to play again or 0 to not play \n")
input(smv_grandVariable)
#end of main control Loop
#print out ending comments
print("Program is Ended")



input("\n\nPress the enter key to exit. ")
#End of Program 
Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) [MSC v.1600 32 bit 
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>  RESTART 
>>> 
Welcome to the Guess My Number Game! 

 The Mysterious Number to guess is between 1 and 60. 
Try to guess the Mystery Number in as few tries as you can.

Do you want to play the game?

Enter a 1 to play or 0 to exit:
Traceback (most recent call last):
  File "E:\My Code\assignment4.py", line 37, in 
input(smv_grandVariable)
NameError: name 'smv_grandVariable' is not defined
>>> 
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Difficulty in getting logged on to python.org; want to resubscribe at the beginner level; finding "While" Loops in Python 3.4.0 to be extremely picky

2014-04-25 Thread Stephen Mik
Dear Sir(s):
    My name is Stephen W. Mik,my email address is "mik.step...@yahoo.com"; and 
I am having trouble logging on to the "Python Tutor Site". I desperately need 
HELP with a Python 3.4.0 "Guess A Number" Homework Assignment 4 which is due 
VERY SOON.. I recognize,and acknowledge,that I am a Python Programming amateur 
and some of my questions may seem trivial or naive;but a guy has to start 
somewhere.I was briefly on the mailing list for a few days;unsubscribed Apr. 
24,2014,and now I want to get back in,but am having trouble doing so. I have to 
do my programming in a shared computer lab(on Windows machines) 
Mondays,Tuesdays,Thursdays and limited hours on Friday because my home computer 
is a 2007 MacIntosh which I  can't configure to run Python 3.4.0. 
Anyway,people,I need help with Python as soon as I can get it.Thanks.
SINCERELY,Stephen W. Mik
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread Stephen Mik
Dear Python Tutor:
    Well,I am Stephen Mik,and I'm a beginning,rookie programmer who is just 
trying to get a class Assignment going. The instructor of my class does not 
accept email and she is not on Campus on Monday. So,my only recourse is to turn 
to Python Tutor for assistance.

    My program, Assignment4,does run partially. You can see the results of the 
Python Shell attached to this email. I also have included part of my code for 
your perusal.

    I must be doing something very wrong. The program is supposed to run a main 
loop ,for control of the program. The program DOES print out the prompts before 
the While Loop, but when it comes to a variable named"smv_guessNumber" the 
program DOES NOT prompt for the input for "smv_guessNumber" as it should. It is 
a mystery to me as to why the program will not get to the 
"smv_guessNumber=int(input("Think out a first guess:")". I am mystified why it 
doesn't reach that point in the program! Can anyone please help? I have 
attached the Python Traceback Error Output,which shows that at least part of 
the program IS working. I also have attached part of the code for the 
Assignment 4 which should help in the debugging.I need help ASAP,another 
program is due very soon and I have not even worked out the pseudocode for it 
yet!
CONCERNED,Stephen W. Mik
#CS 110A Spring 2014 Sect 4988 Assignment 4
#MODIFIED GUESS MY NUMBER PROGRAM
#Date April ,2014
#Programmer Stephen W. Mik
#This program is modified after a version found
#in the TextBook "Python Programming 3rd Edition"
#by Michael Dawson Copyright 2010;ISBN-13: 978-1-4354-5500-9
#Or the Alternate ISBN-10: 1-4354-5500-2.
#It is based on the material found on page 50,and pages 81-84
#of the Book, along with a downloaded basic program Structyre
#"guess_my_number" ,found in the book companion's Website Files 
#"www.courseptr.com/downloads" Chapter 3.
##EXPLANATION OF GUESS MY 
NUMBER###
#This program uses a random number generator(supplied by Python 3.4.0) to
#to pick a changeable number between 1 and 60. The User is prompted to guess 
the number
#by inputting a guess at the prompt. The user is then advised whether the 
correct number
#has been guessed. If it has been guessed correctly,the user is congratulated. 
If the number
#has not been guessed correctly,the attempt is noted and quantified. then the 
user is told whether
# the guess number was too large (and then for the user to guess a lower 
number) or the number
#guessed was too small (and in this case for the user to guess a higher 
number). The number of
#attempted non-successful guesses is accumulated and totalled and then when 
finally the User guesses
#the correct number ; the guess attempts are outputted along with 
Congatulations. The User is queried
#if they want to play the game again,if not,the Program ends.
##
MAIN PROGRAM SECTION
#Use the random import module for a random number between 1 and 60

import random
print("\tWelcome to the Guess My Number Game! ")
print("\n The Mysterious Number to guess is between 1 and 60. ")
print("Try to guess the Mystery Number in as few tries as you can.\n")

#Enter Main Query Loop
print("Do you want to play the game?\n")
print("\n")
 
smv_grandCounter=int(input("Enter a 1 to play or 0 to exit: "))

while(smv_grandCounter=="1"):
  #Enter the play game main loop area
  smv_pickNumber=random.randint(1,60)
  #Create by the computer by random number generator a mystery number
  #Load random number into smv_pickNumber for storage
  #Initialize the variable smv_attemptCounter to 1 for 1 initial pass through 
the inner boundary values loop
  smv_attemptCounter=1
  #Get first pick for Number Identification Loop
  #Initialize smv_guessNumber so Number Identification Loop can proceed with 
Conditional
  print("Think out a first guess between 1 and 60:")
  smv_guessNumber= int(input("Take a guess!"))
  #Enter Number Identification Loop
while(smv_guessNumber!=smv_pickNumber):
  if (smv_guessNumber>smv_pickNumber):
print("Guess of mystery number Too high,enter a lesser number: \n")
smv_attemptCounter+=1
  elif (smv_guessNumber < smv_pickNumber):
print("Guess of mystery number Too Low.Enter a greater number \n")
smv_attemptCounter+=1
  elif (smv_guessNumber == smv_pickNumber):
#Print Congratulatory Message,the mystery number,the number of attempts
print("Congratulations! You have guessed the mystery number")
print("You have used",smv_attemptCounter,"sample picks.\n")
print("The mystery number was: ",pick_Number)
print("You have utilized",smv_attemptCounter,"attempts

[Tutor] "Guess My Number" Python 3.4.0 Program partially fixed but now has Logic Errors-by Stephen Mik-novice programmer-getting desperate

2014-04-29 Thread Stephen Mik
Dear Sir(s):
    I am new to Python programming,and I have a "Guess My Number" program which 
partially works. The main while control works,the guessing of an integer 
between 1 and 60 seems to give the "too high" or "too low" elif branches 
effectively. However,when the correct number is guessed the "elif" for the 
Congratulatory Message does not print out,and the number of attempts at 
guessing the mystery number does not print out. Instead, the program apparently 
goes into the main while control loop again and queries the User if they want 
to run the program again. I have attached a sample Python Shell run;along with 
code fragments of the relevant areas. Anybody,please help me work out this code 
and get "Guess My Number" correctly running.
CONCERNED,Stephen W. Mik
#CS 110A Spring 2014 Sect 4988 Assignment 4
#MODIFIED GUESS MY NUMBER PROGRAM
#Date April ,2014
#Programmer Stephen W. Mik
#This program is modified after a version found
#in the TextBook "Python Programming 3rd Edition"
#by Michael Dawson Copyright 2010;ISBN-13: 978-1-4354-5500-9
#Or the Alternate ISBN-10: 1-4354-5500-2.
#It is based on the material found on page 50,and pages 81-84
#of the Book, along with a downloaded basic program Structyre
#"guess_my_number" ,found in the book companion's Website Files 
#"www.courseptr.com/downloads" Chapter 3.
##EXPLANATION OF GUESS MY 
NUMBER###
#This program uses a random number generator(supplied by Python 3.4.0) to
#to pick a changeable number between 1 and 60. The User is prompted to guess 
the number
#by inputting a guess at the prompt. The user is then advised whether the 
correct number
#has been guessed. If it has been guessed correctly,the user is congratulated. 
If the number
#has not been guessed correctly,the attempt is noted and quantified. then the 
user is told whether
# the guess number was too large (and then for the user to guess a lower 
number) or the number
#guessed was too small (and in this case for the user to guess a higher 
number). The number of
#attempted non-successful guesses is accumulated and totalled and then when 
finally the User guesses
#the correct number ; the guess attempts are outputted along with 
Congatulations. The User is queried
#if they want to play the game again,if not,the Program ends.
##
MAIN PROGRAM SECTION
#Use the random import module for a random number between 1 and 60

import random
print("\tWelcome to the Guess My Number Game! ")
print("\n The Mysterious Number to guess is between 1 and 60. ")
print("Try to guess the Mystery Number in as few tries as you can.\n")

#Enter Main Query Loop
print("Do you want to play the game?\n")
print("\n")
 
smv_grandCounter=int(input("Enter a 1 to play or 0 to exit: "))

while(smv_grandCounter==1):
  #Enter the play game main loop area
  smv_pickNumber=random.randint(1,60)
  #Create by the computer by random number generator a mystery number
  #Load random number into smv_pickNumber for storage
  #Initialize the variable smv_attemptCounter to 1 for 1 initial pass through 
the inner boundary values loop
  smv_attemptCounter=1
  #Get first pick for Number Identification Loop
  #Initialize smv_guessNumber so Number Identification Loop can proceed with 
Conditional
  print("Think out a first guess between 1 and 60:")
  smv_guessNumber= int(input("Take a guess!"))
  #Enter Number Identification Loop
  while(smv_guessNumber!=smv_pickNumber):
if (smv_guessNumber > smv_pickNumber):
  print("Guess of mystery number Too high,enter a lesser number: \n")
  smv_attemptCounter+=1
elif (smv_guessNumber < smv_pickNumber):
  print("Guess of mystery number Too Low.Enter a greater number \n")
  smv_attemptCounter+=1
elif (smv_guessNumber == smv_pickNumber):
  #Print Congratulatory Message,the mystery number,the number of attempts
  print("Congratulations! You have guessed the mystery number")
  print("You have used",smv_attemptCounter,"sample picks.\n")
  print("The mystery number was: ",pick_Number)
  print("You have utilized",smv_attemptCounter,"attempts")
else:
  print("You have entered a decimal number,a negative number or some other 
Alphanumeric character")
  print("Redo the loop with the correct values")
#Continue the loop,increment the number of attempts
smv_attemptCounter+=1
print("Enter a new integer guess:\n")
smv_guessNumber=int(input("Take a new guess!"))
#End the inner while Loop
  print("Do you want to run the game again?")
  #Stop the game,enter any integer number except 1
  print("enter 1 to continue the game,other integer to end the game \n")
  smv_grandCounter=int(input("Enter 1 to continue or 0 to stop the game: "))
  #print out the variable names and their corresponding labels
  print ("smv_grandCounter:Used in the Main Program While Loop as a Sentry 
Variable for p

[Tutor] Stephen Mik-Novice Python Programmer(Version 3.4.0)Can't get help using Dictionaries, Lists to 'Hangman Game Problem"

2014-05-04 Thread Stephen Mik
Dear Python World:
    I am almost brand new to Python 3.4.0 and am taking a beginning Python 
Programming class at the nearby Community College. One major problem I have is 
time management with beginning pseudo code and coding for my Class Assignments. 
The instructor prefers Office Hour help,and does not respond to email.
    One of my Class Assignments due on May 9,2014 deals with making a version 
of the "Hangman Game" which I'm sure somebody out there is familiar with. The 
program problem says to use 1.Dictionaries 2. Lists 3.Embedded While lists 
4.for loops and more. I can refer to the Textbook for the class to get a basic 
idea of what some of the code will look like,but I cannot fathom how to use a 
Dictionary or List  in order to enhance the Basic Hangman Game Problem in the 
text  (written by Michael Dawson). The Text does cover 
"Dictionaries","Lists","While Loops","For Loops" but doesn't "amplify" and show 
with examples how some of these Data Structures can be used. And my 
instructor's Assignment directions are very terse and "you do it by yourself". 

    If I can't get some ideas and hints from the Python Community by Monday,May 
5,2014, I will have to hold off this difficult  programming assignment until 
Tuesday,May 6,2014 when the instructor will be available to help. That leaves 
me just 3 days to pseudocode,code in Python,fix syntax and run-time and Logical 
errors before I can turn it in by Friday,May 16,2014. The instructor will only 
probably give me a suggestion and not some tangible ideas.Any thoughts out 
there about how to implement the Loops and Data Structures into a "Hangman 
Game" programming problem?
SINCERELY,Stephen W. Mik___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Alert to all Experienced Python Software Object Oriented Programmers-Novice Needs Help In Understanding Textbook

2014-08-17 Thread Stephen Mik
Greetings Python Community:
I am new to Computer Programming with Python,having finished an 8 week 
Introductory Course. The Instructor used the Textbook:"Python Programming,3rd 
Edition (for the absolute beginner) by Michael Dawson;Cengage Learning, Course 
Technology Copyright 2010 ISBN-13: 978-1-4354-5500-9  ISBN-10: 1-4354-5500-2.
The course only covered the Chapters 1-6 in the book. I have accomplished some 
reading of my own,Chapter 7 which I understood; but ran into stiff headwinds 
when I tried to read Ch.8,"Software Objects:The Critter Caretaker Program". I 
hope that some of you have the textbook or can look it up online,because I have 
many questions about the Text's treatment of Software Objects. (I'm scheduled 
to take a JavaScript class shortly and since that is object-oriented I really 
need to get this OOP down). Specifically,the Text on pages 222-232 I am finding 
the whole discussion on "Instantiating an 
Object","Methods","Constructors","Attributes-on page 226-228,Using Class 
Attributes and Static Methods(page 228-230;Creating A Class Attribute,Accessing 
a Class Attribute(Pg. 231);Using and Invoking a Static Method (pages 231-232) 
is all confusing to me and doesn't "congeal" or "come Together" in one coherent 
discussion. Forgive me if I seem dense;but this chapter has a lot
 of heavy reading in it! Please,somebody,explain the magic of Software Objects 
in Python to me ASAP. Thanks!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor