Python Forum
i want to know the difference
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i want to know the difference
#1
a=int(input("enter a number:"))
def check_prime_numbers():
    for i in range(2, (a//2+1)):
        if a%i==0  :
            print(f"{a} isn't prime number")
            break
    else:
        print(f"{a} is a prime number")
check_prime_numbers()
my teach send me this code and asked me why did he printed a instead of i
can I get some help?
deanhystad write Jan-23-2024, 04:13 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
i want to know the difference - by Naisuke - Jan-23-2024, 03:05 PM
RE: i want to know the difference - by deanhystad - Jan-23-2024, 04:14 PM
RE: i want to know the difference - by Naisuke - Jan-24-2024, 03:27 PM
RE: i want to know the difference - by deanhystad - Jan-24-2024, 05:28 PM

Forum Jump:

User Panel Messages

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