logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Vikrant BansalComputer science
(5/5)

791 Answers

Hire Me
expert
Colin JenkinssSocial sciences
(5/5)

762 Answers

Hire Me
expert
Milan JoshiSocial sciences
(5/5)

979 Answers

Hire Me
expert
Catherine Chanwai EarleLaw
(5/5)

923 Answers

Hire Me
Others
(5/5)

For a given input series we need to represent a pattern in graph format.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Question: For a given input series we need to represent a pattern in graph format.

As you can see in the image. The even digits are incrementing with “/” and odd digits are decrementing with “\” and at the highest point we get “That human figure”.

If the input value is 3 then it is taking 3 slashes. If it is in odd place it decreases with “\” 3 times , else it increments with “/” 3 times. Similarly the rest of the inputs.

Now I have written a code in which it is printing correctly but not side by side. It is printing from the next line.

My Code :

def descending(n):

   for i in range(1,n+1):

        for j in range(i+1):

            if j==i :

                print("\ ",end=" ")

            else:

                print(" ", end=" ")

        print()

 

 

def ascending(n):

    for i in range(n,0,-1):

        for j in range(i+1):

            if j==i :

                print('/',end=" ")

            else:

                print(" ", end=" ")

        print()

 

 

arr=[3,1,2,3,6,2]

for i in range(len(arr)):

    if i%2==0:

        ascending(arr[i])

        print()

    else:

        descending(arr[i])

        print()

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme