Sinisterly
Python coding questions - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Python (https://sinister.ly/Forum-Python)
+--- Thread: Python coding questions (/Thread-Python-coding-questions)

Pages: 1 2


Python coding questions - TeemuStew - 04-08-2014

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?


RE: Python coding questions - Psycho_Coder - 04-08-2014

http://www.hackcommunity.com/Thread-Python-Game-Guess-The-Number
http://www.hackcommunity.com/Thread-Resource-Snake-game-Source-code-using-pygame

See our python section. Its full of beautiful things.


RE: Python coding questions - TeemuStew - 04-08-2014

(04-08-2014, 07:57 PM)Psycho_Coder Wrote: http://www.hackcommunity.com/Thread-Python-Game-Guess-The-Number
http://www.hackcommunity.com/Thread-Resource-Snake-game-Source-code-using-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..


RE: Python coding questions - Psycho_Coder - 04-16-2014

(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.


RE: Python coding questions - TeemuStew - 05-06-2014

(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..


RE: Python coding questions - Ligeti - 05-06-2014

(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


RE: Python coding questions - TeemuStew - 05-06-2014

(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..


RE: Python coding questions - Ligeti - 05-06-2014

(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!



RE: Python coding questions - Ex094 - 05-06-2014

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/


RE: Python coding questions - Ligeti - 05-06-2014

@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!