User Profile

Collapse

Profile Sidebar

Collapse
clouddragon
clouddragon
Last Activity: May 30 '08, 06:23 PM
Joined: Apr 25 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • i figured it out most of the program but i am unable to have it write to a outfile.

    Code:
    L = input("Please enter a number greater than 2: ")
    outfile = open('primes-'+str(L)+'.txt','w')
    for n in range(2, L): #loop
         for x in range(2, int(n**0.5)+1):  
            if n % x == 0:
                print n #prints the number if it is composite, skips the prime.
                break
    Here...
    See more | Go to post

    Leave a comment:


  • composites numbers newbie asking for help!! PLEASE!!!

    Hi,

    i am in desperate need for any help regarding one of my assignments. I am to write a python program that lists the numbers that are composite from 1 to n(input) and write it to an external txt. I was able to write something that checks whether something is composite or not but able to incorporate it into a loop as such.

    for example: n = 50

    then the composite numbers are

    4
    6...
    See more | Go to post

  • clouddragon
    started a topic How do you underline in python.

    How do you underline in python.

    hello,

    i want to know how you underline something in python. Thanks in advance.
    See more | Go to post

  • clouddragon
    replied to List Processing program help
    yes i got it! it is amazing how a small change can make or break the program. Thanks for the help.
    See more | Go to post

    Leave a comment:


  • clouddragon
    replied to List Processing program help
    hi, i was able to get the program to work for the most part. However, my result is this

    Enter a list with an even number of integers: [2,7,8,-3,11,-22]
    The new list is [9] The new list is [5] The new list is [-11]

    while i want it to be like this

    The new list is [9, 5, -11]

    here is the script:

    num_list = input("Enter a list with an even number of integers:...
    See more | Go to post

    Leave a comment:


  • clouddragon
    started a topic List Processing program help

    List Processing program help

    Hello,

    i am having trouble writing this program on Python. Write a program that asks the user to enter a list with an even number of integers. The program then has to construct a new list by adding pairs of integers in the list. I have been working on this for a few hours and the closest i got was

    Enter a list with an even number of integers:: [2,7,8,-3,11,-22]
    [9] [15] [5] [8] [-11]

    but i am suppose...
    See more | Go to post
No activity results to display
Show More
Working...