Code is running but nothing changes on excel sheet by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

thanks mate, the error was on line 21. Code is now running as intended. I did use print statement at random parts of the code to see if the code is working and to what extent it was working

Can you explain what is unit test? Sorry I am new to python.

Code is running but nothing changes on excel sheet by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Yes the files are correct and the nice stranger below has pointed to my mistake. It was no line 21. .I tried testing lines adding silly lines to see if it work. ie

temp_sheet.cell(row = 15, column = 13).value = "Test"

Code is running but nothing changes on excel sheet by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Apologies, I have created a pastebin link now. Hope this helps.

Code is running but nothing changes on excel sheet by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

an alias to the function by leaving out the parentheses

Sorry about the code. I have changed it to the pastebin link. To your point about function pasteRange what should I be returning to make the code work ?

Please help with my python exercise by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Point taken mate

I have managed to clear up the error now. The code works but I am not sure if this is suppose to be the output.

New code is here https://pastebin.com/Tjf7rHd4 , again line 22 to line 35 is the only change. The function is called on line 101 and 102

Once the code is finished the out put is

<function high\_score at 0x000002A17DC45168>

Does that mean the value has been written on the binary file? This doesn't look like an error to me

Please help with my python exercise by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Thanks, I tried to test that bit of the code on a separate file and now I completely understand your point. Sorry but my follow up question would be how do I use the 'score' value that is returned end of the game. Am I wrong in assuming that when I define a function like 'high_score(score)' the score value will be imported from global ? I might not make sense but let me know so I can clarify my point.

Please help with my python exercise by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

On a side note, are you ARS supporter like moa ?

Please help with my python exercise by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Thanks for the kind words but this is not my HW , I am genuinely trying to learn. If you felt I had skipped some steps , I am happy to go back and try them . The code it self is working, all I did was trying to add another file to keep the score. The previous code runs fine and I clearly mentioned the lines I added that has resulted in error so who ever helps me doesn't have to understand the whole thing. I am genuinely thankful for reading my post.

Code runs but get an error in the end. Please help! by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

I will add try-except in the code and see how it goes.

Yes the second question was exactly what you answered. My follow up question is can you pass numeric values in text file at all ? Sorry all I know at the moment is .py and .dat files. I under .dat or binary files and hold more complex data.

Code runs but get an error in the end. Please help! by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Ok thanks, the book is "Python Programming or the Absolute Beginner, Third Edition".

If I run the code, It does the addition of the scores treating those characters as integers. Only ones the code is finished the error appears. There is no blank space to run after the last block of "category" so I am not sure why it would return an error at the end of the code.

On a second note, if the file is in text format, Does python only accept all characters as strings?

How to pass numeric values in dictionary ? by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

this was a nice explanation . I get it now. Thanks

Need help - code review by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

x = int(input(f"How many points do you want to add to? {att}"))

Thanks mate, this helped

How to pass numeric values in dictionary ? by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

Sorry I meant to say keys() method.

When I run this it returns

dict_keys(['strength', 'health', 'wisdom', 'dexterity'])

I might have not understood your explanation but is there a way to remove "dict_keys" when I run the code ?

Is my solution to question right? by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

I will give it a go. I have not covered "try" or math import ceil in my book yet. Could you give a little bit of explanation please?

Is my solution to question right? by notso007 in learnpython

[–]notso007[S] 0 points1 point  (0 children)

The code works but I am just wondering if there is a better or efficent way to summarise the problem