SlideShare a Scribd company logo
1 of 12
python_assignment/Hanoi (1).py
#######################################
#
# Name:
# Date:
# File Name: tower_hanoi.py
# Purpose: To create a function which
# makes a user input into a hanoi tower formula
#
#######################################
def hanoi(n, one, two, three):
if n > 0:
hanoi(n - 1, one, three, two)
if one[0]:
disk = one[0].pop()
print "moving " + str(disk) + " from " + one[1] + " to "
+ three[1]
three[0].append(disk)
hanoi(n - 1, two, one, three)
insert_numbers = int(input('Put a number: '))
insertNumList = []
for disk in reversed(range(1, insert_numbers+1)):
insertNumList.append(disk)
print ''
one = (insertNumList,'on peg one')
two = ([],'on peg two')
three = ([],'on peg three')
print 'Start: ',one,two,three
print ''
hanoi(len(one[0]),one,two,three)
print ''
print 'End Result: ',one,two,three
print "It took", int((2**insert_numbers)-1), "steps."
python_assignment/Maze Solver - Rubric.xlsx
Sheet1Maze Solver - RubricStudent Name:For each evaluation
criteria, fill out the deserved number of marks (out of the total
shown) :DescriptionSelf assessmentmarks out ofTeacher
evaluationload_maze functionthe function returns two-
dimentional list1the returned list is exact representation of the
input file - each character is an element 1the 'new line'
characters are not included in the returned list1the function does
not alter the input file1pick_random_location functionthe
function returns a tuple of two integer numbers - column and
row1the chosen location falls inside the maze1the chosen
location is an empty alley spot1print_maze functionthe function
prints arbitrary 2D array of single characters1the elements from
each nested list are agregated into a string1strings are printed
on separate lines, one after another, no spacing between
them1find_path RECURSIVE functionthe base cases are propely
defined3the function returns result when a base cases is
encountered2the function marks current location with a '+' sign,
as part of the path 1the function calls itself recursively for all
surrounding cells4the function unmarks current location as part
of the path if there is no path via any of the surrounding
cells1Application of conceptsthe program visualizes the process
of solving the maze by drawing it at each step3the program uses
properly two-dimensional list2the program converts efficiently
string to list and vice versa2Overallfunctionality4program
appearance
(header/comments/docstrings/names/spacing)4TOTAL0360Com
ments:
Sheet2
Sheet3
python_assignment/solution and iterations.zip
solution and iterations/maze.pyc
solution and iterations/maze_solver_main.py
#########################################
# Programmer: Mr. G
# Date: 28.02.2013
# File Name: maze_solver-main.py
# Description: This program solves a maze of arbitrary size.
# The program follows the algorithm described on the
following website:
# http://www.cs.bu.edu/teaching/alg/maze/
# Input file must comply with the following guidelines:
# - walls are one character thick and represented with "#"
# - alleys are one character wide and represented with
spaces
# - each line, including the last, ends with 'new line'
character
# Module maze contains the following functions:
# - load_maze(fname)
# - pick_random_location(maze)
# - print_maze(maze)
# - find_path(maze, x, y)
# After importing the module, use help(function name), to
understand how they work.
# These functions exercise the following:
# - reading from a file:
# - nested lists (2D lists)
# - string.join method:
# L = ['i', 't', 'e', 'r', 'a', 'b', 'l', 'e']
# print ''.join(L)
# - list comprehension
# - recursion
#########################################
import random
from maze import *
#---------------------------------------#
# main program #
#---------------------------------------#
fname = raw_input("Enter filename: ")
maze = load_maze(fname)
# generate random start and goal locations
Sx,Sy = pick_random_location(maze)
maze[Sy][Sx] = 'S'
Gx,Gy = pick_random_location(maze)
maze[Gy][Gx] = 'G'
print 'nHere is the maze with start and goal locations:'
print_maze(maze)
# now, find the path from S to G
find_path(maze, Sx, Sy)
print 'nHere is the maze with the path from start to goal:'
print_maze(maze)
solution and iterations/maze1.txt
###############################
# # # # #
# # # # ##### # ##### # ### ###
# # # # # # # # #
# # ### ######### # # ####### #
# # # # # # # # #
### # # # ######### ### # ### #
# # # # # # # # #
# ### ### # # ### ### ##### # #
# # # # # # # # # # # #
### # # # ### # ### ### # ### #
# # # # # # # # # #
# ### ### # ######### # # # ###
# # # # # # # # # #
# # ### ### # ### # # ### # # #
# # # # # # #
###############################
solution and iterations/maze2.txt
#####################
# # # #
### # ##### ### # # #
# # # # # #
# ##### ##### ##### #
# # # # # # #
# # # # # # ##### # #
# # # # # # # #
# ##### # # # # # # #
# # # # # # # # #
# # # ### ##### # ###
# # # # # # #
# # ### # ######### #
# # # # # #
# # # ##### # #######
# # # # # # #
### ##### # # # ### #
# # # # # #
# ##### ########### #
# #
#####################
solution only/maze.pyc
solution only/maze_solver_main.py
#########################################
# Programmer: Mr. G
# Date: 28.02.2013
# File Name: maze_solver-main.py
# Description: This program solves a maze of arbitrary size.
# The program follows the algorithm described on the
following website:
# http://www.cs.bu.edu/teaching/alg/maze/
# Input file must comply with the following guidelines:
# - walls are one character thick and represented with "#"
# - alleys are one character wide and represented with
spaces
# - each line, including the last, ends with 'new line'
character
# Module maze contains the following functions:
# - load_maze(fname)
# - pick_random_location(maze)
# - print_maze(maze)
# - find_path(maze, x, y)
# After importing the module, use help(function name), to
understand how they work.
# These functions exercise the following:
# - reading from a file:
# - nested lists (2D lists)
# - string.join method:
# L = ['i', 't', 'e', 'r', 'a', 'b', 'l', 'e']
# print ''.join(L)
# - list comprehension
# - recursion
#########################################
import random
from maze import *
#---------------------------------------#
# main program #
#---------------------------------------#
fname = raw_input("Enter filename: ")
maze = load_maze(fname)
# generate random start and goal locations
Sx,Sy = pick_random_location(maze)
maze[Sy][Sx] = 'S'
Gx,Gy = pick_random_location(maze)
maze[Gy][Gx] = 'G'
print 'nHere is the maze with start and goal locations:'
print_maze(maze)
# now, find the path from S to G
find_path(maze, Sx, Sy)
print 'nHere is the maze with the path from start to goal:'
print_maze(maze)
solution only/maze1.txt
###############################
# # # # #
# # # # ##### # ##### # ### ###
# # # # # # # # #
# # ### ######### # # ####### #
# # # # # # # # #
### # # # ######### ### # ### #
# # # # # # # # #
# ### ### # # ### ### ##### # #
# # # # # # # # # # # #
### # # # ### # ### ### # ### #
# # # # # # # # # #
# ### ### # ######### # # # ###
# # # # # # # # # #
# # ### ### # ### # # ### # # #
# # # # # # #
###############################
solution only/maze2.txt
#####################
# # # #
### # ##### ### # # #
# # # # # #
# ##### ##### ##### #
# # # # # # #
# # # # # # ##### # #
# # # # # # # #
# ##### # # # # # # #
# # # # # # # # #
# # # ### ##### # ###
# # # # # # #
# # ### # ######### #
# # # # # #
# # # ##### # #######
# # # # # # #
### ##### # # # ### #
# # # # # #
# ##### ########### #
# #
#####################
python_assignmentHanoi (1).py################################.docx

