Writing a chess-playing AI like Alphago in Python

2017-12-23 Thread Cai Gengyang
How many lines of code in Python would it take to create a Go-playing AI like AlphaGo ? Estimates ? -- https://mail.python.org/mailman/listinfo/python-list

Re: While, If, Count Statements

2017-11-28 Thread Cai Gengyang
On Tuesday, November 28, 2017 at 8:12:09 PM UTC+8, Frank Millman wrote: > "Cai Gengyang" wrote in message > news:a8335d2c-1fb9-4ba9-b752-418d19e57...@googlegroups.com... > > > > On Tuesday, November 28, 2017 at 4:18:04 PM UTC+8, Frank Millman wrote: > >

Re: While, If, Count Statements

2017-11-28 Thread Cai Gengyang
On Tuesday, November 28, 2017 at 4:18:04 PM UTC+8, Frank Millman wrote: > "Cai Gengyang" wrote in message > news:c2dfc9c4-3e16-480c-aebf-553081775...@googlegroups.com... > > > Sure, so how would the code look like if I want the "if" statement to be > >

Re: While, If, Count Statements

2017-11-28 Thread Cai Gengyang
On Tuesday, November 28, 2017 at 6:09:17 AM UTC+8, Ned Batchelder wrote: > On 11/27/17 7:54 AM, Cai Gengyang wrote: > > Input : > > > > count = 0 > > > > if count < 5: > >print "Hello, I am an if statement and count is", count > &g

While, If, Count Statements

2017-11-27 Thread nospam . Cai Gengyang
Input : count = 0 if count < 5: print "Hello, I am an if statement and count is", count while count < 10: print "Hello, I am a while and count is", count count += 1 Output : Hello, I am an if statement and count is 0 Hello, I am a while and count is 0 Hello, I am a while and count is 1

While, If, Count Statements

2017-11-27 Thread Cai Gengyang
Input : count = 0 if count < 5: print "Hello, I am an if statement and count is", count while count < 10: print "Hello, I am a while and count is", count count += 1 Output : Hello, I am an if statement and count is 0 Hello, I am a while and count is 0 Hello, I am a while and count is 1

Re: Searching For Old Posts On Python

2017-10-23 Thread Cai Gengyang
Right ... I am going to continue learning Python then ... On Thursday, October 19, 2017 at 3:39:44 AM UTC+8, Ian wrote: > On Mon, Oct 16, 2017 at 10:42 PM, Cai Gengyang <gengyang...@gmail.com> wrote: > > https://duckduckgo.com/html/?q=%22Cai%20Gengyang%22%20python

Re: Searching For Old Posts On Python

2017-10-16 Thread Cai Gengyang
https://duckduckgo.com/html/?q=%22Cai%20Gengyang%22%20python This seems to be the only method that works, using DuckDuckGo On Tue, Oct 17, 2017 at 4:54 AM, Thomas Jollans <t...@tjol.eu> wrote: > On 16/10/17 22:04, Cai Gengyang wrote: > > I cannot remember where I post

Re: Searching For Old Posts On Python

2017-10-16 Thread Cai Gengyang
On Tuesday, October 17, 2017 at 4:05:16 AM UTC+8, Cai Gengyang wrote: > I cannot remember where I posted the question it was a while ago .. > > On Mon, Oct 16, 2017 at 5:12 PM, Thomas Jollans <t...@tjol.eu> wrote: > > > On 2017-10-16 11:01, Cai Gengyang wrote: >

Re: Searching For Old Posts On Python

2017-10-16 Thread Cai Gengyang
I cannot remember where I posted the question it was a while ago .. On Mon, Oct 16, 2017 at 5:12 PM, Thomas Jollans <t...@tjol.eu> wrote: > On 2017-10-16 11:01, Cai Gengyang wrote: > > Does anyone here know a way I can search for and display all my old > posts on Pyt

Searching For Old Posts On Python

2017-10-16 Thread Cai Gengyang
Does anyone here know a way I can search for and display all my old posts on Python ? Thanks a lot. Gengyang -- https://mail.python.org/mailman/listinfo/python-list

Finding Old Posts on Python

2017-10-07 Thread Cai Gengyang
Hello, Does anyone know of a way to find all my old posts about Python ? Thanks a lot! GengYang -- https://mail.python.org/mailman/listinfo/python-list

Re: Boolean Expressions

