Answer:
The answer is "Option A".
Explanation:
- In the given C++ Language program on line 8 compile-time error will occur, because in the code the conditional statement is used. In if block, we check two conditions together, which is the number variable value is greater than equal to 0 and check less than equal to 100.
- In this condition statement, a AND operator is used that execute when both condition is true, but in the last condition, we do not define a variable name that, checks value. That's why the program will give an error on line 8.
Answer:
In Python:
mystr = input("Sentence: ")
mylist = []
word = ""
for i in range(len(mystr)):
if not i == len(mystr)-1:
if not mystr[i] == " ":
word+=mystr[i]
else:
mylist.append(word)
word = ""
else:
word+=mystr[i]
mylist.append(word)
print(mylist)
Explanation:
Prompt the user for an input sentence
mystr = input("Sentence: ")
Initialize an empty list
mylist = []
Initialize each word to an empty string
word = ""
Iterates through the input sentence
for i in range(len(mystr)):
If index is not the last, the following if condition is executed
if not i == len(mystr)-1:
If the current character is not space
if not mystr[i] == " ":
Append the character to word
word+=mystr[i]
If otherwise
else:
Append word to the list
mylist.append(word)
Set word to an empty string
word = ""
If otherwise; i.e. If index is not the last
else:
Append the last character to word
word+=mystr[i]
Append word to the list
mylist.append(word)
Print the list
print(mylist)
Answer:
x = int(input("What grade are you in? "))
if (x == 9):
print ("Freshman")
elif (x == 10):
print("Sophomore")
elif (x == 11):
print ("Junior")
elif (x == 12):
print("Senior")
else:
print ("Not in High School")
Explanation:
Information technology can be defined as the study or use of systems for storing, retrieving, and sending information. Can be abbreviated to IT.