More Related Content

Similar to python_assignmentHanoi (1).py################################.docx

Similar to python_assignmentHanoi (1).py################################.docx (20)

belajar
belajarbelajar
belajar
 
Claudia
ClaudiaClaudia
Claudia
 
HoneyNet SOTM 29 - Linux Server Hack Analysis
HoneyNet SOTM 29 - Linux Server Hack AnalysisHoneyNet SOTM 29 - Linux Server Hack Analysis
HoneyNet SOTM 29 - Linux Server Hack Analysis
 
Loc
LocLoc
Loc
 
Informe
InformeInforme
Informe
 
Otl
OtlOtl
Otl
 
Fraglist
FraglistFraglist
Fraglist
 
Tgcmlog
TgcmlogTgcmlog
Tgcmlog
 
Volume c
Volume cVolume c
Volume c
 
Kbs
KbsKbs
Kbs
 
Sched lgu
Sched lguSched lgu
Sched lgu
 
Viva
VivaViva
Viva
 
Música
MúsicaMúsica
Música
 
Purchased
PurchasedPurchased
Purchased
 
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucksDEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
DEF CON 24 - Six Volts and Haystack - cheap tools for hacking heavy trucks
 
Volumen c final
Volumen c finalVolumen c final
Volumen c final
 
Slow
SlowSlow
Slow
 