2017-09-27 Thread Cai Gengyang
On Wednesday, September 27, 2017 at 1:01:50 PM UTC+8, Cameron Simpson wrote: > On 26Sep2017 20:55, Cai Gengyang <gengyang...@gmail.com> wrote: > >On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson wrote: > >> On 26Sep2017 14:43, Cai Gengyang <g

Re: Boolean Expressions

2017-09-26 Thread Cai Gengyang
On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson wrote: > On 26Sep2017 14:43, Cai Gengyang <gengyang...@gmail.com> wrote: > >Help check if my logic is correct in all 5 expressions > > Why not just run some code interactively? Unless this is entirely

Re: Boolean Expressions

2017-09-26 Thread Cai Gengyang
: > On Wed, Sep 27, 2017 at 7:43 AM, Cai Gengyang <gengyang...@gmail.com> wrote: > > Help check if my logic is correct in all 5 expressions > > > > > > A) Set bool_one equal to the result of > > False and False > > > > Entire Expression

Boolean Expressions

2017-09-26 Thread Cai Gengyang
Help check if my logic is correct in all 5 expressions A) Set bool_one equal to the result of False and False Entire Expression : False and False gives True because both are False B) Set bool_two equal to the result of -(-(-(-2))) == -2 and 4 >= 16 ** 0.5 -(-(-(-2))) is equal to 2, and 2

Printing a Chunk Of Words

2017-09-25 Thread Cai Gengyang
""" Boolean Operators True and True is True True and False is False False and True is False False and False is False True or True is True True or False is True False or True is True False or False is False Not True is False Not False is True """ If I simply

Re: Python Boolean Logic

2017-09-22 Thread Cai Gengyang
Input : # Assign True or False as appropriate on the lines below! # (20 - 10) > 15 bool_one = False# We did this one for you! # (10 + 17) == 3**16 # Remember that ** can be read as 'to the power of'. 3**16 is about 43 million. bool_two = False # 1**2 <= -1 bool_three = False # 40 * 4 >=

Python Boolean Logic

2017-09-22 Thread Cai Gengyang
Hey guys, I'm testing this on CodeAcademy, but I cant get the program to output a result even after pressing the run button. Just wanted to check if my logic is correct. Thanks alot # Assign True or False as appropriate on the lines below! # (20 - 10) > 15 bool_one = False# We did this one

Re: NameError

2016-11-25 Thread Cai Gengyang
ror, just a few > warnings that some features may no be available. > > Have you tried importing pygame after you did that? That's what'll prove > one way or another that it worked. > > Regards, > Nate > > On Wed, Nov 23, 2016 at 10:48 PM, Cai Gengyang <gengyang...@

Re: NameError

2016-11-24 Thread Cai Gengyang
, but take a few > minutes to understand what we're saying. See below for my reply to your > message (and an example of posting below quoted text). > > On 11/24/2016 08:05 AM, Cai Gengyang wrote: > > CaiGengYangs-MacBook-Pro:~ CaiGengYang$ python > > Python 2.7.10 (v2.7.10:15c

Re: NameError

2016-11-24 Thread Cai Gengyang
t; for more information. On Thursday, November 24, 2016 at 11:26:49 PM UTC+8, DFS wrote: > On 11/24/2016 10:09 AM, Cai Gengyang wrote: > > > Hmm, so whats the solution ? > > > One solution - not the solution - is: > > $ pip install pygame > Collecting pygame &

Re: NameError

2016-11-24 Thread Cai Gengyang
I mean whats the solution to import pygame ? How to import pygame ? On Thursday, November 24, 2016 at 11:22:07 PM UTC+8, alister wrote: > On Thu, 24 Nov 2016 07:09:22 -0800, Cai Gengyang wrote: > > > Hmm, so whats the solution ? > > > > > The solution is to bot

Re: NameError

2016-11-24 Thread Cai Gengyang
pygame Traceback (most recent call last): File "", line 1, in ImportError: No module named pygame >>> "import pygame" 'import pygame' >>> On Thursday, November 24, 2016 at 10:58:41 PM UTC+8, Thomas Nyberg wrote: > On 11/24/2016 09:00 AM, Cai G

Re: NameError

