![]() ![]() Would you would like to guess again enter 1 or enter 2 to exit? I have the exact same experience: Guess heads by entering 1 or tails by entering 2 for this coin flip. You can add this directly to the existing program you’ve already written! As an additional challenge see if you can build the program such that the the user can choose between the two guessing games at startup, and possibly even switch after each cycle.įor me the code does not work, I copy paste yours and it won’t accept the input correctly.User Story: As a user I want to be able to guess the outcome of a 6-sided dice roll (1-6), with the same feature set as the coin flip (see above). Let’s see if we can expand upon this challenge - what if instead of 2 options, there were 6? User Story: As a user I want to be able to quit the game or go again after each cycle.User Story: As a user I want to clearly see the updated guess history (correct count/total count).User Story: As a user I want to clearly see whether or not I guessed correctly.User Story: As a user I want to clearly see the result of the coin flip.User Story: As a user I want to be able to guess the outcome of a random coin flip(heads/tails).If(g = 2): #printing heads if user chose heads Print("Would you would like to guess again enter 1 or enter 2 to exit?") Print("You have guessed " + str(num) + " times.") If(answer = flip): #prompts user whether their guess was right or wrong If(flip = 1): #determines the outcome when flip is equal to 1 or something else and prints heads or tails If(answer = 1): #printing heads if user chose headsĮlse: #printing tails if user chose tailsįlip = random.choice() #flips the coin Print("Guess heads by entering 1 or tails by entering 2 for this coin flip.") #asking first questionĪnswer = input() #waiting for users response If the screenshot does not work here is my code: import random I know my code is not as flexible as I can be and I know everyone thinks differently so could you please give me some feedback on how I did and if my code is good enough while considering what I was required to do? However, the next day I tried to integrate more use of def function(): and I was successful until I got down to the Intermediate Challenge my brain again wanted to get rid of def function(): so, I did and I have attached my code to this prompt. As I was doing this project my brain did not want to use any functions (such as def function():). I also have a solution for the advanced requirements in my head but I didn’t write them down. I had to complete the basic requirements however I went up to additional requirements as-well. I did however have to sometimes search up how to use a certain prompt (such as random.choice) other than that I planned everything I needed to do in my head. ![]() During this project we were also provided hints on what functions to use but I did not look at any of the hints. I have completed my first small project using python3. ![]()
0 Comments
Leave a Reply. |