Sched lgu
Sched lguSched lgu
Sched lgu
 
Install
InstallInstall
Install
 
Install
InstallInstall
Install
 

More from amrit47

APA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxAPA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxamrit47
 
APA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxAPA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxamrit47
 
Apa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxApa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxamrit47
 
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxAPA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxamrit47
 
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
APA format     httpsapastyle.apa.orghttpsowl.purd.docxAPA format     httpsapastyle.apa.orghttpsowl.purd.docx
APA format  httpsapastyle.apa.orghttpsowl.purd.docxamrit47
 
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxAPA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxamrit47
 
APA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxAPA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxamrit47
 
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxAPA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxamrit47
 
APA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxAPA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxamrit47
 
APA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxAPA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxamrit47
 
Appearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxAppearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxamrit47
 
apa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxapa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxamrit47
 
APA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxAPA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxamrit47
 
APA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxAPA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxamrit47
 
APA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxAPA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxamrit47
 
APA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxAPA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxamrit47
 
APA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxAPA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxamrit47
 
APA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxAPA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxamrit47
 
APA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxAPA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxamrit47
 
APA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxAPA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxamrit47
 

More from amrit47 (20)

APA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docxAPA, The assignment require a contemporary approach addressing Race,.docx
APA, The assignment require a contemporary approach addressing Race,.docx
 
APA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docxAPA style and all questions answered ( no min page requirements) .docx
APA style and all questions answered ( no min page requirements) .docx
 
Apa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docxApa format1-2 paragraphsreferences It is often said th.docx
Apa format1-2 paragraphsreferences It is often said th.docx
 
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docxAPA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
APA format2-3 pages, double-spaced1. Choose a speech to review. It.docx
 
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
APA format     httpsapastyle.apa.orghttpsowl.purd.docxAPA format     httpsapastyle.apa.orghttpsowl.purd.docx
APA format  httpsapastyle.apa.orghttpsowl.purd.docx
 
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docxAPA format2-3 pages, double-spaced1. Choose a speech to review. .docx
APA format2-3 pages, double-spaced1. Choose a speech to review. .docx
 
APA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docxAPA Formatting AssignmentUse the information below to create.docx
APA Formatting AssignmentUse the information below to create.docx
 
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docxAPA style300 words10 maximum plagiarism  Mrs. Smith was.docx
APA style300 words10 maximum plagiarism  Mrs. Smith was.docx
 
APA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docxAPA format1. What are the three most important takeawayslessons.docx
APA format1. What are the three most important takeawayslessons.docx
 