2016-11-24 Thread Cai Gengyang
Hmm, so whats the solution ? On Thursday, November 24, 2016 at 11:07:05 PM UTC+8, alister wrote: > On Thu, 24 Nov 2016 06:00:20 -0800, Cai Gengyang wrote: > > > CaiGengYangs-MacBook-Pro:~ CaiGengYang$ import pygame -bash: import: > > command not found > > > >

Re: NameError

2016-11-24 Thread Cai Gengyang
gt; Have you tried importing pygame after you did that? That's what'll prove > one way or another that it worked. > > Regards, > Nate > > On Wed, Nov 23, 2016 at 10:48 PM, Cai Gengyang <gengyang...@gmail.com> > wrote: > > > Yea, using Mac > > > > Foll

Re: NameError

2016-11-23 Thread Cai Gengyang
r/local/share/python/easy_install mecurial brew install sdl brew install sdl_mixer brew install sdl_ttf brew install sdl_image hg clone https://bitbucket.org/pygame/pygame cd pygame /usr/local/bin/python setup.py install Does this work ? On Thursday, November 24, 2016 at 12:00:18 PM UTC+8,

Re: NameError

2016-11-23 Thread Cai Gengyang
On Thursday, November 24, 2016 at 10:54:20 AM UTC+8, Joel Goldstick wrote: > On Wed, Nov 23, 2016 at 9:44 PM, Cai Gengyang <gengyang...@gmail.com> wrote: > >>>> pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) > > Traceback (most recent call last): > > File "<p

NameError

2016-11-23 Thread Cai Gengyang
>>> pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) Traceback (most recent call last): File "", line 1, in pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) NameError: name 'pygame' is not defined How to solve this error ? -- https://mail.python.org/mailman/listinfo/python-list

Function to take the minimum of 3 numbers

2016-10-09 Thread Cai Gengyang
I'm moving on to chapter 9 (http://programarcadegames.com/index.php?lang=en=lab_functions) of programarcadegames for the time being and going back to chapter 8 later (its just fucking frustrating and doesn't seem to work for the time being and I have a very bad temper). At least for chapter

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
9, 2016 at 11:42:33 AM UTC+8, Steve D'Aprano wrote: > On Sun, 9 Oct 2016 01:51 pm, Cai Gengyang wrote: > > > This is my latest result : I copy and pasted one line at a time into the > > IDLE and used ONLY the "enter-return" button to move on to the next line > > and

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
is not defined On Sunday, October 9, 2016 at 8:15:07 AM UTC+8, Gregory Ewing wrote: > Cai Gengyang wrote: > > Somehow it still doesnt work --- it keeps giving the syntaxerror, > > inconsistent use of tabs and indentation message EVEN though i use only the > &

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
r 8, 2016 at 1:21:50 PM UTC+5:30, Cai Gengyang wrote: > > > This is the result when I copy and paste it one line at a time : > > > > > > >>> rect_x = 50 > > > >>> rect_y = 50 > > > >>> while not done:

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
for event in pygame.event.get(): if event.type == pygame.QUIT: done = True SyntaxError: invalid syntax On Saturday, October 8, 2016 at 3:02:09 PM UTC+8, Steve D'Aprano wrote: > On Sat, 8 Oct 2016 05:29 pm, Cai Gengyang wr

Re: SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
what you get ... On Saturday, October 8, 2016 at 2:19:26 PM UTC+8, Steve D'Aprano wrote: > On Sat, 8 Oct 2016 05:02 pm, Cai Gengyang wrote: > > > Any idea how to correct this error ? Looks fine to me > > As usual, the first and most important rule of debugging is to use ALL

SyntaxError: multiple statements found while compiling a single statement

2016-10-08 Thread Cai Gengyang
Any idea how to correct this error ? Looks fine to me >>> rect_x = 50 # Main Program Loop --- while not done: for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close done = True # Flag that we are

Re: Nested for loops and print statements

2016-09-27 Thread Cai Gengyang
On Tuesday, September 27, 2016 at 2:14:05 PM UTC+8, Cai Gengyang wrote: > We're trying to help, but we need to know more about the > environment you're using to enter your code. > > What operating system are you using? --- OSX Yosemite Version 10.10.2 > > How are you runni

Re: Nested for loops and print statements

