FAQ  •  Login

Level 0

Moderators: UncleTimmy, mjpieters

Enjoying the challenge? Need a hint?
Make a donation and help keep the site running! -thesamet
<<

shashi

Posts: 2

Joined: Sun Mar 12, 2006 11:15 am

Post Sun Mar 12, 2006 11:23 am

the math

are you suppose to change the 2 and 3
<<

TriciaMcMillan

Posts: 1

Joined: Sun Jan 28, 2007 6:42 am

Location: Denmark

Post Sun Jan 28, 2007 6:46 am

So, here is the solution for those, who are having trouble with the first challenge:

Open the Terminal.

Write: python

Write: print 2**38

The solution will then be given to you :)
<<

sburich82

Posts: 1

Joined: Mon Feb 18, 2008 3:10 pm

Post Mon Feb 18, 2008 3:18 pm

hey for Py-challenge do you manually enter your solution into the url or is there a way in Python's library for me figure out how to do that automatically with Python? I'm a beginner to Python and I'm not a big fan of Manual manipulation :)
<<

playstone

Posts: 1

Joined: Sun Nov 02, 2008 8:28 am

Post Sun Nov 02, 2008 8:34 am

2**38.html
print:give a answer,not question
so the answer is result of 2**38
<<

justtolearn

Posts: 2

Joined: Thu Apr 02, 2009 10:39 pm

Post Thu Apr 02, 2009 10:53 pm

change 0 to 274877906944 and try
<<

choseman

Posts: 2

Joined: Tue Jun 02, 2009 3:09 pm

Location: Seattle, WA

Post Tue Jun 02, 2009 3:18 pm

Is the site still fully operational?

Because I pasted the answer nnnnn.html and was faced with page not found. I don't think the answer is wrong. Unless Ruby and Python return different answers.
<<

taralluccio

Posts: 11

Joined: Wed Feb 18, 2009 7:00 am

Location: Bergamo, Italy

Post Tue Aug 04, 2009 1:44 pm

Yes, the site is still operational. You just have to post the right answer ;)
<<

kytor

Posts: 1

Joined: Fri Oct 30, 2009 8:10 pm

Post Fri Oct 30, 2009 8:12 pm

it's so easy!
power(2,38)
then change the url.
<<

huangcd

Posts: 1

Joined: Mon Mar 15, 2010 10:36 pm

Post Mon Mar 15, 2010 10:45 pm

Re: Level 0

I have solved this problem by typing "http://www.pythonchallenge.com/pc/def/[the correct answer].html". However when I tried to reach the solution by typing "http://www.pythonchallenge.com/ppc/def/[the correct answer].html" or "http://www.pythonchallenge.com/ppc/def/0.html", I got both "404 Not Found" errors.

Can anybody help me out? Thanks.
<<

Peetoon

Posts: 2

Joined: Thu Apr 01, 2010 10:57 am

Post Thu Apr 01, 2010 11:13 am

Typing "http://www.pythonchallenge.com/pc/def/[the correct answer].html" redirects you to level one whose URL is "http://www.pythonchallenge.com/pc/def/[level 1's URL].html". Once you get there, you can go to "http://www.pythonchallenge.com/pcc/def/[level 1's URL].html" to check out the solution page.

Note that it's pcc and not ppc. :)
<<

Daniell

Posts: 3

Joined: Thu Sep 08, 2011 4:23 am

Post Thu Sep 08, 2011 4:53 am

Re: Level 0

Peetoon wrote:Typing "http://www.pythonchallenge.com/pc/def/[the correct answer].html" redirects you to level one whose URL is "http://www.pythonchallenge.com/pc/def/[level 1's URL].html". Once you get there, you can go to "http://www.pythonchallenge.com/pcc/def/[level 1's URL].html" to check out the solution page.

Note that it's pcc and not ppc. :)

fuh, little hint and voala :) thank you for helping me to cope with this issue too.
<<

5977862

Posts: 1

Joined: Sun Aug 26, 2012 6:07 am

Post Sun Aug 26, 2012 6:14 am

Re: Level 0

is this like the competition ACM ? I submit my code than I will see whether I accept or wrong answer?
<<

cv2store

Posts: 1301

Joined: Wed Mar 06, 2013 7:09 am

Post Sat Mar 16, 2013 8:38 pm

Hello all buyer
I'm seller and alway sell CC fresh with good balance.
I hope u good customers and will be long-term cooperation
* www.cv2store.net is the best automatic sell cvv online store with the good rate 90-95% vaild fresh cvv with cheap price

