TheHockeyist / 99-bottles

An attempt to code the famous song.
MIT License
0 stars 0 forks source link

Initial idea and variants. #1

Open TheHockeyist opened 7 years ago

TheHockeyist commented 7 years ago

I've heard a lot of variants of the song. Some people start with 100 or some start with 99.

The beverage varies depending on the version. I learned it as milk (e.g. I sing "99 bottles of milk on the wall"...) but traditionally, it's an alcoholic beverage that many people would rather not have their children singing about. So I decided to include an option for choosing your beverage of choice.

The third line also varies, from "Take one down, pass it around" to "If one of those bottles should happen to fall".

And lastly, what happens when we reach zero?

0 bottles of milk on the wall, 0 bottles of milk. Go to the store and buy some more, 99 bottles of milk on the wall!

That's how I learned it.

TheHockeyist commented 7 years ago

Does the code work? I think it works, but I'm not printing everything to make sure.

benajaero commented 7 years ago
Traceback (most recent call last):
  File "python", line 4
    set bottles = 99
              ^
SyntaxError: invalid syntax

In both python 2.7 and python 3.

BTW: Nice to see you again

TheHockeyist commented 7 years ago

Workarounded it.

EDIT: Okay, I think I probably fixed it.

benajaero commented 7 years ago

You need to commit for me to view it. Also it seems like the repeat code is broken. I'm not a python expert though

TheHockeyist commented 7 years ago

Ah, okay.

Any other people want to help me out here?

benajaero commented 7 years ago

@theinitializer codes in python

TheHockeyist commented 7 years ago

Ah, okay. Not sure if he knows that we exist here, but I could use a bit of help.

benajaero commented 7 years ago

I mentioned him

TheHockeyist commented 7 years ago

Okay.

benajaero commented 7 years ago

Question: Why did you leave scratch again?

TheHockeyist commented 7 years ago

Project got remixed, disputed it with the creator, creator refused to delete it, took it to the ST.

Then while talking, there was a dispute with the ST. Nothing I could do.

Infuriated, I reassessed why I came to Scratch and if the community was the same as it was when I joined. It became more immature, I concluded Scratch was insufficient for my needs, and I left.

benajaero commented 7 years ago

ok

TheInitializer commented 7 years ago

Hello, what is this? I got mentioned.

Is there anything you need help with?

TheHockeyist commented 7 years ago

Yeah, I need some help with coding this. I'm not sure if my code works or not.

EDIT: Typo.

matthewr6 commented 7 years ago
  1. set has nothing to do with setting variables in Python
  2. == is for comparison, and = is for setting variables.
  3. repeat X is not valid in Python - you want to do for i in range(X)
  4. print requires commas between things (or you could combine them with the + operator)
  5. Learn Python's syntax first https://docs.python.org/3/
TheInitializer commented 7 years ago

Haha.

Well - not sure how else to say this - it's all wrong. None of that is valid Python (aside from the first two lines, lol).

I'd advise you take a quick Python tutorial and learn how it works before writing any serious code 😛

towerofnix commented 7 years ago

Since people are raiding this thread and talking about how not-Python the code is.. I recommend you learn to use IDLE so you can test your code as you're working on it, and also GitHub Desktop, so you can actually commit your code and make that code appear online (or git, if you're cool and used to the command line).

You'll find it a lot more useful in the long run when you start working on bigger projects.

TheHockeyist commented 7 years ago

I attempted to somewhat Python-ize the code.

I'm coming from Scratch, so some of the syntax is still unfamiliar.

matthewr6 commented 7 years ago

Again, set has nothing to do with variable assignment. You should probably read the syntax docs and frequently refer to them as you write this

TheHockeyist commented 7 years ago

Reattempted.

Yeah, I have no idea what I'm doing. :-/.

TheInitializer commented 7 years ago

It'll probably be more useful to, you know, actually learn Python before making anything with it, as opposed to just trying to guess what to do :P

TheHockeyist commented 7 years ago

Well, it's my first time really coding something independently in Python.

We all have to start somewhere.

matthewr6 commented 7 years ago

And the best place to start is to:

learn Python before making anything with it, as opposed to just trying to guess what to do :P

towerofnix commented 7 years ago

Er, learn the basics of Python before making anything with it. Just enough to open up IDLE and see some real results on your screen – you know, just learn how to use the print statement or function and see the result. Then move on from there. The whole "see it on your screen" part is.. really, really important.. :tada:

edit: is it not more fun to see the results on your screen, as you're programming the code that makes those results? :)

benajaero commented 7 years ago

Good advice. I think you should try to learn Py 3 not 2, though. https://docs.python.org/3/tutorial/

@TheInitializer Are you ignoring me?

TheInitializer commented 7 years ago

@Blaze349 is correct, there's really not much of a reason to stick with Python 2 anymore. Python 3 is the way to go at this point.

@Blaze349 wdym

matthewr6 commented 7 years ago

@TheInitializer legacy (or "legacy") code that's a pain to port

TheInitializer commented 7 years ago

I doubt OP will be working with much of that though

benajaero commented 7 years ago

@TheInitializer nvm

@Firedrake969 That isn't much of a reason. Its like saying we should stick to Assembly because its too much hard work to port the legacy code to C.

towerofnix commented 7 years ago

@Blaze349 I'm going with the assumption that legacy code really does exist for Python 2, though. Nobody uses code made in Assembly, but a lot of people used Python 2 code which makes Py2 kinda just stick around. (..this is just an assumption, please correct me, somebody who knows better..)

benajaero commented 7 years ago

@liam4 People used to use assembly for everything. People should move to Py 3. I don't see the benefits of going with Py 2.

matthewr6 commented 7 years ago

@liam4 Your assumption is correct - I have experience with one. (also @Blaze349 for this next part)

Python 3 is the way to go for new projects, sure, but plenty of old/existing projects are in Python 2, and it's not like there are huge differences. Also, it can be a pain to port large projects... making sure everything still works the exact same way and stuff, for a few hundred thousand users

benajaero commented 7 years ago

https://docs.python.org/2/library/2to3.html

matthewr6 commented 7 years ago

It's not like that's a magic solution if you're using multiple libraries and have a lot of things that could potentially break

TheHockeyist commented 7 years ago

Wait, so why are we arguing over if my (poorly written) code is Python 2 or 3?

I JUST WANT MY CODE TO WORK, JEEZ!!!

benajaero commented 7 years ago

@TheHockeyist If you want your code to work then follow liam4's instructions. Read the documentation and work through the examples.

TheHockeyist commented 7 years ago

Is there a cheat sheet or something?

benajaero commented 7 years ago

Yes. Its called documentation

towerofnix commented 7 years ago

I don't know of any good, quick-and-easy cheat sheets. You'll probably get the hang of the basics of programming with Python (that is, making programs that run 😛 ) pretty quickly. If you find yourself forgetting a specific piece of code a lot - for example, how to loop a number of times - you could write yourself a cheat sheet!

TheHockeyist commented 7 years ago

Well, the while loop works now. Not sure how to print.

TheHockeyist commented 7 years ago

Okay, I think I fixed the thing.

TheHockeyist commented 7 years ago

IT WORKS!!!!