2016-09-27 Thread Cai Gengyang
, Gregory Ewing wrote: > Cai Gengyang wrote: > > I'll still be asking for help here. Please help out a newbie. > > We're trying to help, but we need to know more about the > environment you're using to enter your code. > > What operating system are you using? > > How a

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
and not locked up by a few academics and institutions. On Tuesday, September 27, 2016 at 6:00:40 AM UTC+8, bream...@gmail.com wrote: > On Monday, September 26, 2016 at 9:57:52 PM UTC+1, Cai Gengyang wrote: > > Ok it works now: > > > > >>>for row in range(10): &g

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
ement is one space different from each other. Forgive me if i can't explain things clearly over the forum On Tuesday, September 27, 2016 at 3:57:18 AM UTC+8, Larry Hudson wrote: > On 09/26/2016 08:25 AM, Cai Gengyang wrote: > > I just wanted to note that sometimes the code works, sometimes

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
What is a tab and what is a space in python and what's the difference ? Which piece of code is indented with tabs and which one is indented with spaces ? On Tuesday, September 27, 2016 at 12:40:16 AM UTC+8, MRAB wrote: > On 2016-09-26 16:25, Cai Gengyang wrote: > > I just wante

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
tember 26, 2016 at 5:36:26 PM UTC+8, Steven D'Aprano wrote: > On Monday 26 September 2016 18:32, Cai Gengyang wrote: > > > These are my attempts --- > > That's nice. Do you have a question? > > > > SyntaxError: inconsistent use of tabs and spaces in indentation > > Wh

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
tabs and spaces in indentation >>> for row in range(10): for column in range(10): print("*",end=" ") * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * On Monday, September 26, 2016 at 4:16:37 PM UTC+8, Steven D'Aprano wrote: > On Monday 26 September 2016 17:21, Jussi Piitul

Re: Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
So what do i need to do to correct the error ? Regards On Monday, September 26, 2016 at 2:48:16 PM UTC+8, Terry Reedy wrote: > On 9/26/2016 1:59 AM, Cai Gengyang wrote: > > Why is it that you need a print() at the end to create the table for > > example 1: &g

Nested for loops and print statements

2016-09-26 Thread Cai Gengyang
Why is it that you need a print() at the end to create the table for example 1: Example 1 --- >>> for row in range(10): for column in range(10): print("*",end=" ") # Print a blank line for next row print() * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Re: Data Types

2016-09-20 Thread Cai Gengyang
On Wednesday, September 21, 2016 at 11:22:42 AM UTC+8, Steve D'Aprano wrote: > On Wed, 21 Sep 2016 01:00 pm, Cai Gengyang wrote: > > > So I am going through chapter 7.1 (Data Types) of > > http://programarcadegames.com/index.php… What do these terms (input and > > outp

Data Types

2016-09-20 Thread Cai Gengyang
So I am going through chapter 7.1 (Data Types) of http://programarcadegames.com/index.php… What do these terms (input and output) mean --- Can someone explain in plain English and layman's terms ? Thanks a lot ... >>> type(3) >>> type(3.145) >>> type("Hi there") >>> type(True) --

Re: Python Indentation

2016-08-13 Thread Cai Gengyang
Yay ! On Sunday, August 14, 2016 at 1:40:09 AM UTC+8, Chris Angelico wrote: > On Sun, Aug 14, 2016 at 3:06 AM, Cai Gengyang <gengyang...@gmail.com> wrote: > > Oh ok, so for the first block , it works because the indentation is the > > same for all 3 "print" stateme

Re: Python Indentation

2016-08-13 Thread Cai Gengyang
"Indented two spaces.") print("Indented four. This will generate an error.") print("The computer will want you to make up your mind.") Am i correct ? On Saturday, August 13, 2016 at 7:12:19 PM UTC+8, Marko Rauhamaa wrote: > Cai Gengyang <

Python Indentation

2016-08-13 Thread Cai Gengyang
Indentation matters. Each line under the if statement that is indented will only be executed if the statement is true: if a == 1: print("If a is one, this will print.") print("So will this.") print("And this.") print("This will always print because it is not indented.")

Re: Why can't I define a variable like "miles_driven" with an underscore in Python 3.4.3 ?

2016-08-10 Thread Cai Gengyang
Yea, using IDLE on OSX, Python 3.4.3. Yeah it works now ... I had to increase the font size and the indentation width. When that happened , it could define miles_driven On Thursday, August 11, 2016 at 2:09:11 AM UTC+8, Zachary Ware wrote: > On Wed, Aug 10, 2016 at 12:39 PM, Cai Gengy