CVV ON SHOP ONLY SELL US CANADA UK ( BUY CC EU , ASIA , AU .... contact yahoo : cvv_store )

Exchanger WU to Lr
100$ WU = 95 Lr
200$ WU = 190Lr
.....

Price CCV
- Us Visa/mas = 2.5$ / 1cc
Us Amex/disco = 5$ / 1cc
Us fullz = 20$ / 1cc ( full name , state , zipcode , address , phone number , ssn , dob, pin...)

- Canada visa/mas = 7$ / 1cc
- CA amex = 10$ / 1cc
CA fullz = 35$/ 1cc ( full name , state , zipcode , address , phone number , ssn , dob, pin...)

- UK visa/mas = 8$ / 1cc
- Uk amex/dis = 10$/ 1cc

- AU visa/mas = 10$ / 1cc
- Au amex/dis = 12$/ 1cc

- EU / EU fullz = 50$ / 1cc ( full name , state , zipcode , address , phone number , ssn , dob, pin...)

Italy visa/mas = 17$ / 1cc
Italy amex/dis = 20$ / 1cc

Ireland visa/mas = 17$ / 1cc
Ireland amex/disco = 20$/ 1cc

France visa/mas = 17$/1cc
France amex/disco = 20$ / 1cc

Germany visa/mas = 17$/ 1cc
Ger amex/disco = 20$/ 1cc

Norway visa/mas = 17$/ 1cc
Norway amex/disco = 20$/ 1cc

if u want good warranty u can contact me YH : cvv_store
Mail : cvv_store@yahoo.com
Buy throught yahoo we will warranty cvv 24 hours
If buy from shop only 20 min
Because some buyer not good , buy and kill cc so fast then site will change cc

- The checking fee is $0.1 for VALID cards
u can buy test and if good we deal long time
Accept payment Lr if u dont have Lr we will accept Westerunion Money gram
* Min accept Western union Money gram = 100$

Also have Gift itunes XX / XM ( contact YH : cvv_store ) , walmart - Egift card
gift itunes 50$ price 20$ ( buy 50 more 15$ / 1 )
Gift itunes 100$ price 35$ ( buy 50 more 30$ / 1 )
E-G walmart 100$ = 35$
E-G walmart 150$ = 50$

Mail pass login acc amazon , ebay , paypal , apple , walmart.... ( aol , hotmail , gmail, verizon , comcast ... )
1000 mail pass uncheck = 25$
1000 mail pass checker = 50$
If buy 5k mail pass i will discount for u


SITE : www.cv2store.net

--------------- Thanks u ----------
<<

cv2store

Posts: 1301

Joined: Wed Mar 06, 2013 7:09 am

Post Sat Mar 16, 2013 8:39 pm

Hello all buyer
I'm seller and alway sell CC fresh with good balance.
I hope u good customers and will be long-term cooperation
* www.cv2store.net is the best automatic sell cvv online store with the good rate 90-95% vaild fresh cvv with cheap price

CVV ON SHOP ONLY SELL US CANADA UK ( BUY CC EU , ASIA , AU .... contact yahoo : cvv_store )

Exchanger WU to Lr
100$ WU = 95 Lr
200$ WU = 190Lr
.....

Price CCV
- Us Visa/mas = 2.5$ / 1cc
Us Amex/disco = 5$ / 1cc
Us fullz = 20$ / 1cc ( full name , state , zipcode , address , phone number , ssn , dob, pin...)

- Canada visa/mas = 7$ / 1cc
- CA amex = 10$ / 1cc
CA fullz = 35$/ 1cc ( full name , state , zipcode , address , phone number , ssn , dob, pin...)

- UK visa/mas = 8$ / 1cc
- Uk amex/dis = 10$/ 1cc

- AU visa/mas = 10$ / 1cc
- Au amex/dis = 12$/ 1cc

- EU / EU fullz = 50$ / 1cc ( full name , state , zipcode , address , phone number , ssn , dob, pin...)

Italy visa/mas = 17$ / 1cc
Italy amex/dis = 20$ / 1cc

Ireland visa/mas = 17$ / 1cc
Ireland amex/disco = 20$/ 1cc

France visa/mas = 17$/1cc
France amex/disco = 20$ / 1cc

Germany visa/mas = 17$/ 1cc
Ger amex/disco = 20$/ 1cc

Norway visa/mas = 17$/ 1cc
Norway amex/disco = 20$/ 1cc

if u want good warranty u can contact me YH : cvv_store
Mail : cvv_store@yahoo.com
Buy throught yahoo we will warranty cvv 24 hours
If buy from shop only 20 min
Because some buyer not good , buy and kill cc so fast then site will change cc

