[Tutor] if statement problems(noob question)

2013-04-08 Thread Max Smith
Hi, everyone whom might read this, im Max and i am really new to coding,
been going at it for about two weeks using codeacademy and the book "think
python".
when i decided to experiment a little with if statements i ran into the
following problem:

def plus(x,y):
if x and y == int or float:
print "The answer is: " + str(x+y)

else:
print "not a number"


plus(2,2)
plus("one","two")

concatenates one and two insted of printing "not a number"

i have tried to simplify by not cheacking for float values an i have also
tried.

def plus(x,y):
if x and y == int or float:
print "The answer is: " + str(x+y)

elif x or y != int or float:
print "not a number"

Am i perhaps missing something with the logic gates?

Any help is greatly appreciated !
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Questions

2017-07-18 Thread Max Smith
I have some questions about python.



What's the easiest way to learn python currently I'm using google's excersise 
program, I'm just reading and making notes then testing out what I have learnt. 
Since I' need to understand python fully as I've got a exam in Python for my 
GCSE's if you could give me some tips. I'd be excited to hear.



Thanks very Much,

Max.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor