+ 1

Python question

Why dont i get ’yes’ printed out? https://code.sololearn.com/cESQhy6WCfp0/?ref=app

28th Feb 2022, 9:43 PM
Lenoname
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.
28th Feb 2022, 10:09 PM
William Owens
William Owens - avatar
+ 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!")
28th Feb 2022, 11:18 PM
Lenoname
+ 1
And also u didn't write your input well ,. Add the parathenses
2nd Mar 2022, 1:02 PM
Pythøñ Cúltîst⚔️🔥🇳🇬
Pythøñ  Cúltîst⚔️🔥🇳🇬 - avatar
0
FF9900 William Owens doesnt work when i add the inp = int(input())
28th Feb 2022, 10:32 PM
Lenoname
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
28th Feb 2022, 10:37 PM
Lenoname
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.
28th Feb 2022, 10:45 PM
Lenoname
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..
28th Feb 2022, 10:54 PM
William Owens
William Owens - avatar
0
Check your indentation. Also inp= int(input ()) Not int(input) Also there are issues with your comments
2nd Mar 2022, 11:56 AM
David Boateng
0
This is actually one of the downsides of python programming ,. Indentation Error You used inconsistent spacing for that code block
2nd Mar 2022, 1:02 PM
Pythøñ Cúltîst⚔️🔥🇳🇬
Pythøñ  Cúltîst⚔️🔥🇳🇬 - avatar
- 1
No
2nd Mar 2022, 4:42 PM
Solopro
- 1
No
2nd Mar 2022, 4:42 PM
Solopro