- The checking fee is $0.1 for VALID cards
u can buy test and if good we deal long time
Accept payment Lr if u dont have Lr we will accept Westerunion Money gram
* Min accept Western union Money gram = 100$

Also have Gift itunes XX / XM ( contact YH : cvv_store ) , walmart - Egift card
gift itunes 50$ price 20$ ( buy 50 more 15$ / 1 )
Gift itunes 100$ price 35$ ( buy 50 more 30$ / 1 )
E-G walmart 100$ = 35$
E-G walmart 150$ = 50$

Mail pass login acc amazon , ebay , paypal , apple , walmart.... ( aol , hotmail , gmail, verizon , comcast ... )
1000 mail pass uncheck = 25$
1000 mail pass checker = 50$
If buy 5k mail pass i will discount for u


SITE : www.cv2store.net

--------------- Thanks u ----------
<<

justin.hanekom

Posts: 1

Joined: Mon Apr 15, 2013 9:07 am

Post Mon Apr 15, 2013 10:32 am

Re: Level 0

I honestly don't understand why one would use the Python code

Python REPL
  Code:
>>> 2 ** 38


when instead one could simply use the Java code:

TwoRaisedThirtyEight.java
  Code:
/*
* Copyright (C) 2013 Justin Hanekom <justin.hanekom@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
package ca.kjmj;

import ca.kjmj.lang.Numbers;
import ca.kjmj.lang.Strings;

/**
* Prints 2 to the power of 38
*
* @version 1.0
* @author Justin Hanekom
*
*/
public final class TwoRaisedThirtyEight {

    /**
     * Prints 2 raised to the power of 38 to the standard output stream
     *
     * @param args
     *            command-line arguments (not used)
     * @since 1.0
     */
    public static void main(final String[] args) {
        System.out.println(Strings.rightAlign(Numbers
                .createDefaultDecimalFormat().format(Math.pow(2, 38)),
                TwoRaisedThirtyEight.OUTPUT_WIDTH));
    }

    /**
     * width of the resulting output string that is printed to the standard
     * output stream
     */
    private static final int OUTPUT_WIDTH = 20;

    /**
     * Default constructor - suppressed because this class cannot be
     * instantiated
     */
    private TwoRaisedThirtyEight() {
        throw new AssertionError("this class cannot be instantiated");
    }

}


TwoRaisedThirtyEightTest.java
  Code:
/*
* Copyright (C) 2013 Justin Hanekom <justin.hanekom@gmail.com>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
package ca.kjmj;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.junit.Assert;
import org.junit.Test;

public class TwoRaisedThirtyEightTest {

    @Test
    public void testPrintsTwoRaisedThirtyEight() {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        System.setOut(new PrintStream(out));
        TwoRaisedThirtyEight.main(null);
        Assert.assertEquals(out.toString(), "     274,877,906,944\n");
    }

}


Strings.java
  Code:
/*
Copyright (C) 2013 Justin Hanekom <justin.hanekom@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/
package ca.kjmj.lang;

/**
* Contains additional functionality for the built-in String class
*
* @version 1.0
* @author Justin Hanekom
*
*/
public final class Strings {

   /**
    * Left aligns the string str in a string of length width. The string is
    * padded to the right with spaces (' ') if necessary
    *
    * @param str
    *            the string to left-align, may be null
    * @param width
    *            the length to pad the string to
    * @return left aligned string; returns the original string if it is null or
    *         if no padding is necessary
    * @throws IllegalArgumentException
    *             if width is less than or equal to 0
    * @since 1.0
    */
   public static final String leftAlign(final String str, final int width) {
      if (str == null) {
         return null;
      }
      if (width <= 0) {
         throw new IllegalArgumentException(
               "width must be greater than zero: " + width);
      }
      return String.format("%1$-" + width + "s", str);
   }

   /**
    * Right aligns the string str in a string of length width. The string is
    * padded to the left with spaces (' ') if necessary
    *
    * @param str
    *            the string to right-align, may be null
    * @param width
    *            the length to pad the string to
    * @return right aligned string; returns the original string if it is null
    *         or if no padding is necessary
    * @throws IllegalArgumentException
    *             if width is less than or equal to 0
    * @since 1.0
    */
   public static final String rightAlign(final String str, final int width) {
      if (str == null) {
         return null;
      }
      if (width <= 0) {
         throw new IllegalArgumentException(
               "width must be greater than zero: " + width);
      }
      return String.format("%1$" + width + "s", str);
   }

