Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - blankanon

Pages: [1] 2
1
Scripting Languages / Re: Python Easy Examples help
« on: August 17, 2011, 03:55:06 am »
Then stop posting skiddy code here, google dipshit. You know when learning to program, I've never had to ask anyone on a forum for help.

Cus you're a moron.

yeah seems to be problem with you too, never said it was from lectures.. I was actually replying to this:
 
 
ouch btw, -1 really hurts :'(


The feeble minded always resort to insults. 

2
Scripting Languages / Re: Python Easy Examples help
« on: August 17, 2011, 03:22:21 am »
Your code makes absolutely no sense. If you were able to get input in your R/P/S game, why'd you change it? Do you have any idea what input() & eval() do? Do you know what this means:

TypeError: eval() arg 1 must be a string or code object

and why python is telling you this. If not, find out. This is where learning starts... Not asking others to fix your code for you.

And yeah, your video lecture is a horrible idea.. Your time, not mine.


First of all, I didn't ask anyone to fix my code.  I guess reading is optional on this forum.  I wanted to know why that error was occurring.  I was putting in numbers but it wasn't working. Furthermore, this problem I obtained from a book not the lectures.  If you read what I wrote, I stated that.


If you want to comment on my post, read first.  Type second.

3
Scripting Languages / Re: Python Easy Examples help
« on: August 17, 2011, 02:14:23 am »
The book I am using used that for this program.

4
Scripting Languages / Re: Python Easy Examples help
« on: August 17, 2011, 01:25:24 am »


Learning programming through videos seems like a bad idea to me. Just read a regular tutorial. Once you got a hang of python, then you could research specific things that interest you.




The videos are great since they are actually lecture videos. 


Code: [Select]
# Calculates the FV of an investment
# Compoud interest

def main():
    print("This program calculates FV of an investment")


    principal = eval(input("Enter the initial investment: "))
    apr = eval(input("Enter the apr: "))
    years = eval(input("Enter years of investment: "))


    for i in range(years):
        principal = principal * (1 + apr)


    print("The value in", years, "is:", principal)


I keep getting:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    main()
  File "C:/Python27/Projects/FV calculator.py", line 7, in main
    principal = eval(input("Enter the initial investment: "))
TypeError: eval() arg 1 must be a string or code object


This happens whenever I enter a number in.

5
Scripting Languages / Re: Python Easy Examples help
« on: August 16, 2011, 03:57:51 am »
I am not trying nor I am an ass - I am being fairly good.
Since this is a forum, I can't hear your voice tone, so admit it that it was your fault that you did not refer to the OXO game asking you did not understand, yet you did quote that line, therefore I assumed you were referring to that line seeing as the referring sentence is after the dot after the sentence that explains your lack of skill in Python, which was stated in Kreek's post.


You made the cardinal sin--you assumed.  I was fairly clear in the structure of my sentence that I was speaking of a something in the past and not present (i.e. not the current thread post).


However, I need to focus on programming not the semantic interpretations of the word "didn't".




6
Scripting Languages / Re: Python Easy Examples help
« on: August 15, 2011, 09:13:12 pm »
Again... you should have googled... http://en.wikipedia.org/wiki/OXO

I don't know but unless you lrn2google, you won't seem to able to learn anything...


I never said I didn't understand what OXO meant.  I was referring to Kreek comments minus the edit piece. 

That should have been easily inferred by the past tense (didn't).  If I would have said I don't, then it would have been implying the current post.

Even though you are an admin, don't be an ass just to be one.

7
Scripting Languages / Re: Python Easy Examples help
« on: August 15, 2011, 01:06:18 am »
But i'm talking about this:
That's quite an easy error to fix... You should be able to fix those errors. And if you don't, try to search the internet for your error. And al those things don't work, then post here.


EDIT: Try to make me a OXO-game. ;)


This is only my 3rd day on Python.  I didn't understand what that meant.

8
Scripting Languages / Re: Python Easy Examples help
« on: August 14, 2011, 09:46:28 pm »
At least he is programming... But you have a point Kul, like the question with the quotes could be easily been avoided by just trying on your own. But I like his dedication?

@TS
Keep trying, keep making small games like this! When you got problems, just try solve it on your own. And if you got questions after you tried, just post here!


That is what I do.  If I can't figure it out or I am not sure, I ask.

Additionally, I have been watching MIT's OpenCourseWare videos on Introduction to Computer Science and Programming since they use Python.

9
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 05:55:50 am »
I know Latex.  However, it won't work on the site unless it is set up.

10
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 05:04:12 am »
I am working on another practice project.  I understand the question, but I am confused by it if that makes sense.


The problem is as stated:


Using a for loop, write a program that prints out the decimal equivalents of 1/n where [tex]n\in\mathbb{Z}[/tex] and [tex]1 \leq n \leq 10[/tex]. 


Does Latex work on this site?  If not, who can I ask about having it installed?


Thanks.

11
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 04:44:10 am »
That was it thanks.

12
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 04:23:41 am »
So how can I get it to print "Tie" once and then re-start the game?


13
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 04:16:49 am »
Thanks put the quotes in, but if there is a tie, the output is an infinite loop of ties.

14
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 04:01:42 am »
So here is what I tried and I was told rock isn't defined line 9



Code: [Select]
p1win = "Player 1 wins!"
p2win = "Player 2 wins!"
player1 = raw_input ("Player 1? ") # player 1's move
player2 = raw_input ("Player 2? ") # player 2's move
retry = True


while (retry):
    retry = False
    if player1 == rock:
          if player2 == scissors:
              print p1win
          elif player2 == paper:
              print p2win
          elif player2 == rock:
              print "Tie"
              retry = True
    elif player1 == scissors:
          if player2 == rock:
              print p2win
          elif player2 == paper:
              print p1win
          elif player2 == scissors:
              print "Tie"
              retry = True
    elif player1 == paper:
          if player2 == rock:
              print p1win
          elif player2 == scissors:
              print p2win
          elif player2 == paper:
              print "Tie"
              retry = True


15
Scripting Languages / Re: Python Easy Examples help
« on: August 13, 2011, 01:01:57 am »
Rock, Paper, Scissors game:



Code: [Select]
player1 = raw_input ("Player 1? ") # player 1's move
player2 = raw_input ("Player 2? ") # player 2's move


if (player1 == 'rock' and player2 == 'scissors'):
    print 'Player 1 wins!'


elif (player1 == 'rock' and player2 == 'paper'):
    print 'Player 2 wins!'


elif (player1 == 'scissors' and player2 == 'rock'):
    print 'Player 2 wins!'


elif (player1 == 'scissors' and player2 == 'paper'):
    print 'Player 1 wins!'


elif (player1 == 'paper' and player2 == 'scissors'):
    print 'Player 2 wins!'


elif (player1 == 'paper' and player2 == 'rock'):
    print 'Player 1 wins!'


elif (player1 == player2):
    print 'Tie.'


How can I make this start over if there is a tie? 
How can I make this not care if there are capital letters inputted?


Thanks.
   

Pages: [1] 2