Fruit Machine Python

MachineFruit
  • Machine-Learning-with-Python / fruitdatawithcolors.txt Go to file Go to file T; Go to line L; Copy path Cannot retrieve contributors at this time. 60 lines (60 sloc) 2.31 KB Raw Blame. Fruitlabel fruitname fruitsubtype mass width height colorscore 1 apple grannysmith 192 8.4 7.3 0.55.
  • Video created by University of Michigan for the course 'Applied Machine Learning in Python'. This module introduces basic machine learning concepts, tasks, and workflow using an example classification problem based on the K-nearest neighbors.
Oct-17-2017, 07:17 PM
I need to make a fruit machine in Python. The fruits/items spinning are Cherry, Lemon, Bell, Star and Skull. The Success criteria is •
• If two symbols are rolled the user wins 50p.
• If two skulls are rolled user loses £1, if three skulls are rolled loses all money.
• If you get 3 of the same you get £1, if 3 bells rolled £5.
• Starts with £1, each go costs 20p.


Every time I run the code and I get two of the same items it doesn't add 50p to the credit or add £1 and the credit doesn't properly show for example ... if 1 go costs 20p and I start off with £1 that's 80p. But when I win 50p the new credit should be £1.30 which is not the case. I need help fixing and improving my code.
Oct-17-2017, 07:44 PM
Line 37 should use 'and' instead of 'or'. Think about it: for that to be False, start would have to be 'quit' and 'roll' at the same time, which is impossible (for a string). It's continuing every time through the loop, and never checking the results.
You should also move the if block starting at line 42 and ending at line 44. As it is now, if you have enough money for one last spin, it will just take that money but it won't spin.
Craig 'Ichabod' O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Oct-17-2017, 07:56 PM
Quote:

Each time you roll, you reset the credit to 1. If you want that to persist, set it before you start looping.

Fruit Machine Python Game


Fruit Machine Python

Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

Users browsing this thread: 1 Guest(s)
Python

Fruit Machine Python Tutorial