   /**
    * Default constructor - suppressed because this class cannot be
    * instantiated
    */
   private Strings() {
      throw new AssertionError("this class cannot be instantiated");
   }

}


StringsTest.java
  Code:
/*
Copyright (C) 2013 Justin Hanekom <justin.hanekom@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package ca.kjmj.lang;

import junit.framework.Assert;

import org.junit.Test;

public class StringsTest {

   @Test(expected = IllegalAccessException.class)
   public void testCannotCreateAStringsInstance()
         throws IllegalAccessException, InstantiationException,
         ClassNotFoundException {
      Class.forName("ca.kjmj.lang.Strings").newInstance();
   }

   @Test
   public void testLeftAlignPadsRightWithSpaces() {
      Assert.assertEquals("Strings.leftAlign() should pad the right-hand "
            + "side with space characters", "xyz ",
            Strings.leftAlign("xyz", 4));
   }

   @Test
   public void testLeftAlignReturnsNullIfOriginalStringIsNull() {
      Assert.assertNull("Strings.leftAlign() should return null if given "
            + "a null as the string to left-align",
            Strings.leftAlign(null, 1));
   }

   @Test
   public void testLeftAlignReturnsOriginalStringIfWidthExceeded() {
      Assert.assertEquals("Strings.leftAlign() should return the given "
            + "string if the string is larger than the requested width",
            "xyz", Strings.leftAlign("xyz", 1));
   }

   @Test(expected = IllegalArgumentException.class)
   public void testLeftAlignThrowsIllegalArgumentExceptionIfWidthZeroOrLess() {
      Strings.leftAlign("xyz", -1);
   }

   @Test
   public void testRightAlignPadsLeftWithSpaces() {
      Assert.assertEquals("Strings.rightAlign() should pad the left-hand "
            + "side with space characters", " xyz",
            Strings.rightAlign("xyz", 4));
   }

   @Test
   public void testRightAlignReturnsNullIfOriginalStringIsNull() {
      Assert.assertNull("Strings.rightAlign() should return null if given "
            + "a null as the string to right-align",
            Strings.rightAlign(null, -1));
   }

   @Test
   public void testRightAlignReturnsOriginalStringIfWidthExceeded() {
      Assert.assertEquals("Strings.rightAlign() should return the given "
            + "string if the string is larger than the requested width",
            "xyz", Strings.rightAlign("xyz", 3));
   }

   @Test(expected = IllegalArgumentException.class)
   public void testRightAlignThrowsIllegalArgumentExceptionIfWidthZeroOrLess() {
      Strings.leftAlign("xyz", 0);
   }

}


Numbers.java
  Code:
/*
Copyright (C) 2013 Justin Hanekom <justin.hanekom@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package ca.kjmj.lang;

import java.text.DecimalFormat;

/**
* Contains additional functionality for the built-in Number-based classes
*
* @version 1.0
* @author Justin Hanekom
*
*/
public final class Numbers {

   /**
    * @return newly created DecimalFormat object for the default locale
    * @since 1.0
    */
   public static final DecimalFormat createDefaultDecimalFormat() {
      return new DecimalFormat();
   }

   /**
    * Default constructor - suppressed because this class cannot be
    * instantiated
    */
   private Numbers() {
      throw new AssertionError("this class cannot be instantiated");
   }

}


NumbersTest.java
  Code:
/*
Copyright (C) 2013 Justin Hanekom <justin.hanekom@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
package ca.kjmj.lang;

import org.junit.Assert;
import org.junit.Test;

public class NumbersTest {

   @Test(expected = IllegalAccessException.class)
   public void testCannotCreateANumbersInstance()
         throws IllegalAccessException, InstantiationException,
         ClassNotFoundException {
      Class.forName("ca.kjmj.lang.Numbers").newInstance();
   }

   @Test
   public void testCreatesADefaultDecimalFormat() {
      Assert.assertNotNull(
            "Numbers.createDefaultDecimalFormat() returned null. "
                  + "It should return a DecimalFormat instance",
            Numbers.createDefaultDecimalFormat());
   }

   @Test
   public void testEachDefaultDecimalFormatIsANewInstance() {
      Assert.assertNotSame(
            "Numbers.createDefaultDecimalFormat() returned the same "
                  + "instance. Each call should return a unique instance",
            Numbers.createDefaultDecimalFormat(),
            Numbers.createDefaultDecimalFormat());
   }

}


:roll: Justin
PreviousNext

Return to Python Challenge Hints

Who is online

Users browsing this forum: Bing [Bot] and 6 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.