>
>
>> I am trying to write a program that will figure out if a number is prime
>> or not. Currently this is the code that I have:
>
> [code cut]
>
> Hi Andrade1,
>
> As in your other previous homework programs, you seem to have some trouble
> with control
Hello
I am trying to write a program that will figure out if a number is prime
or not. Currently this is the code that I have:
import math
def main():
number=input("Please enter a positive whole number greater than 2: ")
for value in range(2, number-math.sqrt):
if number % value
would this be a possible use of a list and appending even though I recieve
an error from it:
def main():
x = [1]
x[0] = input('enter an int to start your syracuse sequence\n')
while not isinstance(x[0], int):
x[0] = input('no, please enter an int to start your syracuse
sequ
hello,
Could I gather all of the values from print x into a string or a range?
Since, I am not familiar with lists yet.
def main():
x = input("Please enter a positive starting value: ")
while x != 1:
if x%2 == 0:
x = x/2
else:
Hello
I am trying to create a program that will calculate the syracuse sequence
which is also known as collatz or hailstone. the number that is input by
the user may be either even or odd. the number goes through a series of
functions which are x/2 if the number is even and 3x+1 if the number is
o
Hello
I'm having some trouble with my if, else statements. For some reason, the
months that have 31 days work fine, but the months that have 28/30 do not
work. Am I doing something wrong? it is supposed to take a date as an
input like 9/31/1991 and then say that the date is not valid because
septe
amount is supposed to equal fine because there are a couple of different
fines. there is a fine for going over 90mph that includes a penalty and then
there is a fine for just going over the speed limit as long as it is under
90.
> Is amount suppose to equal total instead of fine?
>
>
>
> On Thurs
Hello
I am having trouble getting my program to calculate the correct total if
the speed limit is over 90mph. For example when i enter 100 for the
clocked speed and 50 for the actual speed it returns 300 when I should
receive 500. It also seems to be skipping over the else statement of if
the pers
hello
below is my code and everytime I input a value of 16 or more it keeps
returning sophomore. could anyone help me figure out what to change so
that it won't return sophmore for things greater than or equal to 16?
def getcredits(num):
if num < 7:
return 'Freshman'
elif num >= 7
Hello
I have a snowman who would like a nose. I have tried the following to make
a triangle and all I get is a little green line. would anyone have any
suggestions as to why?
from graphics import *
def main():
win = GraphWin("Triangle")
triangle = Polygon(Point(4,8), Point(2,10), Point
Hello
I am trying to draw a basic face with eyes, nose, and a mouth. I keep
receiving the following error message:
>>>
Traceback (most recent call last):
File "C:\Documents and Settings\Michele\Desktop\face", line 26, in ?
main()
File "C:\Documents and Settings\Michele\Desktop\face", line
Hello
How could I get the following to print out an acronym for each phrase
entered such as if I entered random access memory it word print out RAM?
import string
def main():
phrase = (raw_input("Please enter a phrase:"))
acr1 = string.split(phrase)
acr2 = string.capwords(phrase
Hello
I would like to insert a string into the following program to simplify the
program. Any suggestions on how I might do so?
# dateconvert2.py
#Converts day month and year numbers into two date formats
import string
def main():
# get the day month and year
day, month, year = inp
Hello
I would like to insert a string into the following program to simplify the
program. Any suggestions on how I might do so?
# dateconvert2.py
#Converts day month and year numbers into two date formats
import string
def main():
# get the day month and year
day, month, year = in
below is my program. what i would like to do is to get the last line to
print the number of years that the user enters and also the principal
# A program to compute the value of an investment
# years into the future
def main():
print "This program calculates the future value of an investme
15 matches
Mail list logo