Python function that returns a Boolean result based on whether the string parameter passed in is an integer. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Python function that returns a Boolean result based on whether the string parameter passed in is an integer.

Ex 123=True but 123.0= false

27th Aug 2021, 2:46 PM
Kavitha AV
11 Answers
+ 5
Sandesh Patil , please do not start a new discussion inside the feed of an other person. > it would be better if you start your own question, because the current discussion started long time ago. hence people may not be aware of your question.. > to give helpful support we need to see your attempt first. without having seen your code we do not know what your issue is.
14th Jan 2023, 5:53 PM
Lothar
Lothar - avatar
0
Invalid syntax
27th Aug 2021, 3:01 PM
Kavitha AV
0
Ok
27th Aug 2021, 3:19 PM
Kavitha AV
0
Andrew Choi , please try to avoid giving solutions or code to the asker, if he has not presented his attempt. thanks for your understanding!
27th Aug 2021, 3:37 PM
Lothar
Lothar - avatar
0
Lothar i actually am not understanding and feel extremely disrespected that you would attempt to tell me what i can or cannot post. i have seen your posts and find them very helpful and i have respect for what i have seen from you. i will continue to post what i feel like posting and contribute in my own way to assist and learn from others in the programming environment. thanks for your understanding!
27th Aug 2021, 6:01 PM
you are smart. you are brave.
you are smart. you are brave. - avatar
0
Anybody knows online part time job sites
17th Jan 2022, 5:29 PM
Kavitha AV
0
Write a Python function that returns a boolean result based on whether the string parameter passed in is an integer
14th Jan 2023, 5:25 AM
Sandesh Patil
Sandesh Patil - avatar
- 1
Make use of str::isdigit() method 👍
27th Aug 2021, 2:51 PM
Ipang
- 1
Yes
27th Aug 2021, 2:58 PM
Kavitha AV
- 1
if you copied and pasted my code, you will need to replace te quotes. a weird thing in sololearn is that quotes from discussions are not quotes in code. i dont know why that is. below is the same code, but in playground. https://code.sololearn.com/cAINP0Ebnf1u/?ref=app
27th Aug 2021, 3:15 PM
you are smart. you are brave.
you are smart. you are brave. - avatar
- 2
is this what you are looking for? def my_func(a): return a==‘123’ if __name__ == ‘__main__’: x=my_func(‘123.0’) print(x) # alternatively you could just put the function within the print statement.
27th Aug 2021, 2:56 PM
you are smart. you are brave.
you are smart. you are brave. - avatar