answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lana66690 [7]
2 years ago
5

Write a sequence of statements that create a file named "greeting" and write a single line consisting of "Hello, World!" to that

file. Make sure that the line has been flushed to the file and that any system resources used during the course of running these statements have been released.
Computers and Technology
1 answer:
tia_tia [17]2 years ago
4 0

Answer:

The solution code is written in Python 3 as below:

  1. outfile = open("greeting.txt", "w")
  2. outfile.write("Hello World")
  3. outfile.close()

Explanation:

To create a simple text file in Python, we can use Python built-in function, <em>open()</em>. There are two parameters needed for the open() function,

  1. the file name and
  2. a single keyword "w". "w" denote "write". This keyword will tell our program to create a file if the file doesn't exist.

The statement <em>open("greeting.txt", "w")</em> will create a text file named "<em>greeting.txt</em>" (Line 1)

To fill up the content in the greeting.txt, we use <em>write()</em> method. Just include the content string as the argument of the <em>write()</em> method. (Line 2)

At last, we use <em>close() </em>method to close the opened file,<em> outfile</em>. This will release the system resource from the<em> outfile.</em>

You might be interested in
Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
Tomtit [17]

Answer:

a. can use a hosting service to set up the site

Explanation:

Since the retailer has no knowledge on how to code and create a website and online presence for his business, he should consult a hosting service. The service will be able to communicate with the retailer and find out what his wishes are for his online presence. They will be able to create a webpage, social media accounts, and they can advertise the retailer's business.

8 0
2 years ago
Write a while loop that prints usernum divided by 2 until user_num is less than 1. The value of user_num changes inside of the l
zaharov [31]

Answer:

The program to this question can be describes as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

float user_num ;//defining float variable

cout<<"Enter any number: "; //message

cin>>user_num; //input value from the user

while (user_num >= 1) //defining loop to calculate value

{

user_num =user_num/ 2; //diving the value

cout<<user_num<<endl; //print value

}

return 0;

}

Output:

Enter any number: 20

10

5

2.5

1.25

0.625

Explanation:

In the above program, a float variable user_num is declared in which we store input value from the user end, in the next step, a while loop is declared, which calculates, the given value.

  • In the loop a condition is defined, that user_num value is greater than equal to 1, inside the loop it will divide the value of the user_num and store in this variable.
  • In this print, the method is used, which prints its variable values.
5 0
2 years ago
print_pattern() prints 5 characters. Call print_pattern() twice to print 10 characters. Example output: ***** ***** in python
Dominik [7]

Answer:

def print_pattern():

print("*****",end=" ")

print_pattern()

print_pattern()

5 0
2 years ago
The navigation bar on the left side of ____ view contains commands to perform actions common to most office programs.
kondor19780726 [428]

Answer:

The navigation bar on the left side of File view  contains commands to perform actions common to most office programs.

Explanation:

It enable all kinds of operations such as opening a file, closing a file, saving the file, saving a file with a different name, listing recently opened document, etc.

The open option enable us to open an existing file, all the recent files will be listed in the recent option and there are no files opened newly or if the data are cleared often, then it will be empty.

A file can be opened and saved with the different name so that the recent change will be saved in the new file and there will be presence of existing file too.

4 0
2 years ago
Software code is tested, debugged, fixed, verified, and then:
jenyasd209 [6]

A) tested again  because you would need to see if that worked

brainiest plz

7 0
2 years ago
Other questions:
  • Judd puts password protection on all of his files, makes sure not to have any patient information open on his computer when he t
    12·2 answers
  • Write an if-else statement that prints "Goodbye" if userString is "Quit", else prints "Hello". End with newline.
    11·2 answers
  • A form that dedicates a page for each item retrieved for a case; it allows investigators to add more detail about exactly what w
    10·1 answer
  • while investigating the settings on your SOHO router, you find two IP address reported on the devices's routing table, which is
    5·1 answer
  • Your revenue is $22,000. Your Cost of Goods is 16,250. Your gross profit is _____________, fill in the blank,.
    14·1 answer
  • Remember that it is desirable for good block ciphers that a change in one input bit affects many output bits, a property that is
    9·1 answer
  • Write a program that lets a user enter N and that outputs N! (N factorial, meaning N*(N-1)*(N-2)*..\.\*2*1). Hint: Initialize a
    5·1 answer
  • A company has offices in Honolulu, Seattle, Ogden, and Dublin, Ireland. There are transmission links between Honolulu and Seattl
    10·1 answer
  • Assume that the variables v, w, x, y, and z are stored in memory locations 200, 201, 202, 203, and 204, respectively.
    6·1 answer
  • It is also called teleconferencing or web conferencing,which is an online meeting wherein two or more people can see,hear,and ta
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!