APA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docxAPA General Format Summary APA (American Psychological.docx
APA General Format Summary APA (American Psychological.docx
 
Appearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docxAppearance When I watched the video of myself, I felt that my b.docx
Appearance When I watched the video of myself, I felt that my b.docx
 
apa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docxapa format1-2 paragraphsreferencesFor this week’s .docx
apa format1-2 paragraphsreferencesFor this week’s .docx
 
APA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docxAPA Format, with 2 references for each question and an assignment..docx
APA Format, with 2 references for each question and an assignment..docx
 
APA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docxAPA-formatted 8-10 page research paper which examines the potential .docx
APA-formatted 8-10 page research paper which examines the potential .docx
 
APA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docxAPA    STYLE 1.Define the terms multiple disabilities and .docx
APA    STYLE 1.Define the terms multiple disabilities and .docx
 
APA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docxAPA STYLE  follow this textbook answer should be summarize for t.docx
APA STYLE  follow this textbook answer should be summarize for t.docx
 
APA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docxAPA7Page length 3-4, including Title Page and Reference Pag.docx
APA7Page length 3-4, including Title Page and Reference Pag.docx
 
APA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docxAPA format, 2 pagesThree general sections 1. an article s.docx
APA format, 2 pagesThree general sections 1. an article s.docx
 
APA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docxAPA Style with minimum of 450 words, with annotations, quotation.docx
APA Style with minimum of 450 words, with annotations, quotation.docx
 
APA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docxAPA FORMAT1.  What are the three most important takeawayslesson.docx
APA FORMAT1.  What are the three most important takeawayslesson.docx
 

Recently uploaded

Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptxVishal Singh
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfcupulin
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 

Recently uploaded (20)

Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 

python_assignmentHanoi (1).py################################.docx

  • 1. python_assignment/Hanoi (1).py ####################################### # # Name: # Date: # File Name: tower_hanoi.py # Purpose: To create a function which # makes a user input into a hanoi tower formula # ####################################### def hanoi(n, one, two, three): if n > 0: hanoi(n - 1, one, three, two) if one[0]: disk = one[0].pop() print "moving " + str(disk) + " from " + one[1] + " to " + three[1]
  • 2. three[0].append(disk) hanoi(n - 1, two, one, three) insert_numbers = int(input('Put a number: ')) insertNumList = [] for disk in reversed(range(1, insert_numbers+1)): insertNumList.append(disk) print '' one = (insertNumList,'on peg one') two = ([],'on peg two') three = ([],'on peg three') print 'Start: ',one,two,three print '' hanoi(len(one[0]),one,two,three)
  • 3. print '' print 'End Result: ',one,two,three print "It took", int((2**insert_numbers)-1), "steps." python_assignment/Maze Solver - Rubric.xlsx Sheet1Maze Solver - RubricStudent Name:For each evaluation criteria, fill out the deserved number of marks (out of the total shown) :DescriptionSelf assessmentmarks out ofTeacher evaluationload_maze functionthe function returns two- dimentional list1the returned list is exact representation of the input file - each character is an element 1the 'new line' characters are not included in the returned list1the function does not alter the input file1pick_random_location functionthe function returns a tuple of two integer numbers - column and row1the chosen location falls inside the maze1the chosen location is an empty alley spot1print_maze functionthe function prints arbitrary 2D array of single characters1the elements from each nested list are agregated into a string1strings are printed on separate lines, one after another, no spacing between them1find_path RECURSIVE functionthe base cases are propely defined3the function returns result when a base cases is encountered2the function marks current location with a '+' sign, as part of the path 1the function calls itself recursively for all surrounding cells4the function unmarks current location as part of the path if there is no path via any of the surrounding cells1Application of conceptsthe program visualizes the process of solving the maze by drawing it at each step3the program uses
  • 4. properly two-dimensional list2the program converts efficiently string to list and vice versa2Overallfunctionality4program appearance (header/comments/docstrings/names/spacing)4TOTAL0360Com ments: Sheet2 Sheet3 python_assignment/solution and iterations.zip solution and iterations/maze.pyc solution and iterations/maze_solver_main.py ######################################### # Programmer: Mr. G # Date: 28.02.2013 # File Name: maze_solver-main.py # Description: This program solves a maze of arbitrary size. # The program follows the algorithm described on the following website: # http://www.cs.bu.edu/teaching/alg/maze/ # Input file must comply with the following guidelines: # - walls are one character thick and represented with "#" # - alleys are one character wide and represented with spaces # - each line, including the last, ends with 'new line' character # Module maze contains the following functions: # - load_maze(fname) # - pick_random_location(maze) # - print_maze(maze) # - find_path(maze, x, y) # After importing the module, use help(function name), to understand how they work. # These functions exercise the following: # - reading from a file:
  • 5. # - nested lists (2D lists) # - string.join method: # L = ['i', 't', 'e', 'r', 'a', 'b', 'l', 'e'] # print ''.join(L) # - list comprehension # - recursion ######################################### import random from maze import * #---------------------------------------# # main program # #---------------------------------------# fname = raw_input("Enter filename: ") maze = load_maze(fname) # generate random start and goal locations Sx,Sy = pick_random_location(maze) maze[Sy][Sx] = 'S' Gx,Gy = pick_random_location(maze) maze[Gy][Gx] = 'G' print 'nHere is the maze with start and goal locations:' print_maze(maze) # now, find the path from S to G find_path(maze, Sx, Sy) print 'nHere is the maze with the path from start to goal:' print_maze(maze) solution and iterations/maze1.txt ############################### # # # # #
  • 6. # # # # ##### # ##### # ### ### # # # # # # # # # # # ### ######### # # ####### # # # # # # # # # # ### # # # ######### ### # ### # # # # # # # # # # # ### ### # # ### ### ##### # # # # # # # # # # # # # # ### # # # ### # ### ### # ### # # # # # # # # # # # # ### ### # ######### # # # ### # # # # # # # # # # # # ### ### # ### # # ### # # # # # # # # # # ############################### solution and iterations/maze2.txt ##################### # # # #
  • 7. ### # ##### ### # # # # # # # # # # ##### ##### ##### # # # # # # # # # # # # # # ##### # # # # # # # # # # # ##### # # # # # # # # # # # # # # # # # # # ### ##### # ### # # # # # # # # # ### # ######### # # # # # # # # # # ##### # ####### # # # # # # # ### ##### # # # ### # # # # # # # # ##### ########### # # #
  • 8. ##################### solution only/maze.pyc solution only/maze_solver_main.py ######################################### # Programmer: Mr. G # Date: 28.02.2013 # File Name: maze_solver-main.py # Description: This program solves a maze of arbitrary size. # The program follows the algorithm described on the following website: # http://www.cs.bu.edu/teaching/alg/maze/ # Input file must comply with the following guidelines: # - walls are one character thick and represented with "#" # - alleys are one character wide and represented with spaces # - each line, including the last, ends with 'new line' character # Module maze contains the following functions: # - load_maze(fname) # - pick_random_location(maze) # - print_maze(maze) # - find_path(maze, x, y) # After importing the module, use help(function name), to understand how they work. # These functions exercise the following: # - reading from a file: # - nested lists (2D lists) # - string.join method: # L = ['i', 't', 'e', 'r', 'a', 'b', 'l', 'e'] # print ''.join(L) # - list comprehension
  • 9. # - recursion ######################################### import random from maze import * #---------------------------------------# # main program # #---------------------------------------# fname = raw_input("Enter filename: ") maze = load_maze(fname) # generate random start and goal locations Sx,Sy = pick_random_location(maze) maze[Sy][Sx] = 'S' Gx,Gy = pick_random_location(maze) maze[Gy][Gx] = 'G' print 'nHere is the maze with start and goal locations:' print_maze(maze) # now, find the path from S to G find_path(maze, Sx, Sy) print 'nHere is the maze with the path from start to goal:' print_maze(maze) solution only/maze1.txt ############################### # # # # # # # # # ##### # ##### # ### ### # # # # # # # # # # # ### ######### # # ####### #
  • 10. # # # # # # # # # ### # # # ######### ### # ### # # # # # # # # # # # ### ### # # ### ### ##### # # # # # # # # # # # # # # ### # # # ### # ### ### # ### # # # # # # # # # # # # ### ### # ######### # # # ### # # # # # # # # # # # # ### ### # ### # # ### # # # # # # # # # # ############################### solution only/maze2.txt ##################### # # # # ### # ##### ### # # # # # # # # #
  • 11. # ##### ##### ##### # # # # # # # # # # # # # # ##### # # # # # # # # # # # ##### # # # # # # # # # # # # # # # # # # # ### ##### # ### # # # # # # # # # ### # ######### # # # # # # # # # # ##### # ####### # # # # # # # ### ##### # # # ### # # # # # # # # ##### ########### # # # #####################