Why can't I define a variable like "miles_driven" with an underscore in Python 3.4.3 ?

2016-08-10 Thread Cai Gengyang
I managed to get this piece of code to work : >>> print("This program calculates mpg.") This program calculates mpg. >>> milesdriven = input("Enter miles driven:") Enter miles driven: 50 >>> milesdriven = float(milesdriven) >>> gallonsused = input("Enter gallons used:") Enter gallons used: 100

Re: How do I make a game in Python ?

2016-08-07 Thread Cai Gengyang
t;torr...@gmail.com> wrote: > > On 08/06/2016 03:51 PM, Cai Gengyang wrote: > >> As in, any recommended websites that helps users create complex games in > >> Python ? > > > > I imagine you create a complex game in Python the same way you'd do it > >

Re: How do I make a game in Python ?

2016-08-06 Thread Cai Gengyang
As in, any recommended websites that helps users create complex games in Python ? On Sunday, August 7, 2016 at 5:41:25 AM UTC+8, Ian wrote: > On Aug 6, 2016 11:57 AM, "Cai Gengyang" <gengyang...@gmail.com> wrote: > > How do I make a game in Python ? > &g

How do I make a game in Python ?

2016-08-06 Thread Cai Gengyang
How do I make a game in Python ? -- https://mail.python.org/mailman/listinfo/python-list

Re: Float

2016-07-30 Thread Cai Gengyang
number 8 + 5i is not a floating number because it is a complex number. Is 3.0 a floating number ? It is a rational number, not an integer right ? On Saturday, July 30, 2016 at 6:34:25 PM UTC+8, Steven D'Aprano wrote: > On Sat, 30 Jul 2016 08:21 pm, Cai Gengyang wrote: > > >

Re: Float

2016-07-30 Thread Cai Gengyang
Cool ... can you give a concrete example ? On Friday, July 29, 2016 at 10:27:08 PM UTC+8, Steven D'Aprano wrote: > On Fri, 29 Jul 2016 07:44 pm, Cai Gengyang wrote: > > > Can someone explain in layman's terms what "float" means ? > > Floating point number: >

Float

2016-07-29 Thread Cai Gengyang
Can someone explain in layman's terms what "float" means ? >>> x = float(input("Write a number")) Write a number 16 -- https://mail.python.org/mailman/listinfo/python-list

Python Print Error

2016-07-28 Thread Cai Gengyang
How to debug this ? >>> print "This line will be printed." SyntaxError: Missing parentheses in call to 'print' -- https://mail.python.org/mailman/listinfo/python-list

Python Print Error

2016-07-26 Thread Cai Gengyang
How to debug this error message ? print('You will be ' + str(int(myAge) + 1) + ' in a year.') Traceback (most recent call last): File "", line 1, in print('You will be ' + str(int(myAge) + 1) + ' in a year.') ValueError: invalid literal for int() with base 10: '' --

