##### Making a percentile dice roller and dice roller
 Making a percentile dice roller and dice roller Fixer243 Unladen Swallow Posts: 1 Threads: 1 Joined: Sep 2018 Reputation: Sep-30-2018, 04:34 AM (This post was last modified: Sep-30-2018, 06:12 AM by Larz60+.) So I believe i have the general concept of of what i am doing for this but I may not. I havn't programmed in a long 3 years. So I am pretty rusty! Before you look at the code my idea is to have the percentile dice there so I created the bounderies of the amount that it can go with the min and the max. After I created the roll for the print so when the roll is less well you will get it from there. What i'm more or less confused on is I how to get the host to have person who starts the command, and the user being the one who bet as well as the amount the user is betting. Hell I could be way off and have no idea too. What i currently have is pretty basic. ```import random min = 1 max = 100 B55x2 = '!55x2 {User} {Ammount}' while B55x2 == '!55x2 {User} {Ammount}' print( {User} ' bet on 55x2 vs ' {Host} ' for a bet of ' {Amount} roll = random.randint(min, max) if roll > 54: print ( {Host} ' rolled ' {roll} ' with percentile dice') print ( {User} ' has Won their bet!') if roll < 55: print( {Host} ' rolled ' {roll} ' with percentile dice') print( {Host} ' has Lost their bet!')``` Reply ichabod801 Bunny Rabbit Posts: 4,231 Threads: 97 Joined: Sep 2016 Reputation: Sep-30-2018, 11:24 AM You are missing a close parentheses at the end of line 7. You appear to be using f-string syntax, but inconsistently and incorrectly. `'!55x2 {User} {Ammount}'` is the most correct you have, but you need an 'f' before the string (and User and Ammount need to be defined). I don't know why your while loop is indented, and it will never end (you never change B55x2 within the loop). I don't know why your if statements are indented. Craig "Ichabod" O'Brien - xenomind.com I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures Reply gruntfutuk Spam, spam, eggs, and spam Posts: 229 Threads: 2 Joined: Sep 2017 Reputation: Sep-30-2018, 12:18 PM (This post was last modified: Sep-30-2018, 12:18 PM by gruntfutuk.) I'm not clear where you are going with this, especially the B55x2 line, so I've take the liberty of rewriting and extending what you've shared somewhat in the hope it will give you some ideas on how to achieve your intended objective. In your original code, there is no means of entering/varying the amount, so I've chosen to make this a random amount, and I've also given the user an opening balance that the amount comes off of. If they win, they get their stake back, otherwise they lose their stake. (Incidentally, you'd varied the spelling of the amount variable.) When the user runs out of money or either the host or the user gets a certain number of wins, the game ends. Your current code has an infinite loop in it. I've shown how to use f-strings properly. (There could be calculations or functions calls inside of the {} if you wanted.) The convention in Python followed by the majority of programmers is to use all lowercase in variable names, so I changed your variable names accordingly. ```from random import randint min = 1 max = 100 user = 'User' host = 'Host' amount = 10 user_balance = 1000 max_wins = 100 user_wins = 0 # introduced so the while loop does not run forever host_wins = 0 B55x2 = f'!55x2 {User} {Amount}' # no idea what this is for as it is never changed while user_wins < max_wins and host_wins < max_wins and user_balance > 0: amount = randint(1, user_balance) print(f'{user} bet on 55x2 vs {host} for a bet of {amount}') roll = randint(min, max) print (f'{host} rolled {roll} with percentile dice') if roll > 54: print(f'{user} has Won their bet!') user_wins += 1 user_balance += amount else: print(f'{host} has Lost their bet!') host_wins += 1 user_balance -= amount print(f'Host wins: {host_wins}, User wins: {user_wins} and balance: {user_balance}')``` I am trying to help you, really, even if it doesn't always seem that way Reply

 Possibly Related Threads… Thread Author Replies Views Last Post Dice Roll (Find out how many rolls until specified streak) DustinKlent 4 1,116 Jun-13-2021, 09:44 AM Last Post: Gribouillis Help with dice roll program kraco 4 954 Sep-22-2020, 02:06 PM Last Post: kraco Help with rerolling the dice blacklight 3 989 Jul-01-2020, 05:35 PM Last Post: blacklight game of the goose - dice problem koop 4 1,680 Apr-11-2020, 02:48 PM Last Post: ibreeden simple dice roll Byzas 1 1,335 Mar-21-2019, 02:29 AM Last Post: ichabod801 roll of the dice kyle007 0 981 Mar-11-2019, 01:58 AM Last Post: kyle007 Dice game Mazzo76 1 988 Feb-26-2019, 11:55 AM Last Post: Larz60+ Issue with my 'roll the dice simulation'-exercise (cannot break out of the loop) Placebo 2 2,144 Sep-30-2018, 01:19 PM Last Post: Placebo Dice Throwing Game in Python (I have a problem) yuseinali 1 2,181 Jun-22-2017, 10:22 PM Last Post: metulburr Poker Dice while loop gullidog 2 3,456 May-28-2017, 08:07 PM Last Post: gullidog

Forum Jump:

### User Panel Messages

##### Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020