Python Answers

Questions answered by Experts: 5 288

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

Given an input undirected graph, write a program to check if the graph is two-edge connected or not. If the graph is not two-edge connected, print all the bridge edges. (Assume that the input graph is connected.)


Input Format: The input is a text file which describes an undirected graph. The first line of the file specifies n & m, the number of vertices and number of edges in the graph respectively. The next m lines specify the m edges of the graph, one line per edge. An edge is described by its end points. If the number of vertices is n, assume that the vertices of the graph are numbered (0,1,..n-1).Code is run in terminal as python3 main.py ./input.txt


Output Format: Print YES, if the input graph is two-edge connected, NO otherwise. If printing NO, print all the bridge edges in the graph.


Sample Input 1

(for the graph shown on the right):

8 10

0 1

1 2

0 3

3 4

3 6

4 6

5 4

5 6

7 6

5 7

Sample Output 1:

NO

1 2

0 1

0 3



1.How do i write a program that prints different messages for different months of the year. 



can i get code for this

input:

4

2

3

5

7


output:2


with following steps:


Read the Input into a variable.


Now using the loop iterate in range 1 to input.


Again read the second input into the variable.


Now take the count to assign the value 0 to it.


Using loop condition iterate from range 1 to second input.


using the if condition checks the condition that the second input is divisible by number then increment the count.


If the count is equal to 2


print the number and break from the loop.


Section 6.9 of your textbook ("Debugging") lists three possibilities to consider if a function is not working.

  • Describe each possibility in your own words.
  • Define "precondition" and "postcondition" as part of your description.
  • Create your own example of each possibility in Python code. List the code for each example, along with sample output from trying to run it.

Create a Python script which will compute the TOTAL Sales in a Grapes Store. The grapes is sold at 235.75 per kilo. 5% discount is given to customers that will buy 5 kilos and above. Compute also the CHANGE after the customer tendered their money. Format the display with two decimal digits.



Sample Output 1:


GRAPE STORE


No. of Kilos: 3


Total Price: 707.25


Discount: 0.00


Discounted Price: 707.25


CASH: 1000


Change: 292.75



I need the complete coding of this. Thank you



Create a Python script that will accept three integers and will check each input number. If the input number is EVEN it will display the square of cube of the number and if the number is ODD it will display the square of the number.



Sample Output


Number 1: 5


Number 2: 8


Number 3: 3 The square of 5 is 25


The cube of 8 is 512 The square of 3 is 9.



I need the complete coding of this. Thank you

- Load iris data from load_iris function from sklearn.datasets package.

- From the dataset extract the data property.

- Train an AgglomerativeClustring model based on the data.

- Plot dendrogram to visualize the clustering linkage


0 0 1 0 0

0 1 1 1 0

1 1 1 1 1


can i get code for this please!


*

* *

* * *

* * * *

* * * * *

* *

* *

* *

*

can i get the exact code for this.


Create a Python script which will compute the TOTAL Sales in a Grapes Store. The grapes is sold at 235.75 per kilo. 5% discount is given to customers that will buy 5 kilos and above. Compute also the CHANGE after the customer tendered their money. Format the display with two decimal digits.




Sample Output 2:



GRAPE STORE



No. of Kilos: 3



Total Price: 707.25



Discount: 0.00



Discounted Price: 707.25



CASH: 1000



Change: 292.75







LATEST TUTORIALS
APPROVED BY CLIENTS