27 августа 2022
I Cprint(5 and 4 and -3) can we explain why the result -3
It returns the last truthy value. In this case, any number that isn't zero is considered a truthy value. However, any falsy value beyond in the sequence causes the conditional expression to return that falsy value.
For example,
print(False and 5) #gets False
print(0 and 5) #gets 0
MiguelAlguien sabe por que me da de resultado 9 cuando son mas letras las que hay en el full_name. ???
Don't understand what you have written but you need to remove single quotes.
id 696856710Don't understand what you have written but you need to remove single quotes.
thank you very much, I didn't notice the quotes 😅😅😅
MiguelHelp please: in exercise 3 of level 2 of day 2 it states that: Compare the length of your first name and your last name, but I can't find where it has been seen before how to make a comparison
I don't remember exactly but
Try getting Length of firstname and lastname. Using if condition return if they are equal or not.
Take 2 inputs from user or break input into first name and last name.
id 696856710I don't remember exactly but
Try getting Length of firstname and lastname. Using if condition return if they are equal or not.
Take 2 inputs from user or break input into first name and last name.
Thank you very much Naruto, I'll see if I clarify myself 🙂
MiguelThank you very much Naruto, I'll see if I clarify myself 🙂
No problem. Drop me a text and i will try to guide you.
MiguelHelp please: in exercise 3 of level 2 of day 2 it states that: Compare the length of your first name and your last name, but I can't find where it has been seen before how to make a comparison
first_name = "Jose"
last_name = "Da Silva"
if len(first_name) > len(last_name):
print("Mi nombre es mas largo que mi apellido")
else:
print("Mi apellido es mas largo que mi nombre")
jmcriptosfirst_name = "Jose"
last_name = "Da Silva"
if len(first_name) > len(last_name):
print("Mi nombre es mas largo que mi apellido")
else:
print("Mi apellido es mas largo que mi nombre")
Hey, if you send them code how will they try? Just guide and let them learn.
id 696856710Hey, if you send them code how will they try? Just guide and let them learn.
Just send the way I solved it, it doesn't mean it's the right way. I'm also new to Python.
jmcriptosJust send the way I solved it, it doesn't mean it's the right way. I'm also new to Python.
Ik you are new but this is not the right way. But that's my opinion.
Also, you can optimise your solution. Whole if condition can be summarised in one line. Look at that approach
id 696856710Ik you are new but this is not the right way. But that's my opinion.
Also, you can optimise your solution. Whole if condition can be summarised in one line. Look at that approach
first_name = "Jose"
last_name = "Da Silva"
print("Mi nombre es mas largo que mi apellido") if len(first_name) > len(last_name) else print("Mi apellido es mas largo que mi nombre")