Answer:
The program to this question can be given as follows:
Program:
//header file
#include <iostream> //defining header file
using namespace std;
//main
int main() //defining main method
{
string name; //defining main method
cout<<"enter name: "; //print message
getline(cin,name); //using getline method
cout<<"The name you inserted is: "<<name; //print value
return 0;
}
Output:
Please Enter Name: Brenda Clinton
The name you inserted is: Brenda Clinton
Explanation:
Firstly the header file is included in the above C++ program code, in the next line the main method is defined, inside this method the string variable is defined which takes value from user-ends.
- In the above specifies the getline method, which can be referred to as a standard library feature for reading an input stream string or a line. It removes characters from the input stream and applies this to the string object until the character is delimited.
- After taking input the print method "cout" is used to print "name" variable value.
Answer:
import os
def create_python_script(filename):
comments = "# new python script file"
with open(filename,"w+") as file:
file.write(comments)
filesize = os.path.getsize(filename)
print(f"The size of the file is: {filesize}")
create_python_script("program.py")
Explanation:
The os module is a built-in python file that is used to interact with the operating system terminal. The with keyword is used to create and open a file with write privileges with no need to close the file.
The path.getsize() method is used to get the size of the newly created file which is printed in the console.
A source code editor, hope this helps! :)
This person is Elon Musk, the owner of Tesla :)