Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Enter your word: zebras
Enter a number: 62
Password not long enough.

Enter your word: newyorkcity
Enter a number: 892
Password: N@wyorkci+y892
import os

# This program has read/write access to the WORKSPACE directory
filepath = os.path.join( os.environ['WORKSPACE'], 'NewYorkTemps.txt' )

# The testing system will let this program know how many lines to expect
num_of_lines = int( input() )

# Copy input into the file. Do not modify!
with open( filepath, 'w' ) as file:
for _ in range( num_of_lines ):
file.write( input() + '\n' )

# Write your program below
What is an example of a purpose being met by the use of a program that involves file processing (batch processing)?
import os

# This program has read/write access to the WORKSPACE directory
filepath = os.path.join( os.environ['WORKSPACE'], 'yourfilename.txt' )
file = open(filepath, 'w')
Write a program to input ten book titles and authors names then save them to a file named book.txt.

books.txt

For each book, the user will first input the title, then input the first name, then the last name of the author, all on separate lines. In addition to saving the books in the file, please output, using the print method, the information you've gathered from the user.

You should follow the format uppercase title, tab, capitalized last name, comma, single space, capitalized first name. Here's an example for your output:

Format:

TO KILL A MOCKINGBIRD Lee, Harper
All book titles should be in upper case and the authors name should be capitalized.
Copy and paste the following code into the Solve tab. It will take data from input and put it into a file. Use the filepath variable to open the file and solve this problem.

import os

# This program has read/write access to the WORKSPACE directory
filepath = os.path.join( os.environ['WORKSPACE'], 'NewYorkTemps.txt' )

# The testing system will let this program know how many lines to expect
num_of_lines = int( input() )

# Copy input into the file. Do not modify!
with open( filepath, 'w' ) as file:
for _ in range( num_of_lines ):
file.write( input() + '\n' )

# Write your program below
file = open(filepath, 'r')
Write a program to find the average of the numbers stored in NewYorkTemps.txt. Be sure your output uses floating point numbers (i.e. numbers with decimals).
Write a program to generate passwords. The program should ask the user for a phrase and number, and then create the password based on our special algorithm. The algorithm to create the password is as follows:

If the users input word is less than 8 characters, output Password not long enough.
If the users input word is greater than or equal to 8 characters, do the following:
Replace es with @
Replace s or S with $
Replace t or T with +
Capitalize the word and add the number to the end.
Sample Run

Enter your word: zebras
Enter a number: 62
Password not long enough.

Enter your word: newyorkcity
Enter a number: 892
Password: N@wyorkci+y892
Write a program that asks the user to input a word or phrase and then outputs the following information about that phrase:

"All numbers", if the input is all numbers.
"Does not contain numbers", if the input does not contain any numbers.
"Contains a {digit}" for each number in the phrase.
Sample Run

Enter your word or phrase: 555
All numbers

Enter your word or phrase: We are #1!
Contains a 1

Enter your word or phrase: a1b2c3d
Contains a 1
Contains a 2
Contains a 3

Enter your word or phrase: computer science
Does not contain number
A chatbot is a computer program designed to emulate human conversation. For this program you will use if statements, user input, and random numbers to create a basic chatbot.

Here is the scenario: you have decided to start a website. You are creating a prototype to show investors so you can raise money and launch your website.

You should ask the user at least five questions and use if-elif-else statements and give answers depending on how they answer. Some responses should be based on what they type, and some should be based on random numbers.

For example, if they say they are sad, your chatbot might respond “I’m sorry to hear that”.

You could also have a random number generated between 1 and 3 and have a corresponding response depending on the number such as “That is great to hear” or “So interesting”.
Write a program to input 6 numbers. After each number is input, print the biggest of the numbers entered so far.

Example:

Enter a number: 1
Largest: 1
Enter a number: 3
Largest: 3
Enter a number: 4
Largest: 4
Enter a number: 9
Largest: 9
Enter a number: 3
Largest: 9
Enter a number: 5
Largest: 9
(Please answer I've been stuck on this problem for days)
In the last problem, we get an error if we enter more than one character at a time. Rewrite the program so that it only calls the ord method if a single character is entered.

Sample Run

Enter a character: *
ASCII #42

Enter a character: exit
Not a character
LATEST TUTORIALS
APPROVED BY CLIENTS