Python Forum
20 Years of records (Sports) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: Code sharing (https://python-forum.io/forum-5.html)
+--- Thread: 20 Years of records (Sports) (/thread-2097.html)



20 Years of records (Sports) - Sani96 - Feb-18-2017

Hey guys,
First of all, I'm Federico, I'm from Turin,Italy and I'm 20 y.o.
I started with Python just two weeks ago, so please don't kill me for my mistakes  Undecided Undecided
This is a little program, now it's just about football, but if you like the idea I can add more sports (such as tennis and basketball), more competitions and more stats...
I'd like to receive your thoughts on it and new ideas to improve it  Smile

I posted here because I wasn't able to link it. If that's not right I will change the post how you want: https://github.com/Sani96/20-years-of-records-/blob/master/20ysdatabase.py


RE: 20 Years of records (Sports) - Axel_Erfurt - Feb-18-2017

#Football
class Football:
   ligue_name: ""
   ligue_year: ""
   ligue_winner: ""
   ligue_top_scorers: ""
is this Python Code ?

it works when I change it to:


#Football
class Football:
    ligue_name = ""
    ligue_year = ""
    ligue_winner = ""
    ligue_top_scorers = ""
Then you always have to enter everything with single quotes, that's not a good idea.

football - That should be enough, not 'football'


RE: 20 Years of records (Sports) - Sani96 - Feb-18-2017

Yes Axel, sorry for the equal sign, I didn't see it
About the single quotes, I don't understand what you mean...


RE: 20 Years of records (Sports) - Axel_Erfurt - Feb-18-2017

the question is


Quote:Type here the sport you want to look for. E.g. 'football' or 'tennis'...


I type

football


Quote:The sport you're looking for is not available now. Try again!

I must type

'football'

and so on with each new question


RE: 20 Years of records (Sports) - Sani96 - Feb-18-2017

When I wrote 'football', I meant that you can type football without single quotes...
I could be wrong, but if I try it with single quotes it doesn't work, while if I write the word without them, it works normally...


RE: 20 Years of records (Sports) - Axel_Erfurt - Feb-18-2017

in Python 3 it works, in Python 2 you must use single quotes

You should tell the user to use Python 3.


RE: 20 Years of records (Sports) - nilamo - Feb-18-2017

(Feb-18-2017, 07:53 PM)Sani96 Wrote: When I wrote 'football', I meant that you can type football without single quotes...
I could be wrong, but if I try it with single quotes it doesn't work, while if I write the word without them, it works normally...

That shouldn't matter.

*checks your source*
If you're using python2, definitely do not use the input() function.  Use raw_input() instead.  Then you don't need to type quotes around whatever you're entering.


RE: 20 Years of records (Sports) - wavic - Feb-18-2017

All that data... You can serialise it as JSON and store it on the hard drive. That way you can keep the program simple and small.