@hard axle
#not defined not working
42 messages · Page 1 of 1 (latest)
Can anyone tell me why isn't it working
Same problem as you had in your other help channel but with the letters
if number2 == 'a' or number2 == 'b' etc.
If fixed it by my own
Nice
Is it the type stuff or something else?
Nope something else
I set if input is equal to number then print a and when input is equal to latter print b and when input equal to anything else print c
But when i input anything else then latter it still shows b
The c part don't work
Can you share the code?
.
In the code
else :
new_number2 = "not defined"
this section is not working
Because you're checking the type. the type of "not defined" is str
Ik
So change elif type_number1 == "not defined" or type_number2 == "not defined": to use new_number1 and new_number2
elif type_number1 == "not defined" or type_number2 == "not defined":
print("error , input is not a number or latter")
I'm not sure how much feedback you want on all of this but it could be rewritten in a better way as wang tried to explain in your help channel
How
Ok but i just completed it , it has only one problem
I did change it , it is still working in the same way
Can you reshare what code you have now?
@hard axle
What are you expecting to happen? The code seems to be doing what you've asked it to do
$ py sum.py
write any two numbers to sum them
write your first number:
5
write your secound number :
4
sum of 5 and 4 is 9
$ py sum.py
write any two numbers to sum them
write your first number:
a
write your secound number :
b
sum of latters cannot be found
$ py sum.py
write any two numbers to sum them
write your first number:
not defined
write your secound number :
not defined
error , input is not a number or latter
I really think you should look into what wang suggested
Ok , so u typed not defined then it is showing not defined
I want if someone used anything else then latter and number it should show not defined
Eg if someone uses
--₹-₹-:_
Theses latter's it should say not defined
The problem is that's still a string
Ik , is there anyway to do this
Yeah, do what wang suggested 😅