id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs112fall2015 > test
prev  |  next  |  chance

This is just to make sure you have the system down. Write a function called test. The function should have one parameter, called x, so you'll write the function with a line "def test(x):" (without the quotation marks). On the line after the "def" line which defines the function, type two spaces then "return 2*x". This function takes a number x and doubles it, just like f(x) = 2*x in math. The reason for the two spaces is to tell Python that you want to indent.


test(2) → 4
test(3) → 6
test(-1) → -2

...Save, Compile, Run (ctrl-enter)

def test(x):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy