Exemplo n.º 1
0
Arquivo: answer.py Projeto: Todai88/me
"""
"""
Exercise 1.1 
 
Assign the word: 'cupcakes' to a variable and put your variable as the
answer.
 

Write your code below and put the answer into the variable ANSWER.
"""
placeholder = "cupcakes"

ANSWER = placeholder

# I will now test your answer - change false to true to get a hint.
print(dbwebb.assertEqual("1.1", ANSWER, False))
"""
Exercise 1.2 
 
Assign the word 'cupcakes' to a variable. Create another variable where you
put the first and the last letter in the word.

Answer with the second variable.
 

Write your code below and put the answer into the variable ANSWER.
"""

firstAndLast = placeholder[0:1] + placeholder[-1]
ANSWER = firstAndLast
# I will now test your answer - change false to true to get a hint.
Exemplo n.º 2
0
In the code below initiate a variable named `cat` with a *Cat object*, give
it eye color "blue" and name "Basion".

Answer with the string "My cats name is `name` and has `eyeColor` eyes.".


Write your code below and put the answer into the variable ANSWER.
"""

cat = Cat.Cat("blue", "Basion")

ANSWER = "My cats name is {name} and has {eyeColor} eyes.".format(
    name=cat.str_name, eyeColor=cat.str_eyeColor)

# I will now test your answer - change false to true to get a hint.
print(dbwebb.assertEqual("1.1", ANSWER, False))
"""
Exercise 1.2

Expand your Cat class with the variables `livesLeft`.

Initialize the attribute in the constructor to `-1`. In the code below
change the value to `9`.

Answer with number of lives the cat has left.


Write your code below and put the answer into the variable ANSWER.
"""

cat.int_livesLeft = 9
Exemplo n.º 3
0
Arquivo: answer.py Projeto: Todai88/me
Create a variable called 'numOne' and give it the value 29. Create another
variable called 'numTwo' and give it the value 71. Create a third variable
called 'result' and assign to it the sum of the first two variables.

Answer with the result.
 

Write your code below and put the answer into the variable ANSWER.
"""
numOne = 29
numTwo = 71

ANSWER = result = numOne + numTwo

# I will now test your answer - change false to true to get a hint.
print(dbwebb.assertEqual("1.1", ANSWER, False))
"""
Exercise 1.2 
 
Create a variable called 'numThree' and give it the value 87. 

Create another variable called 'numFour' and give it the value 98. 

Subtract 'numThree' from 'numFour' and answer with the result.
 

Write your code below and put the answer into the variable ANSWER.
"""

numThree = 87
numFour = 98
Exemplo n.º 4
0
Exercise 1.1

Assign the word: 'milk' to a variable and put your variable as the answer.

Write your code below and put the answer into the variable ANSWER.
"""

ex1String = 'milk'



ANSWER = ex1String

# Is the answer as expected?
# When you get stuck - change False to True to get a hint.
print(dbwebb.assertEqual("1.1", ANSWER, False))

"""
Exercise 1.2

Assign the word 'milk' to a variable. Create another variable where you put
the first and the last letter in the word. Answer with the second variable.

Write your code below and put the answer into the variable ANSWER.
"""

ex1String = 'milk'
milk2 = ex1String[0] + ex1String[-1]


ANSWER = milk2
Exemplo n.º 5
0
variable called 'numTwo' and give it the value 15. Create a third variable
called 'result' and assign to it the sum of the first two variables. Answer
with the result. 

Write your code below and put the answer into the variable ANSWER.
"""
numOne = 23
numTwo = 15
result = 23 + 15


ANSWER = 38

# Is the answer as expected?
# When you get stuck - change False to True to get a hint.
print(dbwebb.assertEqual("1.1", ANSWER, False))

"""
Exercise 1.2 
 
Create a variable called 'numThree' and give it the value 40. Create
another variable called 'numFour' and give it the value 98. Subtract
'numThree' from 'numFour' and answer with the result. 

Write your code below and put the answer into the variable ANSWER.
"""
numThree = 40
numFour = 98
res1 = numThree - numFour