Login Register


Python coding questions filter_list
Author
Message
Python coding questions #1
I'm learning Python and i'm wondering if there's a simple code for two things. I'm using Python 2.7.3

This code doesn't seem to work for me, any tips?
Code:
password1 = raw_input ("Please type in a password: ") password2 = raw_input ("Please retype the password: ") if password1 == password2: print "Password is created!" else: print "Sorry, passwords didn't match!"

And how can i make a simple game/app in Python?

Reply

RE: Python coding questions #2
http://www.hackcommunity.com/Thread-Pyth...The-Number
http://www.hackcommunity.com/Thread-Reso...ing-pygame

See our python section. Its full of beautiful things.
[Image: OilyCostlyEwe.gif]

Reply

RE: Python coding questions #3
(04-08-2014, 07:57 PM)Psycho_Coder Wrote: http://www.hackcommunity.com/Thread-Pyth...The-Number
http://www.hackcommunity.com/Thread-Reso...ing-pygame

See our python section. Its full of beautiful things.

Thank you Smile my internet is slow so it took me 50 days and 2 intense horse rides when i got my internet delivered from the wild west to even post this..

Reply

RE: Python coding questions #4
(04-16-2014, 01:00 PM)hhrk Wrote: pYTHON IS HARD CODING OR SIMPLE CODING

First thing don't type all in caps as it looks awful.

Secondly what do you mean by Hard Coding.


Python is a very simple programming language which is very easy to learn and yet its very powerful and has wide applications.
[Image: OilyCostlyEwe.gif]

Reply

RE: Python coding questions #5
(05-05-2014, 08:15 PM)acehoodie727 Wrote: TeemuStew I ran the code in my terminal and came across zero problems, worked fine for me

O.o still not working for me. I have no idea what's going on..

Reply

RE: Python coding questions #6
(05-06-2014, 08:26 AM)TeemuStew Wrote:
(05-05-2014, 08:15 PM)acehoodie727 Wrote: TeemuStew I ran the code in my terminal and came across zero problems, worked fine for me

O.o still not working for me. I have no idea what's going on..

What error/s are you getting? We can't help you if you don't post the error message!

Try to run python and execute the code line by line... and if you get an error try to understand it (this is how you learn)

Thanks
[Image: wvBFmA5.png]

Reply

RE: Python coding questions #7
(05-06-2014, 08:52 AM)Ligeti Wrote:
(05-06-2014, 08:26 AM)TeemuStew Wrote:
(05-05-2014, 08:15 PM)acehoodie727 Wrote: TeemuStew I ran the code in my terminal and came across zero problems, worked fine for me

O.o still not working for me. I have no idea what's going on..

What error/s are you getting? We can't help you if you don't post the error message!

Try to run python and execute the code line by line... and if you get an error try to understand it (this is how you learn)

Thanks

It just say's that it doesn't understand the line "print". And i'll try to reinstall it, it can't even understand the code "print Hello", and sometimes even crashes from it..

Reply

RE: Python coding questions #8
(05-06-2014, 09:08 AM)TeemuStew Wrote: It just say's that it doesn't understand the line "print". And i'll try to reinstall it, it can't even understand the code "print Hello", and sometimes even crashes from it..

OK, try this code:
Code:
password1 = raw_input ("Please type in a password: ") password2 = raw_input ("Please retype the password: ") if password1 == password2: print ("Password is created!") else: print ("Sorry, passwords didn't match!")

Please let me know if you still have problems

Thanks

[edit] here is what I got:
Code:
root@KALI:/home/ligeti# python Python 2.7.3 (default, Mar 14 2014, 11:57:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> password1 = raw_input ("Please type in a password: ") Please type in a password: mypass123 >>> password2 = raw_input ("Please retype the password: ") Please retype the password: mypass123 >>> if password1 == password2: ... print ("Password is created!") ... else: ... print ("Sorry, passwords didn't match!") ... Password is created!
[Image: wvBFmA5.png]

Reply

RE: Python coding questions #9
Hey! Have you check your Python IDE version? Your code seems to be of 2.7 so make sure you run it in Python 2.7 other than Python 3 because it'll give errors. Visit https://www.python.org/download/
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: Python coding questions #10
@Ex094 he already said he is using 2.7.3 (and not 3)

Quote:I'm using Python 2.7.3

But you are right of course Smile this is why I edited the code and added parentheses to print function, although both works for me and I am still running Python 2.7.3 as you can see in my results above!

Thanks and peace!
[Image: wvBFmA5.png]

Reply







Users browsing this thread: