programming-22's Issues
Part 3
Hi all,
I am submitting the exercises from part three, where I have to build functions, and although my functions are right it seems lke the source file does not exist for any of the functions.
I execute the functions within the required block of if name == "main".
Regards
Typo 8.2
"For instamce, in the example above we imported the Fraction class from the module fractions"
instance*
"Passing an object as an argument to a function should be familiar to you by now, as we have done so many times on this course so far."
in* this course
Typo in Part 4 "Grade statistics" exercise
it reads:
The program kees asking for input until the user types in an empty line. You may assume all lines contain valid input, which means that there are two integers on each line, or the line is empty.
ERROR: Fix the code: Countdown - Part 3 - Python Programming MOOC 2022
I am getting the proper output and the exercise is still failing. This is the code that I input:
# Fix the program print("Are you ready?") number = int(input("Please type in a number: ")) while number > 0: print(number) number -= 1 print("Now!")
The validation engine tells me this:
"FAIL: PythonEditorTest: test_0
Make sure that execution of your program stops with the input 2"
Spelling mistake at Part 6, section - 4 (scope of variables)
There is a spelling mistake at Part 6, section - 4 (scope of variables), under the heading of "Global Variables", there is a spelling error "attemts" which should be "attempts" , approximately at line number 13 from the heading "Global Variables". A screenshot of the error is attached below for easy identification of the error line. Thank you very much for the great course!
Typo in Part 8 Section 2
On this page, the following text is shown (incorrectly spelled word in bold) :
Object oriented programmind refers to a programming paradigm where the functionality of the program is tied into the use of classes and objects created based on them.
Programming exercise: Star-studded Part 5
When I run the following code, it is detected as infinite loop
string = (input('Please type in a string'))
for character in string:
print(character)
print("*")
TESTS FAILED
FAIL:
Timeout test
Tests timed out.
Make sure you don't have an infinite loop in your code.
Part 12.4 Regular expressions
A typo:
- In the Repeated matches part, the search expression in the provided example box is mentioned
*1[234]5
, but considering the results the correct expressions seems to be1[234]*5
Exercise Regular expressions, Part 2
- The letter y is treated as a vowel in the presented example, which is the case in Finnish, but presuming that English is meant, it is an error.
Part 9:Objects and references
Your comment
"As stated in the comments in the examples above, if the parameter in a method definition is of the same type as the class itself, the type hint must be enclosed in quotation marks. Leaving the quotation marks out causes an error, which you will see if you try the following:"
does not create an error.
Strange variable showing up in exercise "Story"
The name Jeremy and the year 1340 keep showing in my output which doesn't match the expected output, but it only shows up when I test and not when I run the program.
Not sure where it's coming from as I'm only inputting "Mary" and "1572".
https://tmc.mooc.fi/paste/LQN36OJd3ZYBkvC6jlCQ4g
Please type in a name: Mary
Please type in a year: 1572
Mary is a valiant knight, born in the year 1572. One morning Mary woke up to an
awful racket: a dragon was approaching the village. Only Mary could save the
village's residents.
FAIL: PythonEditorTest: test_print_1
Output differs from the example with input
Jeremy
1340
Output was:
Jeremy is a valiant knight, born in the year 1340. One morning Mary woke up to an awful racket: a dragon was approaching the village. Only Jeremy could save the village's residents.
Expected output was:
Jeremy is a valiant knight, born in the year 1340. One morning Jeremy woke up to an awful racket: a dragon was approaching the village. Only Jeremy could save the village's residents.
A spruce
Whole print out of the function was:
a spruce!
*
the correct spruce:
a spruce!
*
I don't see the difference. Why is my output considered wrong?
Programming exercise: Find all the substrings
inp = input("Please type in a word")
substring = input("Please type in a character")
while len(inp)>3:
index = inp.find(substring)
if len(inp)-index>=3:
print(inp[index:index+3])
inp = inp[index+1:len(inp)]
This is not a infinite loop but when I push the Test button, it refuses to submit the file with the message "Make sure you don't have an infinite loop in your code."
translation issue in code snippet part5/ex3
using chrome, with default eng lang I see:
sanakirja = {}
expected:
my_dictionary = {}
https://programming-22.mooc.fi/part-5/3-dictionary#traversing-a-dictionary
Part 1 all exercises
Can't submit exercise "What to wear tomorrow" in Part 1
When I try to submit the assignment the following errors pops up:
FAIL: WhatToWearTomorrowTest: test_10
File src.what_to_wear_tomorrow does not exist!
Wrong test, Part 1, Section 5, Programming Exsercise 6
Hello!
I wrote the following program!
fahrenheit = int(input("Please type in a temperature (F): "))
celsius = (fahrenheit - 32)*(5/9)
if celsius >= 0:
print(f"{fahrenheit} degrees Fahrenheit equals {celsius} degrees Celsius")
if celsius < 0:
print(f"{fahrenheit} degrees Fahrenheit equals {celsius} degrees Celsius")
print("Brr! it's cold in here!")
And it works perfectly fine for positive and negative numbers including zero!
So what's the problem with the test button? Because when i press it, it gives me this:
Your program did not print out message 'Brr! It's cold in here!' in a case where the temperature is below zero. Make sure that this print out happens with input -34
Which is clearly wrong cause when i put an input : -34
my code runs well as it's shown below:
Please type in a temperature (F): -34
-34 degrees Fahrenheit equals -36.66666666666667 degrees Celsius
Brr! it's cold in here!
Please fix it! Thank you!
A typo in Part 6 in the example of exercise 09 - city bikes.
In Part 6, exercise 9, City Bikes, the example output for "Part 1:Distance between stations" contains a typo of the variable name. The previous code includes a line "d = distance(stations, "Designmuseo", "Hietalahdentori")", but the sample output has the text "print(e)"
which is different a variable name. The full example is below:
stations = get_station_data('stations1.csv')
d = distance(stations, "Designmuseo", "Hietalahdentori")
print(e)
d = distance(stations, "Viiskulma", "Kaivopuisto")
print(e)
Part 4 - space for pasting my code
Grammatical Error - Part 1, Section 2, Programming exercise: Story
The text reads "Mary is valiant knight". It should read "Mary is a valiant knight".
part05-17_phone_bookV1
Phonebook v1 checks for phonebookv2Test and causes error.
Translation issue Part 2 Programming exercise: Nephews
"Anna nimesi:" is written in Finnish instead of "Please type in your name:"
Wrong Test, Part 1, Section 5, Programming Exercise 5
Hello!
I wrote the code below:
number1 = int(input("Number 1: "))
number2 = int(input("Number 2: "))
operation = str(input("Operation: "))
if operation == "add":
print(f"{number1} + {number2} = {number1 + number2}")
if operation == "multiply":
print(f"{number1} * {number2} = {number1 * number2}")
if operation == "subtruct":
print(f"{number1} - {number2} = {number1 - number2}")
When i run the programm above with the inputs : 2,1, subtruct. It gives me this :
Number 1: 2
Number 2: 1
Operation: subtruct
2 - 1 = 1
And the answer i get when i play the button Test is this:
FAIL: PythonEditorTest: test_subtract1
Your program does not print out anything with inputs 2, 1, subtract
Please fix it! Thank you!
Part 3 Programming exercise: The sum of consecutive numbers, version 2
FAIL: PythonEditorTest: test_1
Your program should print out
The consecutive sum: 1 + 2 = 3
with the input 3. Your program printed out
1 + 2 = 3
l = int(input("Limit: "))
n = 1
i = 1
t = "1"
while n < l:
i += 1
n = n + i
t += f" + {i}"
t = f"{t} = {n}"
print(t)
Error in the automated tests for part 9/2-objects-as-attributes, part 3
The instructions say if the list is empty, the remove_shortest() should return None. But the automated tests do not take that into consideration, the test is trying to access an attribute called name on None which clearly does not exist. Your team has to add a logic for that one as well in the test_shortest_in_room.py file
wrong name for function in part 12 description of exercise 13 part 3
The description in third part of exercise 13 in part 12 asks to add a function "average_grade" but when doing the testing and submission it is requiring the function to be named "average". Either change the tests to use "average_grade" or change description to name the function "average".
.find method
You touch on the .find method, but don't go into the extra parameters available (start and stop positions). Covering that would really help with the last exercise on the page.
Part 10-12, test_7_stats_3
input ["1", "Programming", "3", "5", "1", "Programming", "5", "5", "3", "1", "Algorithms", "5", "10", "3", "1", "Statistics", "1", "5", "3", "0"]
shouldn't generate a mean grade of 3.7, as the grade 3 for course "Programming" was already replaced by grade 5.
Calculation:
(5*5 + 5*10 + 1*5)/(5+10+5) = 4.0
Typo in quiz at the end of part 7
In the quiz at the end of part 7 section 6, there are three checkboxes that have text next to them in Finnish even though the rest of the text is in English. The three checkboxes say the following:
Haluaisin jatkaa ohjelmoinnin jatkokurssille tämä kurssin jälkeen
Aion jatkaa ohjelmointia kurssin ulkopuolella
Aion osallistua kurssikokeeseen
Part 5 Sudoku: check grid exercise: Test example wrong?
Hi, I found something odd in the part 5 Sudoku: check grid exercise. The execise description is below:
Please write a function named sudoku_grid_correct(sudoku: list), which takes a two-dimensional array representing a sudoku grid as its argument. The function should use the functions from the three previous exercises to determine whether the complete sudoku grid is filled in correctly. Copy the functions from the exercises above into your Python code file for this exercise.
The function should check each of the nine rows, columns and 3 by 3 blocks in the grid. If all contain each of the numbers 1 to 9 at most once, the function returns True. If a single one is filled in incorrectly, the function returns False.
My solution code is below. But when it is executed, the TMC showed an error that
SudokuTest: test_3_functinality_with_invalids
True != False : The result True is incorrect when calling
sudoku = [
[ 6, 4, 9, 2, 8, 3, 1, 5, 7 ],
[ 0, 5, 0, 6, 4, 9, 2, 3, 8 ],
[ 2, 3, 8, 1, 5, 7, 6, 4, 9 ],
[ 9, 2, 3, 8, 1, 5, 0, 6, 4 ],
[ 7, 6, 4, 9, 2, 3, 8, 1, 5 ],
[ 8, 1, 5, 7, 0, 4, 9, 2, 0 ],
[ 5, 7, 6, 4, 9, 2, 3, 2, 1 ],
[ 4, 0, 2, 3, 8, 1, 5, 0, 6 ],
[ 3, 0, 1, 5, 0, 6, 4, 9, 0 ],
]
sudoku_grid_correct(sudoku)
I checked this error message and I can not found any repeated 1- 9 number in single grid, which means it should be True but the exercise said it should return False. I am wondering if I have understand the instruction wrong or this exercise may contain a bug.
def block_correct(sudoku: list, row_no: int, column_no: int):
numbers = []
for r in range(row_no, row_no+3):
for s in range(column_no, column_no+3):
number = sudoku[r][s]
if number > 0 and number in numbers:
return False
numbers.append(number)
return True
def sudoku_grid_correct(sudoku: list):
for x in range(0, len(sudoku[0]), 3):
for z in range(0, len(sudoku[0]), 3):
return block_correct(sudoku=sudoku, row_no=x, column_no=z)
Multiple typos in Part 8.1
"If you haven't use Visual Studio Code before, you will find the installation instructions..."
'use' should be 'used'
"In programming, the term has the specific meaning of an independent whole whi, in this case containing some bits of data..."
'whi' - not sure what that should be.
"The way to distuinguish methods from other functions is the way..."
distinguish*
Exercise part04-13_add_items_to_list: mistake in sample output
According to the expected behaviour of the program the user is asked the following:
How many items: 3
Item 1: 10
Item 2: 250
Item 3: 34
[10, 250, 34]
So I created a code (which passed the test), but leads to the following output:
How many items: 4
Item: 1
Item: 2
Item: 3
Item: 4
[1, 2, 3, 4]
As you can see, the user is asked several times for "Item: " and not for "Item 1: ", "Item 2: ", etc.
This is my code:
list = []
number = int(input("How many items: "))
while number > 0:
item = int(input("Item: "))
list.append(item)
number -= 1
print(list)
Part 6 - Exercise "Filtering the contents of a file" accepts any submission
The unit tests are broken for this particular exercise. As long as the function is defined, anything seems to go through. For instance, the following code passes the tests:
def filter_solutions():
print("hi!")
I can't see the earned pints when completing the exercises.
I can't see the earned pints when completing the exercises.
Typo in part 7 exercise 2
In the sample output of Exercise 2 in Part 7, the following strings are shown:
OlHeyaremltswrking
!!!,?
é üäü ö
The third string has two whitespace characters between the characters "é" and "ü". However, when looking at the input string given or at the output of the passed exercise, there are three whitespace characters between the characters "é" and "ü".
Typo in Part - 7, Section -1 (Modules)
There was a typo in Part -7, Section - 1 (Modules), under the heading of "Debugging revisited", 3rd paragraph, line number 3 contains a typo "hwen". Also, under the heading of "Using modules", 1st paragraph, line number 5 contains a typo "powere". Screenshots are also attached below in order to identify the typos easily. Thank you for the great course!
Warning answer included Part 3 - working with strings - program exercise find the 1st substring - fails to catch error
Following code should fails if last 3 characters are the sub-string ex. string: fred
character: r
word = input('Please type in a word: ')
char = input('Please type in a character: ')
position = word.find(char)
if position != -1 and position + 3 < len(word): # should be position + 2
print(word[position: position + 3])
Bad wording in Part 4 in the description of exercise 30
In Part 4 exercise 30, the request text seems wrong. The text says "...The function prints out whichever of the strings is the shortest. If more than one are equally short, the function can print out any of the shortest strings".
The function (as per the test requirements) shouldn't print out anything, but return the values, so I think it should read "...The function returns whichever of" and "...the function can return any of the ..."
8.2 Shopping list - test code error
"You can use the following code to test your function:
if name == "main":
my_list = ShoppingList()
my_list.add_item("bananas", 10)
my_list.add_item("apples", 5)
my_list.add_item("pineapple", 1)
print(total_units(my_list))"
The above results in error:
AttributeError: 'ShoppingList' object has no attribute 'add_item'
When submitting via the server test, the method tested is add(), as I assume the test function above should have been - add() rather than add_item()
Code error in Part 9 Section 5
In Part 9 Section 5 "Class Attributes, there's a block of code that includes a getter method named "phone_number":
# the getter method for phone_number combines the country code
# and the attribute phone_number
@property
def phone_number(self):
# the initial zero is removed as the country code is prefixed
return PhoneNumber.country_codes[self.__country] + " " + self.__phone_number[1:]
However, if a United States phone number is passed to this method, it removes the first digit of the phone number.
For example, the following code:
pn = PhoneNumber("Peter Pythons", "800 555 5555", "United States")
print(pn)
print(pn.phone_number)
print(pn.local_number)
prints out this result:
+1 00 555 5555 (Peter Pythons)
+1 00 555 5555
800 555 5555
when the proper result should be:
+1 800 555 5555 (Peter Pythons)
+1 800 555 5555
800 555 5555
The code should include a check for the country of the number being passed to it. If self.country = "United States", it should return
return PhoneNumber.country_codes[self.__country] + " " + self.__phone_number
instead of removing the first digit of the area code of the phone number.
I hope this explanation makes sense.
Part 4 execise A square
In the downloaded code. Function name did no translate.
def nelio(size, character): # should be square
FAIL: CountdownTest: test_prints_in_loop
I get an error when running my submission on the exercise "Fix the code: Countdown". The error is the following FAIL: CountdownTest: test_prints_in_loop
Typo in quiz at end of Part 7
In the quiz at the end of part 7, the last question is in Finnish even though the others are in English.
The last question is:
Anna yleisarvosana tämän viikon materiaalille ja tehtäville
while on other parts, the last question is:
Which grade would you award this weeks material and exercises?
Under feedback for at least part 2 and 3
How many hours did you use to complete the execises this week? should be exercises
Also the amount of time goes 1-2 hrs 3-5 hrs. You appear to be missing 2-3 hrs
For some reason feedback is under the heading of quiz which seems a little confusing to me.
Issue with test 10 in part 1
When running the test the following error message appears:
With input:
10, no
program is expected to print out following row
Wear jeans and a T-shirt
your program's print out is
What is the weather forecast for tomorrow?
Wear jeans and a T-Shirt
I recommend a jumper as well
Take a jacket with you
Also with any other temperature entered the expected output of the code is supposed to be "Wear jeans and a T-Shirt" and nothing else. This seems to be wrong to me or am I missing something?
Hello, my vscode is not updating in the TMC submission
I have a code that works ok in the terminal and on python tutor, but when I submit to TMC, it says fail. Upon checking, the TMC code remains to be the unupdated initial code that I input from yesterday. Even with constant saving and auto-save toggle on, the TMC code is not updating.
Redundant "else" clause-Part 10-Iterator
This is not really a mistake, but imo it would be better to remove this redundant "else" clause. The original code is like this:
def __next__(self):
if self.n < len(self._books):
# Select the current item from the list within the object
book = self._books[self.n]
# increase the counter (i.e. iteration variable) by one
self.n += 1
# return the current item
return book
else:
# All books have been traversed
raise StopIteration
It could be improved to this:
def __next__(self):
if self.n < len(self._books):
# Select the current item from the list within the object
book = self._books[self.n]
# increase the counter (i.e. iteration variable) by one
self.n += 1
# return the current item
return book
# All books have been traversed
raise StopIteration
or better:
def __next__(self):
if self.n >= len(self._books):
# All books have been traversed
raise StopIteration
# Select the current item from the list within the object
book = self._books[self.n]
# increase the counter (i.e. iteration variable) by one
self.n += 1
# return the current item
return book
Sometimes when logging in Mooc course shows wrong progression
Sometimes when I log in the course withdraws me back to part1 even tho I have progressed my further. I use same account always but switch between computers.
8.3 words
header:
"Using objecs formed from your own classes"
objects*
Comments in exercise "books of a genre" in vscode are not translated to English. Not that it matters much :)
Programming exercise: Working with numbers - Part 2
The question says:
Part 4: Positives and negatives
The program should also print out statistics on how many of the numbers were positive and how many were negative. The zero at the end should not be included in the calculation.
Sample output
... the program asks for numbers
Numbers typed in 4
The sum of the numbers is 34
The mean of the numbers is 8.5
Positive numbers 3
Negative numbers 1
My program:
Write your solution here
a = 0
b = 0
c=0
d = 0
print('Please type in integer numbers. Type in 0 to finish.')
while True:
n = int(input('Number'))
if n!=0:
a=a+1
b = b+n
if n>0:
c = c+1
else: d = d+1
else:
print('Numbers typed in', a)
print('The sum of the numbers is', b)
print('The mean of the numbers is', b/a)
print('Positive numbers', c)
print('Negative numbers', d )
break
Upon submitting, I receive the following comment:
FAIL: PythonEditorTest: test_5_posneg
With the input
1
2
3
0
your program should print out
Negative numbers 0
your program printed out
Please type in integer numbers. Type in 0 to finish.
Numbers typed in 3
The sum of the numbers is 6
The mean of the numbers is 2.0
Positive numbers 3
Negetive numbers 0
This doesn't makes sense. The program output is exactly as the sample output
Incorrect test - Part 11 - Ex. OrderBook
Hello!
I wrote a program that passed all tests except for this one:
OrderBookPart3Test: test_1_mark_finished
When executing the following code
t = OrderBook()
t.add_order("program web store", "Andy", 10)
t.mark_finished(1)
t.all_orders()
method should return a list containing following tasks
program web store (Andy hours), programmer 10 FINISHED
now return was
1: program web store (10 hours), programmer Andy FINISHED
and the similar one more:
OrderBookPart3Test: test_4_finished
When executing the following code
t = OrderBook()
t.add_order("program web store", "Andy", 10)
t.mark_finished(1)
t.finished_orders()
method should return a list containing following tasks
program web store (Andy hours), programmer 10 FINISHED
now return was
1: program web store (10 hours), programmer Andy FINISHED
But the answer that is printed above is even grammatically incorrect: "Andy hours" (?), "programmer 10" (?).
Please take a look at these tests, I think there are some mistakes.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.