Cora Dyce

Welcome to our website !
Please register an account to view the complete categories and forums.


Join the forum, it's quick and easy

Cora Dyce

Welcome to our website !
Please register an account to view the complete categories and forums.

Cora Dyce

Would you like to react to this message? Create an account in a few clicks or log in to continue.

Cora Dyce - Your personal dicing clan


+4
Tom's Slave
Daft Punk
Allen's Slave
Jaycubb
8 posters

    Python 3.0

    Jaycubb
    Jaycubb
    Member
    Member


    Posts : 4859
    Join date : 2012-12-27
    Age : 26
    Location : Australia

    Python 3.0 Empty Python 3.0

    Post by Jaycubb 2013-08-27, 06:41

    Challenge:
    Write a program that asks for a number, n, and then prints out all the numbers between 1 and n. Your program should work like this:


    Enter a number: 7
    1
    2
    3
    4
    5
    6
    7



    my code so far:

    n = int(input("Enter a number: "))
    while n > 1:
    print(n)
    n = n + 1

    But it just spams the number that I enter. I need it to count up to that number, how do I do it?
    Jaycubb
    Jaycubb
    Member
    Member


    Posts : 4859
    Join date : 2012-12-27
    Age : 26
    Location : Australia

    Python 3.0 Empty Re: Python 3.0

    Post by Jaycubb 2013-08-27, 06:54

    Dw I got it:

    n = int(input("Enter a number: "))
    c = 1

    while c <= n:
    print(c)
    c = c + 1
    Allen's Slave
    Allen's Slave
    Member
    Member


    Posts : 4445
    Join date : 2012-08-09
    Age : 30
    Location : A$AP

    Python 3.0 Empty Re: Python 3.0

    Post by Allen's Slave 2013-08-27, 06:58

    Good work. Are you taking a programming class?
    Jaycubb
    Jaycubb
    Member
    Member


    Posts : 4859
    Join date : 2012-12-27
    Age : 26
    Location : Australia

    Python 3.0 Empty Re: Python 3.0

    Post by Jaycubb 2013-08-27, 10:32

    Yes. Im doing this competition online also. Its called Grok Learning. Im tied 2nd with 5000 people xD
    Daft Punk
    Daft Punk
    VIP
    VIP


    Posts : 3818
    Join date : 2012-04-05
    Age : 31
    Location : California, USA

    Python 3.0 Empty Re: Python 3.0

    Post by Daft Punk 2013-08-27, 10:54

    Tom wrote:Good work. Are you taking a programming class?
    I want to learn at my own pace (I don't want to go to school). Thoughts?
    Allen's Slave
    Allen's Slave
    Member
    Member


    Posts : 4445
    Join date : 2012-08-09
    Age : 30
    Location : A$AP

    Python 3.0 Empty Re: Python 3.0

    Post by Allen's Slave 2013-08-27, 13:51

    Daft Punk wrote:
    Tom wrote:Good work. Are you taking a programming class?
    I want to learn at my own pace (I don't want to go to school).  Thoughts?
    Codeacademy.com

    Absolutely fantastic resource to get you into coding. Currently sponsored by Facebook, Microsoft, etc. I highly recommend.

    Also Jaycubb, not trying to be mean, but how does the competition work? If you're in 2nd place after finishing a while loop...
    Tom's Slave
    Tom's Slave
    VIP
    VIP


    Posts : 4757
    Join date : 2012-05-12
    Age : 28
    Location : Mac and Cheese

    Python 3.0 Empty Re: Python 3.0

    Post by Tom's Slave 2013-08-27, 21:11

    Tom wrote:
    Daft Punk wrote:
    Tom wrote:Good work. Are you taking a programming class?
    I want to learn at my own pace (I don't want to go to school).  Thoughts?
    Codeacademy.com

    Absolutely fantastic resource to get you into coding. Currently sponsored by Facebook, Microsoft, etc. I highly recommend.

    Also Jaycubb, not trying to be mean, but how does the competition work? If you're in 2nd place after finishing a while loop...
    LOL. I was on codeacademy last night - great site rendeer 
    Jon
    Jon
    Sponsor
    Sponsor


    Posts : 13685
    Join date : 2011-09-19
    Age : 27
    Location : United Kingdom

    Dices Rolls
    Dice Roll:

    Python 3.0 Empty Re: Python 3.0

    Post by Jon 2013-08-27, 22:19

    Hold on, I'll fetch Rob Crawl.
    Understand
    Understand
    Member
    Member


    Posts : 1314
    Join date : 2013-05-04
    Age : 24
    Location : A thief who stole a calendar got twelve months.

    Python 3.0 Empty Re: Python 3.0

    Post by Understand 2013-08-28, 00:30

    Jon wrote:Hold on, I'll fetch Rob Crawl.
    NO I'LL FETCH HIM!spam
    Jaycubb
    Jaycubb
    Member
    Member


    Posts : 4859
    Join date : 2012-12-27
    Age : 26
    Location : Australia

    Python 3.0 Empty Re: Python 3.0

    Post by Jaycubb 2013-09-06, 12:11

    Tom wrote:
    Daft Punk wrote:
    Tom wrote:Good work. Are you taking a programming class?
    I want to learn at my own pace (I don't want to go to school).  Thoughts?
    Codeacademy.com

    Absolutely fantastic resource to get you into coding. Currently sponsored by Facebook, Microsoft, etc. I highly recommend.

    Also Jaycubb, not trying to be mean, but how does the competition work? If you're in 2nd place after finishing a while loop...
    Its grok learning, after you complete a challenge they mark your work on efficiency, theres a series of challenges u have to complete, all finished by the end of each week, 5 weeks. Its an international thing. btw Code academy is good to learn etc but theres heaps of flaws in there system, some times it says your work is wrong but its right. its fucked.
    avatar
    Sam
    Sponsor
    Sponsor


    Posts : 8341
    Join date : 2011-06-08
    Age : 29
    Location : Connor's House

    Dices Rolls
    Dice Roll:

    Python 3.0 Empty Re: Python 3.0

    Post by Sam 2013-09-06, 18:12

    Jaycubb wrote:Dw I got it:

    n = int(input("Enter a number: "))
    c = 1

    while c <= n:
       print(c)
       c = c + 1
    Going to try to write that in Java (haven't done Java in 3 years).

    int n;
    int c=1; //Don't remember where the bracket-things go here

    n=; //I forget how to let user give input Sad

    if(n>=c){
    System.out.println("The number is"+c);
    }
    else{
    System.out.println("You're a dumb bitch. Pick a number 1-10.")
    }




    I fucked this one up. Need help, Tom.
    avatar
    Cannons
    Member
    Member


    Posts : 3461
    Join date : 2012-06-28
    Age : 28

    Python 3.0 Empty Re: Python 3.0

    Post by Cannons 2013-09-06, 18:22

    Sam wrote:
    Jaycubb wrote:Dw I got it:

    n = int(input("Enter a number: "))
    c = 1

    while c <= n:
       print(c)
       c = c + 1
    Going to try to write that in Java (haven't done Java in 3 years).

    int n;
    int c=1; //Don't remember where the bracket-things go here

    n=;     //I forget how to let user give input Sad

    if(n>=c){
    System.out.println("The number is"+c);
    }
    else{
    System.out.println("You're a dumb bitch. Pick a number 1-10.")
    }




    I fucked this one up. Need help, Tom.
    We will remember your last posts today :/
    Allen's Slave
    Allen's Slave
    Member
    Member


    Posts : 4445
    Join date : 2012-08-09
    Age : 30
    Location : A$AP

    Python 3.0 Empty Re: Python 3.0

    Post by Allen's Slave 2013-09-06, 19:43

    Sam wrote:
    Jaycubb wrote:Dw I got it:

    n = int(input("Enter a number: "))
    c = 1

    while c <= n:
       print(c)
       c = c + 1
    Going to try to write that in Java (haven't done Java in 3 years).

    int n;
    int c=1; //Don't remember where the bracket-things go here

    n=;     //I forget how to let user give input Sad

    if(n>=c){
    System.out.println("The number is"+c);
    }
    else{
    System.out.println("You're a dumb bitch. Pick a number 1-10.")
    }




    I fucked this one up. Need help, Tom.
    This is so sloppy, I haven't worked with Java in ages.

    public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int x;
    do{
    System.out.print("Pick a number:");
    x = in.nextInt();}
    while(x > 10);

    for (int i = 1; i <= x; i++){
    System.out.println(i);}
    }

    You'll have to input java.util.Scanner.

    avatar
    Sam
    Sponsor
    Sponsor


    Posts : 8341
    Join date : 2011-06-08
    Age : 29
    Location : Connor's House

    Dices Rolls
    Dice Roll:

    Python 3.0 Empty Re: Python 3.0

    Post by Sam 2013-09-06, 22:33

    Reading code gives me realization of great truth[wow]epiphany inception[/wow].

    Sponsored content


    Python 3.0 Empty Re: Python 3.0

    Post by Sponsored content


      Current date/time is 2024-04-26, 16:20