final exam Question 8 same structure

can anyone tell me about some of test cases in final exam question 8

print same_structure(4589,3)
print same_structure('aaaaaaaa','b')

does these both will give True or False or what else??

asked 08 Apr '12, 04:04

Owais%20Ahmed's gravatar image

Owais Ahmed
2014721
accept rate: 0%


3 Answers:

The structure of both those examples are the same. Even same_structure('aaaaaa',99999999999999) should print true.

link

answered 08 Apr '12, 08:18

Adam%20Dodson's gravatar image

Adam Dodson
6602933

Why does this one :

same_structure([1, [0], 1], [2, 5, 3])

return False ?

by definition, [0] and 5 have the same structure so I think the above function should return True instead.

Thanks,
Long

link

answered 08 Apr '12, 16:36

Pham%20Nam%20Long's gravatar image

Pham Nam Long
323

Ah, I should pay attention to the the "neither ... nor ...".

Btw, is it grammatically correct say "neither ... or ..." instead of "neither ... nor ..."?

(08 Apr '12, 16:41) Pham Nam Long Pham%20Nam%20Long's gravatar image

The first structure is a list which contains an element, list, element. The second is a sigle list which contains 3 elements. They are not the same structure.

(08 Apr '12, 16:42) Rob Barnes-3 ♦ Rob%20Barnes-3's gravatar image

I was wondering about this [1 , [''], 3] and [1,[1],1]

Should these two be the same structure?

link

answered 08 Apr '12, 17:22

Causalien's gravatar image

Causalien
615

Your answer
Question text:

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×15,262
×664
×637
×88
×19
×19

Asked: 08 Apr '12, 04:04

Seen: 352 times

Last updated: 08 Apr '12, 17:22