+ 1
Python question
Why dont i get ’yes’ printed out? https://code.sololearn.com/cESQhy6WCfp0/?ref=app
11 odpowiedzi
+ 3
If you want to keep your input function just add () after input to what FF9900 (Orange) sent.
inp = int(input())
Great help orange.
+ 1
FF9900 Suppose that i only want to check the sex and age attributes can i write it like this? The name is still in the list of objects, will this code ignore the name and check the rest?how about if the sex is written ’male’ instead of ’Male’?
from operator import attrgetter
if ['Male',30] == [*attrgetter(’sex','age')(personList[0])]:
print("Si!")
+ 1
And also u didn't write your input well ,. Add the parathenses
0
FF9900 William Owens doesnt work when i add the inp = int(input())
0
FF9900 i’m not really interested in it being a string, i actually want the attributes, meaning if the first person in the list is a male and 30 years old (dont care about his name but the name will also be included since its a list of objects)then ’yes’ should be printed
0
FF9900 it wasnt wrong input,i just wrote int(input) by mistake thats why it crashed, like i said i’m more interested in the attributes being a male and 30 years old not in them having the same form as ”Noname,Male,30” if you have better suggestions plz tell.
0
The input works, with python you have to be very detailed with your spaces or tabs for your blocks. White space matters in python..
0
Check your indentation.
Also
inp= int(input ())
Not int(input)
Also there are issues with your comments
0
This is actually one of the downsides of python programming ,. Indentation Error
You used inconsistent spacing for that code block
- 1
No
- 1
No