Re: An educational site written in Python (from YCombinator's RFS)

2016-05-13 Thread Cai Gengyang
rs As Paul Graham mentioned : "Startups are often ruthless competitors, but they're competing in a game won by making what people want." On Saturday, May 14, 2016 at 12:52:58 AM UTC+8, Ned Batchelder wrote: > On Friday, May 13, 2016 at 12:05:33 PM UTC-4, Cai Gengyang wrote: > &g

Re: An educational site written in Python (from YCombinator's RFS)

2016-05-13 Thread Cai Gengyang
poor generic design and are unappealing to look at. edx.org is a great example , perhaps a competitor / clone with different functionalities and better design , more videos, graphics , more interactive On Wednesday, May 11, 2016 at 3:07:17 AM UTC+8, DFS wrote: > On 5/10/2016 2:13

An educational site written in Python (from YCombinator's RFS)

2016-05-10 Thread Cai Gengyang
Ok, so after reading YCombinator's RFS, I have decided that I want to work on this : --- EDUCATION If we can fix education, we can eventually do everything else on this list. The

Re: Python PygLatin

2016-05-08 Thread Cai Gengyang
essay on meanness and success --http://paulgraham.com/mean.html On Monday, May 9, 2016 at 1:53:31 AM UTC+8, alister wrote: > On Mon, 09 May 2016 03:12:14 +1000, Steven D'Aprano wrote: > > > On Sun, 8 May 2016 08:21 pm, Cai Gengyang wrote: > >

Python PygLatin

2016-05-08 Thread Cai Gengyang
I just "clicked" through the lesson on Conditionals and Control Flows and am on the lesson "PygLatin" . This will hopefully be a more interesting and interactive lesson because I will be building a PygLatin Translator ... It seems to me like it will take a long time before I can reach the

Re: Conditionals And Control Flows

2016-05-04 Thread Cai Gengyang
statement is True bool_five = True and True --- This should give True because both statements are True On Wednesday, May 4, 2016 at 11:10:28 PM UTC+8, Jussi Piitulainen wrote: > Cai Gengyang writes: > > > I am trying to understand the boolean operator "and" in Pyth

Conditionals And Control Flows

2016-05-04 Thread Cai Gengyang
I am trying to understand the boolean operator "and" in Python. It is supposed to return "True" when the expression on both sides of "and" are true For instance, 1 < 3 and 10 < 20 is True --- (because both statements are true) 1 < 5 and 5 > 12 is False --- (because both statements are false)

Re: How to become more motivated to learn Python

2016-05-03 Thread Cai Gengyang
this piece is true On Wednesday, May 4, 2016 at 10:13:13 AM UTC+8, Christopher Reimer wrote: > On 5/3/2016 4:20 AM, Cai Gengyang wrote: > > So I have completed up to CodeAcademy's Python Unit 2 , now moving on to > > Unit3 : Conditionals and Control Flow. > > > > But I feel

How to become more motivated to learn Python

2016-05-03 Thread Cai Gengyang
So I have completed up to CodeAcademy's Python Unit 2 , now moving on to Unit3 : Conditionals and Control Flow. But I feel my motivation wavering , at times I get stuck and frustrated when trying to learn a new programming language ? This might not be a technical question per say, but it is a

Re: Python Madlibs.py code and error message

2016-05-03 Thread Cai Gengyang
Ok, I got it to work with no error message finally ... Enter a name: cai gengyang Enter an adjective: beautiful Enter a second adjective: honest Enter a third adjective: pretty Enter a verb: hit Enter a second verb: run Enter a third verb: jump Enter a noun: honesty Enter a noun: patience

Re: Python Madlibs.py code and error message

2016-04-27 Thread Cai Gengyang
I changed it to all lowercase, this time I get a different error message though (a TypeError message) # This program does the following ... writes a Mad Libs story # Author: Cai Gengyang print "Mad Libs is starting!" name = raw_input("Enter a name: ") adjective

Python Madlibs.py code and error message

2016-04-27 Thread Cai Gengyang
Python Madlibs.py code and error message --- Anyone can help? I keep getting stuck here ... # This program does the following ... writes a Mad Libs story # Author: Cai Gengyang print "Mad Libs is starting!" name = raw_input("Enter a name: ") adjective1 = raw_input

An Educational Software Platform written in Python

2015-11-28 Thread Cai Gengyang
So after reading YCombinator's new RFS, I have decided I want to build an educational software platform written in Python (mostly, if not entirely). Here is the description from YCombinator's RFS : If we can fix education, we can eventually do everything else on this list. The first attempts

Re: Returning a result from 3 items in a list

2015-11-25 Thread Cai Gengyang
:59:36 AM UTC+8, Ned Batchelder wrote: > On Tuesday, November 24, 2015 at 9:29:30 AM UTC-5, Mark Lawrence wrote: > > On 24/11/2015 14:07, Denis McMahon wrote: > > > On Tue, 24 Nov 2015 02:04:56 -0800, Cai Gengyang wrote: > > > > > >> Here's a dictionar

Returning a result from 3 items in a list

2015-11-24 Thread Cai Gengyang
Here's a dictionary with 3 values : results = { "gengyang": 14, "ensheng": 13, "jordan": 12 } How do I define a function that takes the last of the 3 items in that list and returns Jordan's results i.e. (12) ? Thanks a lot ! Gengyang --

Re: Returning a result from 3 items in a list

2015-11-24 Thread Cai Gengyang
Yup, thanks a lot ... it works now ! >>> results = { "gengyang": 14, "ensheng": 13, "jordan": 12 } >>> results["jordan"] 12 On Tuesday, November 24, 2015 at 6:40:26 PM UTC+8, Peter Otten wrote: > Cai Gengyang wrote: > >

Re: Returning a result from 3 items in a list

2015-11-24 Thread Cai Gengyang
defined >>> On Tuesday, November 24, 2015 at 6:14:43 PM UTC+8, Chris Angelico wrote: > On Tue, Nov 24, 2015 at 9:04 PM, Cai Gengyang <gengyang...@gmail.com> wrote: > > Here's a dictionary with 3 values : > > > > results = { > > "gengyang": 14,

Getting math scores (Dictionary inside dictionary)

2015-11-24 Thread Cai Gengyang
results = { "gengyang": { "maths": 10, "english": 15}, "ensheng": {"maths": 12, "english": 10}, "jordan": {"maths": 9, "english": 13} } How do you get gengyang's maths scores ? Thank you ... -- https://mail.python.org/mailman/listinfo/python-list

Re: Returning a result from 3 items in a list

2015-11-24 Thread Cai Gengyang
Its cool ... No problem On Tuesday, November 24, 2015 at 7:05:25 PM UTC+8, Chris Angelico wrote: > On Tue, Nov 24, 2015 at 9:35 PM, Peter Otten <__pete...@web.de> wrote: > > Yeah, the error message really should be > > > > "NameError: name 'result' is not defined; did you mean 'results'?" > > >

Re: Getting math scores (Dictionary inside dictionary)

2015-11-24 Thread Cai Gengyang
>> print((results["gengyang"])["maths"]) 10 On Tue, Nov 24, 2015 at 7:10 PM, Arie van Wingerden <xapw...@gmail.com> wrote: > print((results["gengyang"])["maths"]) > > 2015-11-24 12:04 GMT+01:00 Cai Gengyang <gengyang...@gmail.com>: > >

Finding scores from a list

2015-11-24 Thread Cai Gengyang
results = [ {"id": 1, "name": "ensheng", "score": 10}, {"id": 2, "name": "gengyang", "score": 12}, {"id": 3, "name": "jordan", "score": 5}, ] I want to find gengyang's score. This is what I tried : >>> print((results["gengyang"])["score"]) but I got an error message instead : Traceback (most

Creating a Dynamic Website Using Python

2015-11-23 Thread Cai Gengyang
Ok, So I have gone through the CodeAcademy Python modules and decided to jump straight into a project. I want to create a dynamic web-based site like this --- https://www.wedpics.com using Python How / where do I start ? Thanks a lot ! Gengyang --

Re: Creating a Dynamic Website Using Python

2015-11-23 Thread Cai Gengyang
Ok, I will look through the Flask tutorials then ... On Monday, November 23, 2015 at 8:21:28 PM UTC+8, Chris Angelico wrote: > On Mon, Nov 23, 2015 at 8:55 PM, Cai Gengyang <gengyang...@gmail.com> wrote: > > So I have gone through the CodeAcademy Python modules and decided to jum

Re: *= operator

2015-11-21 Thread Cai Gengyang
>>> bill = 100 >>> bill *= 1.08 >>> bill 108.0 >>> On Saturday, November 21, 2015 at 9:47:29 PM UTC+8, Frank Millman wrote: > "Cai Gengyang" wrote in message > news:a76b1b5b-4321-41bb-aeca-0dac78775...@googlegroups.com... >

*= operator

2015-11-21 Thread Cai Gengyang
This is a piece of code that calculates tax and tip : def tax(bill): """Adds 8% tax to a restaurant bill.""" bill *= 1.08 print "With tax: %f" % bill return bill def tip(bill): """Adds 15% tip to a restaurant bill.""" bill *= 1.15 print "With tip: %f" % bill

print("%.2f" % total)

2015-11-21 Thread Cai Gengyang
meal = 44.50 tax = 0.0675 tip = 0.15 meal = meal + meal * tax total = meal + meal * tip print("%.2f" % total) What do the lines inside the parentheses in this statement print("%.2f" % total) mean ? What does "%.2f" % total represent ? Thanks alot ... Gengyang --

Comparators

2015-11-21 Thread Cai Gengyang
Comparators, interesting ... >>> booltwo = (10 + 18) == 3**17 >>> booltwo False >>> boolone = (50 - 35) > 35 >>> boolone False >>> booltwo = (65 - 35) > 15 >>> booltwo True >>> boolalpha = 3 < 6 >>> boolalpha True >>> boolbeta = 100 == 10*30 >>> boolbeta False >>> --

Re: Comparators

2015-11-21 Thread Cai Gengyang
Hmm .. I am a slow learner and have poor memory. Sometimes when I see a new programming operator, I have to type it out so that I can remember it and let it sink into my brain On Sunday, November 22, 2015 at 6:24:28 AM UTC+8, Jon Ribbens wrote: > On 2015-11-21, Cai Gengyang <ge

Re: Traceback error

2015-11-20 Thread Cai Gengyang
: > "Cai Gengyang" wrote in message > news:e5d80196-61c5-44d9-bec8-dc563d58f...@googlegroups.com... > > > This is a piece of code about comparators : > > > > j# Assign True or False as appropriate on the lines below! > > [snip rest of code] > >

Traceback error

2015-11-20 Thread Cai Gengyang
his is the error I got : Traceback (most recent call last): File "python", line 1, in NameError: name 'j' is not defined Any ideas how to debug this ? Thanks a lot! Appreciate it Cai Gengyang -- https://mail.python.org/mailman/listinfo/python-list

Writing a Financial Services App in Python

2015-11-19 Thread Cai Gengyang
tire package. Thanks alot ! Cai Gengyang -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing a Financial Services App in Python

2015-11-19 Thread Cai Gengyang
. But this will be a tech-heavy company and all the main founders and employees should be excellent programmers. But for the moment, I plan to write the initial prototype myself ... On Friday, November 20, 2015 at 12:00:34 AM UTC+8, Michael Torrie wrote: > On 11/19/2015 04:59 AM, Cai Gengyang wr

Re: Writing a Financial Services App in Python

2015-11-19 Thread Cai Gengyang
: > On Thursday, November 19, 2015 at 7:00:05 AM UTC-5, Cai Gengyang wrote: > > From YCombinator's new RFS, This is the problem I want to solve as it is a > > severe problem I face myself and something I need. I want to write this app > > in Python as I heard that Python is a gre

A Program that prints the numbers from 1 to 100

2015-11-14 Thread Cai Gengyang
I want to write a program in Python that does this "Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"."

Execute Python Scripts

2015-10-14 Thread Cai Gengyang
So I am going through this article on Python for newbies ---http://askpython.com/execute-python-scripts/ Managed to create a file with these contents : 1 #!/usr/bin/env python3 2 3 print('hello world') and saved it as hello.py Next step, I wanted to open the 'command line' so I can type

Re: Execute Python Scripts

2015-10-14 Thread Cai Gengyang
y, October 15, 2015 at 1:47:50 AM UTC+8, Ian wrote: > On Wed, Oct 14, 2015 at 11:04 AM, Cai Gengyang <gengyang...@gmail.com> wrote: > > So I am going through this article on Python for newbies > > ---http://askpython.com/execute-python-scripts/ > > That looks like

Re: Execute Python Scripts

2015-10-14 Thread Cai Gengyang
On Thursday, October 15, 2015 at 1:18:27 AM UTC+8, paul.her...@gmail.com wrote: > > Where do I find the "command line" ? > > Welcome to Python. > > Starting a command shell depends on which operating system you are running. > > If you are on Microsoft Windows, choose the Start button, then type

Re: Help with Debugging

2015-09-28 Thread Cai Gengyang
.0006_require_contenttypes_0002... OK Applying sessions.0001_initial... OK CaiGengYangs-MacBook-Pro:mysite CaiGengYang$ On Monday, September 28, 2015 at 2:20:39 PM UTC+8, Andrea D'Amore wrote: > On 2015-09-28 05:26:35 +0000, Cai Gengyang said: > > > File "/Users/CaiGengY

Re: Django Tutorial (Database setup) Question

2015-09-27 Thread Cai Gengyang
^ SyntaxError: invalid syntax CaiGengYangs-MacBook-Pro:mysite CaiGengYang$ On Mon, Sep 28, 2015 at 12:08 AM, Joel Goldstick <joel.goldst...@gmail.com> wrote: > > > On Sun, Sep 27, 2015 at 3:32 AM, Cai Gengyang <gengyang...@gmail.com> > wrot

Help with Debugging

2015-09-27 Thread Cai Gengyang
http://pastebin.com/RWt1mp7F --- If anybody can find any errors with this settings.py file, let me know ! Can't seem to find anything wrong with it ... -- https://mail.python.org/mailman/listinfo/python-list

  1   2   >