Answer:
See Explanation
Explanation:
I'll assume the question is about the use of constants in QBasic because consonants do not have any special function or usage in QBasic.
In simple terms: In QBasic, constants are used to represent elements that do not change in value during program execution.
Take for instance, you intend to use in your program.
Its value is
So, 3.142 will always be a constant in your program. One of the ways it can be used in a program is:
10 LET PI = 3.142
<em>The above represents a numeric constant. QBasic also have string constants.</em>
Answer:
userInput = input("Please enter a string of words ")
userInput.split ()
for item in userInput.split ():
if item =="darn":
print("Censored")
break
else:
print(userInput)
Explanation:
Using Python programming language, the input function is used to receive the users input and save in a variable userInput
Then the .split method is used to convert the words into a list of words.
Using a for loop, the code checks for the word darn and prints censored if it exists else it prints the userInput
Answer:
The languages C++, Java, Python are Object Oriented Programming languages. What this means is that we create classes and then instantiate those classes. In C++ and Java, we use the new operator to instantiate the classes. So, if we want to display some data when we try to print the instance just like we print the variables of data types like int, double, string etc, we need to define what we need to display. It is because, class are just like data types like int, double etc. But as they are defined by the developer according to his/her needs, so the developer has to define what to print when they are printed.
Answer:
In Python:
import os.path
from os import path
fname = input("Filename: ")
if path.exists(fname):
with open(fname) as file_in:
lines = []
for line in file_in:
lines.append(line.rstrip('\n'))
f = open("stat.txt","r+")
f.truncate(0)
f = open("stat.txt", "a")
f.write("Names\tTotal\tSubjects\tAverage\n")
for i in range(len(lines)):
rowsum = 0; count = 0
nm = lines[i].split()
for j in nm:
if (j.isdecimal()):
count+=1
rowsum+=int(j)
average = rowsum/count
f.write(nm[0]+"\t %3d\t %2d\t\t %.2f\n" % (rowsum, count, average))
f.close()
else:
print("File does not exist")
Explanation:
See attachment for explanation where comments were used to explain each line
Answer:
The invention of flashlight is associated in the late period of industrial revolution.
Explanation:
- During the industrial revolution, Europe and United States flipped the use or technology in the manufacturing processes of industries.
- At the time of industrial revolution many chief inventions like, steam engine, dynamites etc. were made that the traditional history and reformed the technology.
- Thomas Edison in 1879, invented the battery and flashlight at the late period of industrial revolution which was also a major invention