Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple code help
#1
def is_integer_num(n):
    if isinstance(n,float):
                print(input(n))
    else: 
        print("not a number") 

n=input('Please enter number: ')
is_integer_num(n)
It says not a number to anything i write. Why is it like that? Help please!!
Reply
#2
input returns a str
Reply
#3
input returns a string.
you will need to convert it to int
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple code not working properly tmv 2 561 Feb-28-2025, 09:27 PM
Last Post: deanhystad
  Help with simple code JacobSkinner 1 1,398 Mar-18-2024, 08:08 PM
Last Post: deanhystad
  I have a code which is very simple but still I cannot detect what's wrong with it max22 1 1,314 Nov-07-2023, 04:32 PM
Last Post: snippsat
  help me simple code result min and max number abrahimusmaximus 2 1,765 Nov-12-2022, 07:52 AM
Last Post: buran
  Simple encoding code ebolisa 3 2,405 Jun-18-2022, 10:59 AM
Last Post: deanhystad
  How would you (as an python expert) make this code more efficient/simple coder_sw99 3 2,628 Feb-21-2022, 10:52 AM
Last Post: Gribouillis
  Simple code question about lambda and tuples JasPyt 7 4,866 Oct-04-2021, 05:18 PM
Last Post: snippsat
  My simple code don't works !! Nabi666 1 2,091 Sep-06-2021, 12:10 PM
Last Post: jefsummers
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 3,998 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  Plotting sum of data files using simple code Laplace12 3 4,457 Jun-16-2021, 02:06 PM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020