As homework, I am to write a scrip that can determine if one integer is factor of another. I define the input x and y as follow; -
def main():
-
x = input ("What is the integer? ")
-
y = input ("Enter another integer: ")
-
-
def isfactor (x, y):
-
if x % y == 0:
-
-
print y, "is a factor of x."
-
-
else:
-
print y, "is not a factor x."
-
-
main()
-
For some reason the program only interprets up to the input parts and left the rest out. That is, when I run the program in shell, it prompts me to enter the integers and stop there. Can any body tell me why? your help will be greatly appreciated. Thank you very much.
3 1715 bartonc 6,596
Recognized Expert Expert
As homework, I am to write a scrip that can determine if one integer is factor of another. I define the input x and y as follow; -
def main():
-
x = input ("What is the integer? ")
-
y = input ("Enter another integer: ")
-
-
def isfactor (x, y):
-
if x % y == 0:
-
-
print y, "is a factor of x."
-
-
else:
-
print y, "is not a factor x."
-
-
main()
-
For some reason the program only interprets up to the input parts and left the rest out. That is, when I run the program in shell, it prompts me to enter the integers and stop there. Can any body tell me why? your help will be greatly appreciated. Thank you very much.
You are in luck. We'll just shoot this over to the python forum and get you some help there. Welcome to TheScripts.com.
bartonc 6,596
Recognized Expert Expert
As homework, I am to write a scrip that can determine if one integer is factor of another. I define the input x and y as follow
For some reason the program only interprets up to the input parts and left the rest out. That is, when I run the program in shell, it prompts me to enter the integers and stop there. Can any body tell me why? your help will be greatly appreciated. Thank you very much.
The second function call was never made. Here's one way to do it: -
# I like to have subroutines on top and main() at the bottom
-
def isfactor (x, y):
-
if x % y == 0:
-
print y, "is a factor of x."
-
else:
-
print y, "is not a factor x."
-
-
def main():
-
x = input ("What is the integer? ")
-
y = input ("Enter another integer: ")
-
isfactor(x, y)
-
-
-
main()
-
bartonc 6,596
Recognized Expert Expert
By the way, welcome to the Python Forum on TheScripts.com. I'm glad you found this site and I really like you nic (wish I'd thought of that handle). Get all the python help you need here on TSDN.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Lucas, Todd |
last post by:
Hello everyone! I'm having a problem with a WebControl that I'm designing
for a Menu. I've been at it for about 3 weeks now, and can't seem to get
around this problem. So I'm hoping that someone...
|
by: tangus via DotNetMonster.com |
last post by:
Hello all, I'm really struggling with getting some Active Directory code to
work in ASP.NET. Can you please provide assistance? I am executing the
following code:
Dim enTry As DirectoryEntry =...
|
by: jcrouse |
last post by:
I have a project with a startup (Sub Main) module and two forms. Based on the logic in the Sub Main it calls one of the two forms. The two forms are almost identical. They both make calls into the...
|
by: graemeharnish |
last post by:
Hello. I'm trying to mod an open source app called TinyERP and inherit
from a parent object, and in essence change how _column is defined. I
found sample code of:
class...
|
by: leslie_tighe |
last post by:
Hello,
I have webservice created with Axis 1.2.1 and that I am trying to
consuming in .NET (VB) using the Microsoft provided tools. While I am
able to consume methods on the service that return...
| |
by: Stacey Levine |
last post by:
I have a webservice that I wanted to return an ArrayList..Well the service
compiles and runs when I have the output defined as ArrayList, but the WSDL
defines the output as an Object so I was...
|
by: jslowery |
last post by:
I am not completely knowledgable about the status of lexical scoping in
Python, but it was my understanding that this was added in a long time
ago around python2.1-python2.2
I am using python2.4...
|
by: tshad |
last post by:
In VS 2003, I am setting up an abstract class that is setting up classes for
each datatype of VB.Net (as well as C#).
I am trying to set it up so that most of the work is done in the Abstract...
|
by: Gilberto |
last post by:
Hello,
I have a couple of forms using the code to FIND AS YOU TYPE from Allen Browne (http://allenbrowne.com/AppFindAsUType.html). It worked PERFECTLY until yesterday when i splitted the db into...
|
by: jhop |
last post by:
Hello everyone,
I am having a slight problem with a program i am working on for a class, I am using Visual Studio 2005. The program only allows the up arrow key as input. In the code it is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |