Enjoy the best grades that will raise your GPA.

# Category: Python(Page 1 of 2)

1. Write a function that prompts the user for a message (like “what is your name?”). The function should collect the user’s answer and return it back to the call (in the main program above the function). Print out the returned string from the function.
2. Write a function that keeps prompting for a filename until a valid file is entered by the user (print out “file found, thanks”) or until five attempts have failed (print out “you did not enter a valid file name”). Call the function from the main part of your program. The function in this case does not return any value. Show the entire program (not just the function).

CS 335: Beyond Search Francisco Iacobelli
This assignment has two parts. One is conceptual (some pseudocode) and in the second part you will compare two searching algorithms to solve the 8-queens problem.
1.1 PART 1:Conceptual
Write pseudo code for the following conditions:
• Simulated Annealing with T=0 at all times and ommiting the termination test
• Genetic algorithm with population of size 1
• Modify the Hill Climbing algorithm so that it implements random restarts H.C.
1.2 PART 2:Coding Hill Climbing
Create a python program called queens_hc.py that takes in one parameter from the command line: an integer. This integer will indicate the number of puzzles it will have tosolve.Runitlikeso(forexample,tosolve5randompuzzles):queens_hc.py 5. Follow the directions/advice below:
1. Theprogramshouldgenerateasmany8-queensinitialstates(boards)asthenum- ber from the command line indicates. Each state should be represented by a list with 8 elements. Each element indicates the position of a queen in a column. For example: [8, 2, 5, 1, 3, 4, 7, 6] represents the following board:
1
QZ0Z0Z0Z
Z0Z0Z0L0
0Z0Z0Z0L
Z0L0Z0Z0
0Z0Z0L0Z
Z0Z0L0Z0
0L0Z0Z0Z
Z0ZQZ0Z0
2

• •
• •
2.
queens.py, should have the following functions named exactly as follows:
• heuristic(board) that takes a board (state) as described above and
returns the number of attacking queens (directly and indirectly).
• find_best_successor(board) that will explore all possible suc- cessors of a board by altering the position of each queen, one space at a time along its colum. best_successor should explore 56 boards and return two values: The best board and its heuristic.
• find_solution_HC(board) implements hill climbing. Returns the final board, the number of iterations, and the heuristic of the board in a list.
Use the skeleton here http://fid.cl/courses/ai/hw/queens_hc. py to get you started. Also, if this program prints “True” under the “Tests” section, you are likely on the right track. (AKA. you will get a C or better for sure).
MUST HAVE
You must type your answers to the first task. Model it after the pseudo code on the slides. You can use the following statements:for, if, else, while and auxiliary functions such as max, min, cool_down,select_best and the like.
You must have only ONE python file called queens_hc.py that can read di- rectly from the command line. It should not ask the user for a number. For example, to test 350 puzzles you could invoke the program as follows:
python queens_hc.py 350
You must comply with the guidelines for python listed in the next section. All comments marked TODO must be dealt with
2
8 7 6 5 4 3 2 1
12345678

Please respond to the Discussion Board Post below:
Brandon Lopez’s Post:
” The Python code that I found that supports cloud security automation is called Boto3. Boto3 is used for Amazon cloud management using Python as its language it is used to assist everyday workers who utilize AWS cloud to be able to manage their cloud service along with a way to maintain their organization and utilizes many resources and collections in order to do that. Some of the main features that Boto3 uses to assist in managing cloud is sessions, credentials, configurations, extensibility guide, and collections to name a few. Boto3 also allows for something called pagination, pagination is a tool that allows for a higher level of resource useability than normal to assist individuals whether they are the actual customer or the people utilizing the tools to accomplish a task at work. Boto3 is actually a very resourceful tool with about two hundred different services it has a tool for almost anything you can think when it comes to managing a company not just its cloud-based network. Some of these tools include scripts to monitor budgeting, monitoring cloud network, monitoring cloud resources, cloud usage, cloud back up, cloud code along with debugging, surveillance of cloud environment, AI services such as Alexa, manage cloud service pricing, and even allows different services to interact with each other to better utilize resources. You can download Boto3 in your Python environment using import boto3 or pip install boto3 however, you will need an AWS account to be able to login and use Boto3.
Resources
Svitla Team, Boto3 – Cloud Management System for Python, Svitla, February 17, 2020
Boto3 – cloud management system for Python (svitla.com)”
The rubric is attached. Thank you.

