Answer:
Explanation:
Let's do this in Python, we can first generate the random number from 1 to 100. Then compare that with the input number from the guesser.
from random import random
random_0_1 = random()
random_1_100 = 1 if round(100*random_0_1) < 1 else round(100*random_0_1)
for trial in range(3):
guess = input('Guess the number: ')
if guess == random_1_11:
print('You guessed correctly!')
break
else:
print(2 - trial + " remaining try")
Answer:
C.
More students are affected by cyberbullying than not affected.
Explanation:
I got it correct on Edgenuity 2020.
Answer:
PING
Explanation:
To check if there's still connectivity between the computer and server, I would use the ping command.
The ping command is primarily a TCP/IP command. What this command does is to troubleshoot shoot. It troubleshoots connection and reachability. This command also does the work of testing the name of the computer and also its IP address.
Answer:
Option 3 is the correct answer.
Explanation:
- In c, c++ or Java programming language, The for loop takes three parameters in which first is an initialization, second is condition check and the third is an increment. None of the other loop (except for loop) takes three parameters. The other loop takes only one parameter and that is the condition check.
- So when a user knows about the times of iteration then it is a good choice to use the for loop but when the person does not know about the times of iteration if the loop. It means the iteration of the loop is based on the condition then it is a good choice to chose while or Do-while loop.
- The above question wants to ask which loop for a user can best if he familiar with the iteration of the loop then the answer is for loop which is started from option 3. Hence Option 3 is the correct answer while the other is not because--
- Option 1 states about the do-while loop which takes condition only.
- Option 2 states about the while loop which also takes condition only.
- Option 4 states about the infinite loop which is not any loop.
- Option 5 states about none of these which is not correct because option 3 is the correct answer.
Answer:
public class Brainly
{
public static void main(String[] args)
{
BinaryConverter conv = new BinaryConverter();
String binStr = "01001101";
System.out.print(binStr + " in decimal is "+conv.BinToDec(binStr));
}
}
public class BinaryConverter
{
public int BinToDec(String binStr)
{
int d = 0;
while(binStr.length() > 0)
{
d = (d << 1) + ((binStr.charAt(0) == '1') ? 1: 0);
binStr = binStr.substring(1);
}
return d;
}
}
Explanation:
The program "eats" the string from left to right, and builds up the integer representation in variable "d" on the go. While there are digits left, it shifts the previous result to the left and sets the least signficant bit to 1 only if the corresponding string character is a 1.