Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

programming challenge #1

Name: Anonymous 2013-09-30 23:58

# Given a variable, x, that stores the
# value of any decimal number, write Python
# code that prints out the nearest whole
# number to x.
# If x is exactly half way between two
# whole numbers, round up, so
# 3.5 rounds to 4 and 2.5 rounds to 3.
# You may assume x is not negative.

# Hint: The str function can convert any number into a string.
# eg str(89) converts the number 89 to the string '89'

# Along with the str function, this problem can be solved
# using just the information introduced in unit 1.

# x = 3.14159
# >>> 3 (not 3.0)
# x = 27.63
# >>> 28 (not 28.0)
# x = 3.5
# >>> 4 (not 4.0)

Name: Anonymous 2013-10-01 0:29

read SICP.

Name: Anonymous 2013-10-01 1:28

mfw #Hint

Name: Anonymous 2013-10-01 1:29

#Hint python has no round()

Name: Anonymous 2013-10-01 1:33

z = ceil(x) - ((ceil(x) - x) >= 0.5)

Name: Anonymous 2013-10-01 2:17

z = (x + .5) << 0

Name: Anonymous 2013-10-01 3:59

My Python has no round, how does it coils?

Name: Anonymous 2013-10-01 4:23

Programming challenge #2
Complete the Hello, World exercise from chapter 1 of the textbook.

Name: Anonymous 2013-10-01 4:56

>>8
#define vtext(str,col) for(int i=0;str[i];){*(0xb8000+(i<<1))=str[i];*(0xb8000+(1+(i++<<1)))=col;}
vtext("Hello, World",0x2a)

Name: Anonymous 2013-10-02 21:08

>>6
TypeError: unsupported operand type(s) for <<: 'float' and 'int'

Name: Anonymous 2013-10-02 23:46

check(em)

Name: Anonymous 2013-10-03 16:14

python is shit

Name: Anonymous 2013-10-03 16:31

Stop calling homework "programming challeneges", meganigger.

Name: Anonymous 2013-10-03 18:56

I dated a girl named Megan Igger for a while. True story.

Name: Anonymous 2013-10-03 22:04

You're all retarded


import math
x = float(raw_input("Enter dat number: "))

print round(x)

Name: Anonymous 2013-10-03 22:19

>>15
What about my all retarded?

Name: Anonymous 2013-10-03 22:58

Niggers all deserve to be burned.

Don't change these.
Name: Email:
Entire Thread Thread List