in your notes books and in your vopy
Answer:
Replace the first blank with:
message = "Hello " + name + ". Your lucky number is " + str(number)
Replace the second blank with:
return message
Explanation:
The first blank needs to be filled with a variable; we can make use of any variable name as long as it follows the variable naming convention.
Having said that, I decided to make use of variable name "message", without the quotes
The next blank is meant to return the variable on the previous line;
Since the variable that was used is message, the next blank will be "return message", without the quotes
Answer:
Here’s one!
Given [math]R[/math], the radius of the circle.
Let [math]N,D\leftarrow 0[/math]
Repeat until [math]D[/math] is large enough (about 1,000,000)
[math]x,y\leftarrow U[0,1][/math]
If [math]x^2 + y^2\le 1[/math] then [math]N\leftarrow N+1[/math]
[math]D\leftarrow D+1[/math]
[math]P\leftarrow\frac{8NR}{D}[/math]
Return [math]P[/math]
[math]U[0,1][/math] is a uniform random number in the range [math][0,1][/math].
Explanation:
Answer:
The following code as follows:
Code:
max=name1; //define variable max that holds name1 variable value.
if (strcmp(name2, max)>0) //if block.
{
max=name2; //assign value to max.
}
if (strcmp(name3,max)>0) //if block.
{
max=name3; //assign value to max.
}
Explanation:
In the above code, we define a variable that is max. The data type of max variable is the same as variables "name1, name2, and name3" that is "char". In the max variable, we assign the value of the name1 variable and use if block statement two times. In if block, we use strcmp() function that can be defined as:
- In first if block we pass two variables in strcmp() function that is "name2 and max" that compare string value. If the name2 variable is greater then max variable value so, the max variable value is change by name2 variable that is "max=name2".
- In second if block we pass two variables in strcmp() function that is "name3 and max" that compare string value. If the name3 variable is greater then max variable value so, the max variable value is change by name3 variable that is "max=name3".