Demonstrate understanding of File I/O and Unit Test in Python.
Please finish the last step of assignment. Unfinished code and instruction will be given when contract starts.

Demonstrate understanding of File I/O and Unit Test in Python.
Please finish the last step of assignment. Unfinished code and instruction will be given when contract starts.

Read the rubric and do the work. The page limit is not mentioned. I chose 2 pages only because in this website there is no option for unlimited pages.
Thank you.

This week’s assignment involves writing a Python program to compute the
weighted average grade for each student in a group of four students. In
addition, it should determine which student has the highest average.
Your program should include a list of four student names. You decide on
the names of the four students. Each student will have three grades–one
for the discussion, one for the quiz and one for the programming
assignment.
Weighted averages work by assigning a percentage weight to each grade
and then multiplying the grade. (i.e a 40% weight of a grade would be
.40 * grade). You should decide on the weights for each of the three
grades, but the three weights must add to 1 and the three must be
different (i.e. .20 .30 .50). Apply the appropriate weight to each
grade and sum to get the weighted average.
Your program must include a function that accepts the student name,
prompts the user for the three grades and computes and returns the
average.
In the main program, inside a for
loop, that function should be called successively and the name of the
student and the student’s grade should be displayed. In addition a check
should be made to determine whether that student’s grade is the highest
so far.
Once the loop completes, the name of the student with the highest grade,
and that grade should be displayed. If more than one student has the
highest grade, display the name of the first such student.
Your program should include Header comments (what the program does) and
in-line comments (the major design steps). Document the values you
chose for the student name list as well. Also document the values you
chose as the weights for the three grades in your comments as well.
Submit your Python program as a text file ( .py) file. In addition,
submit a Design outline and a Test plan/report (at least 3 different
test cases) in a Word document or a .pdf file and include a screen shot
of execution of your program for each test case.

This week’s assignment involves writing a Python program to compute the
cost of house cleaning. Your program should prompt the user for the
number of rooms in the house and the type of cleaning (eg. Floors,
Windows, Bathrooms, Dusting, etc.). Your program must offer at least
two types of cleaning and the price is different for each type. You
should decide on the choices to offer and the different prices of each
type of cleaning. The cost should be based on whether the house has a
small number of rooms, a medium number or a large number and the type of
cleaning. You should decide on the cutoffs for what constitutes a
small, medium and large number of rooms. Your program should output the
cost of the house cleaning based on the number of rooms and the type of
cleaning.
Your program should include Header comments (what the program does) and
in-line comments (the major design steps). Document the values you
chose as the cutoffs for the three house sizes, the cost for each size
and the prices for each cleaning type in your comments as well.
Submit your Python program as a text file ( .py) file. In addition,
submit a Design outline and a Test plan/report (3 different test cases)
in a Word document or a .pdf file and include a screen shot of execution
of your program for each test case.

Create a Python program that uses a while
loop and prompts the user for a series of inputs. You should use a
sentinel value to signal when the loop should terminate.
Calculate and
display the sum of the user inputs.
Some examples that you might use are the following:
Total number of miles traveled on a road trip.
Total cost of groceries in a month.
Total number of accidents in a year.
You must choose something different from any of the above, however.
Include comments in your code program that describe what the program does. Submit your code as an attachment (.py file) and post a screen shot of executing your program on at least one test case.

Your project plan should include the following parts:
Identify sources:
Identify 6-8 academic and technical sources. Sources might be conference or journal articles, online textbooks, technical documentation on an API or library.
Include links to your sources in the plan.
For tips on evaluating sources, please see https://guides.lib.jjay.cuny.edu/evaluatingsources
Annotated bibliography:
Include the sources identified above in the annotated bibliography. For each source, write a short paragraph in your own words that explains:
What is this source about? (For example, if they did research, what did they do? If it’s an API, what does the API allow, how is it used? etc.)
Why are you including it for your project? How will it be helpful for you?
For more information on Annotated Bibliographies and an example entry, please see https://guides.lib.jjay.cuny.edu/c.php?g=348899&p=23538
Outline:
Prepare a draft outline of the paper that shows how you plan to organize the writing. (It’s OK if this is modified as the project develops over the semester.)
For an example, please see https://www.lib.jjay.cuny.edu/how-to/write-an-outline