What are your answer choices?
The answer would be the first answer
Answer:
10 documents ^_^
Explanation:
I can open it at the same time on my laptop ●~●
Answer:
* The code is in Python
def joinStrings():
join = ""
while True:
str = input("Enter a word or Q to stop: ")
if str == "Q":
break
else:
join = join + " " + str
return join
print(joinStrings())
Explanation:
Create a function called joinStrings
Initialize join variable to hold the strings that will be combined
Create a while loop that stops when user enters "Q". Otherwise, ask the user for a new string and join it to the join variable with a space
When the loop is done, return the join
Call the function and print the result
Answer:
def sum_cubes(n):
if n == 1:
return 1
else:
return n * n * n + sum_cubes(n-1)
print(sum_cubes(3))
Explanation:
Create a function called sum_cubes that takes one parameter, n
If n is equal to 1, return 1. Otherwise, calculate the cube of n, and add it to the sum_cubes function with parameter n-1
If we want to calculate the cubes of the first 3 numbers:
sum_cubes(3) = 3*3*3 + sum_cubes(2)
sum_cubes(2) = 2*2*2 + sum_cubes(1)
sum_cubes(1) = 1
If you substitute the values from the bottom, you get 27+8+1 = 36