Question

8.25 Programming Assignment 3 Question 1 The Robots path (25pts) A certain robot can perform only 4 types of movement. It ca

0 0
Add a comment Improve this question Transcribed image text
Answer #1

******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As HOMEWORKLIB RULES expert answering guidelines,Experts are supposed to answer only certain number of questions/sub-parts in a post.Please raise the remaining as a new question as HOMEWORKLIB RULES guidelines.
******************************************************************************************

def position( direction):
direction= direction.split(",")
l=0
u=0
# print(direction)
count=0
for x in direction:
# print(x[0])
if count>=1:
if x[1]=='L':
l+=int(x[3:])
elif x[1]=='R':
l-=int(x[3:])
elif x[1]=='U':
u+=int(x[3:])
elif x[1]=='D':
u-=int(x[3:])
else :
return "Bad input"
else:
if x[0]=="L":
l+=int(x[2:])
elif x[0]=="R":
l-=int(x[2:])
elif x[0]=="U":
u+=int(x[2:])
elif x[0]=="D":
u-=int(x[2:])
else :
return "Bad input"
count+=1   
if l==0 and u==0:
return True
else :
return False

direction = input()
print(position(direction))

Add a comment
Know the answer?
Add Answer to:
8.25 Programming Assignment 3 Question 1 The Robot's path (25pts) A certain robot can perform only...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Prepare a design for the Baby Block Robot. The design should be in flow diagram form....

    Prepare a design for the Baby Block Robot. The design should be in flow diagram form. This diagram should help you identify the sequence of steps needed to solve specific situations that the robot will encounter. Be specific. Break down the actions into small steps. Test you design by using example block sequences. Think it through. I would expect the diagram to require multiple pages. If you have a program that supports flow diagrams, like PowerPoint, then use that. Hand...

  • C++ Programming Question: This programming assignment is intended to demonstrate your knowledge of the following: ▪...

    C++ Programming Question: This programming assignment is intended to demonstrate your knowledge of the following: ▪ Writing a while loop ▪ Write functions and calling functions Text Processing [50 points] We would like to demonstrate our ability to control strings and use methods. There are times when a program has to search for and replace certain characters in a string with other characters. This program will look for an individual character, called the key character, inside a target string. It...

  • 1. (p. 2-3.) Which of the following is NOT a reason for studying concepts of programming...

    1. (p. 2-3.) Which of the following is NOT a reason for studying concepts of programming languages according to Sebesta? a. Increased capacity to express ideas. b. Improved background for choosing appropriate languages. c. Increased ability to design new languages. d. Increased ability to learn new languages. 2. (p. 5-6.) What programming language has dominated scientific computing over the past 50 years? a. FORTRAN b. ALGOL c. SNOBOL d. PL/I 3. (p. 6.) What programming language has dominated artificial intelligence...

  • I need help with this assignment in C++, please! *** The instructions and programming style detai...

    I need help with this assignment in C++, please! *** The instructions and programming style details are crucial for this assignment! Goal: Your assignment is to write a C+ program to read in a list of phone call records from a file, and output them in a more user-friendly format to the standard output (cout). In so doing, you will practice using the ifstream class, I'O manipulators, and the string class. File format: Here is an example of a file...

  • Assignment #3 Introduction to C Programming-COP 3223 Objectives 1 Togve students practice at typing in, compiling...

    Assignment #3 Introduction to C Programming-COP 3223 Objectives 1 Togve students practice at typing in, compiling and nunning simple programs. 2 To reinforce knowledge of assignment statements and arithmetic expressions 3. To learn how to use if statements for conditional execution Introduction: Programmers for a Better Tomorrow Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical societies, and scholarship organizations manage various tasks so that they can focus on making the world a better place! They...

  • java Object Oriented Programming The assignment can be done individually or in teams of two. Submit one as...

    java Object Oriented Programming The assignment can be done individually or in teams of two. Submit one assignment per team of two via Omnivox and NOT MIO.Assignments sent via MIO will be deducted marks. Assignments must be done alone or in groups and collaboration between individuals or groups is strictly forbidden. There will be a in class demo on June 1 make sure you are prepared, a doodle will be created to pick your timeslot. If you submit late, there...

  • Problem 1: Random Walk A random walk is a stochastic process. A stochastic process is a series of...

    python / visual studio Problem 1: Random Walk A random walk is a stochastic process. A stochastic process is a series of values that are not determined functionally, but probabilistically. The random walk is supposed to describe an inebriated person who, starting from the bar, intends to walk home, but because of intoxication instead randomly takes single steps either forward or backward, left or right. The person has no memory of any steps taken, so theoretically, the person shouldn't move...

  • python / visual studio Problem 1: Random Walk A random walk is a stochastic process. A...

    python / visual studio Problem 1: Random Walk A random walk is a stochastic process. A stochastic process is a series of values that are not determined functionally, but probabilistically. The random walk is supposed to describe an inebriated person who, starting from the bar, intends to walk home, but because of intoxication instead randomly takes single steps either forward or backward, left or right. The person has no memory of any steps taken, so theoretically, the person shouldn't move...

  • Advanced Object-Oriented Programming using Java Assignment 4: Exception Handling and Testing in Java Introduction -  This assignment...

    Advanced Object-Oriented Programming using Java Assignment 4: Exception Handling and Testing in Java Introduction -  This assignment is meant to introduce you to design and implementation of exceptions in an object-oriented language. It will also give you experience in testing an object-oriented support class. You will be designing and implementing a version of the game Nim. Specifically, you will design and implement a NimGame support class that stores all actual information about the state of the game, and detects and throws...

  • CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write...

    can i get some help with this program CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 Sns 15. (Students who took CMPS 12A from me worked on an iterative, non-recursive approach to this same problem. You can see it at https://classes.soe.ucsc.edu/cmps012a/Spring l8/pa5.pdf.) Begin by reading the Wikipcdia article on the Eight Queens puzzle at: http://en.wikipedia.org/wiki/Eight queens_puzzle In...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT