python-tutorial icon indicating copy to clipboard operation
python-tutorial copied to clipboard

Errors found in `basic_datatypes`

Open despadam opened this issue 1 year ago • 3 comments

  • [ ] We start printing examples directly with string interpolation, never show them the simple print(a)
  • [ ] Start with explaining the difference between print and return (probably in the intro). They get confused by the solution function syntax.
  • [ ] math was not imported for solution_quadratic_equation
  • [ ] Make the description more clear for exercises lists_are_equal and lists_are_not_same_but_equal
  • [ ] Move each exercise description above the expected exercise solution, otherwise you have to scroll a lot after printing the test outputs.
  • [ ] Exercise remove every second element from list does not have a clear description. Should we use 'return' or 'extract' instead of 'remove'?
  • [ ] In the speed comparison between set, list, tuple can we hide the code and only print the result of the comparison?

despadam avatar Nov 27 '24 09:11 despadam

Exercise 1 of dictionaries: "Write a program that receives a dictionary and a key as input and returns the value of the key if it is in the dictionary, None otherwise. The dictionary should remain unchanged."

We should make it clear that the key to return is key, the input variable.

edoardob90 avatar Nov 27 '24 12:11 edoardob90

  • [x] True and False are like 1 and 0 in a set, and there is some wierd behavior if we put 1 and True into a set, one of the examples in sets does this and should probably be taken out.

Snowwpanda avatar Nov 27 '24 19:11 Snowwpanda

Definition of string.strip(). We have

returns a copy of the string with any leading or trailing characters whitespaces removed

Should be

return a copy of the string with the leading and trailing whitespace characters removed. You can pass a string argument, and all the combinations of its values are removed

edoardob90 avatar Nov 28 '24 14:11 edoardob90

  • [ ] Typehint in def solution_a_plus_b_equals_c(a: float, b: float, c: float) -> float: output should be boolean
  • [ ] Lists - Exercise 2: Write a program that takes a list and returns the first and last element of the list as a tuple --> we should reformulate without tuple, since tuples arent explained yet. Check if more exercises have the same mistake.
  • [ ] Strings - Exercise 4: Write a program that receives a list of words as input and returns a string consisting of the words in the list separated by commas. --> Maybe make the desctiption more clear? It was not clear that you need to call join on a string and not a list.

Snowwpanda avatar Nov 12 '25 10:11 Snowwpanda

See #347 (issue related to Nov 2025 tutorial). Just to keep things as tidy as possible, I'm closing this.

edoardob90 avatar Nov 12 '25 21:11 edoardob90