I'm so impressed how a simple script could be related to a principle of machine learning such as the second one. Some add-ons and the function might be able to check it's performance and improve it. Awesome. Thank you so much for this video.
I was working through this and was pleased when I got it working so I showed my girlfriend my work and the first thing she did was break it by pressing a different key!. I then had to spend time working out how to do some exception handling which takes me a while given im a complete novice to coding. That's twice she has done it now lol. I'm really enjoying your vid's though and they are helping me learn the basics
Hey Kylie how can I add points when we guess. Example: A person is playing a guessing game in which they have 3 guesses to figure out the computer's secret number which will be between 1 and 20 inclusive (use randint to generate the number).If they guess the number correctly on the first guess the program should stop making them guess and they should get 10 points. If they guess the number correctly on the second guess the program should stop making them guess and they should get 5 points If they guess the number correctly on the third guess, they should get 1 point. After an incorrect guess tell the user if their guess was too high or too low. If they fail to get the number correct after 3 guesses they get 0 points. Be sure to tell them what score they got, and show the computer's secret number. Ask the user if they want to continue playing the game. If they choose to play again, start at the beginning. If not, print a farewell message and the user's total score. Can you please help me to explain how to add points and give chances. I will be waiting for your reply. Thank you.
Hi, Thanks for the tutorials as they are very helpful for beginners like me. I wanted to add giving the computer limited guesses. I tried creating a variable called count before the while loop and set it to zero. Then I set the conditions of the while loop to include your conditions in the video plus another "and" statement where count must be less than 4. Then after the if/else statements that you made I put count += 1 so the loop would terminate if it got above four. But I couldn't figure out how to make it print a message like "I didn't guess correctly" because the function would print that same message even if I hit c. I tried indenting, but it didn't work. I don't know if you understand me or not because it hard to explain in a RUclips comment and I'm a total newb. Thanks.
If I understand what youre saying correctly, you want to print out a different statement saying you’ve hit the limit. You would likely have to put in an if statement at the very end outside the loop to see whether the loop terminated as a result of incorrect guesses or because you’ve guessed the correct word
Thanks for the good content! I'm not sure what is the problem but when I add the ".lower" part to the last part of the feedback parameter, the code just reiterates. But when I deleted it it just worked fine.
found the same problem "feedback = input(f"Is {guess} too high (H), too low(L), or correct (C)?? ").lower()" the () at the end are integral or it wont work
I keep getting my output stuck on guess the number between 1 to 10 and like you did at 3:59 and even when the code was completed at 6:22 it does the same thing it doesn't print low or high
check the last line of code. if you are calling the first function then call the second function. according to this video, 1st function is calling on the last line guess(10), to guess the user secret number by the computer you should call the second function is computer_guess(10)
The first part of running the code is not working. Does anyone have any idea and yes I actually copied the code right but it isn't working it's applying the upper bound of 10 on x . Any suggestions?
@@francogarcia8401 try closing the whole application and then open to run again or you know copy the right code that you have written and paste it in another window to run again. Hopefully it will work.
Hellou ,is ther any way that if i accidently put letter as and aswear for question guess the number can i print something like "this is not the numnber"?
Thank you very much sister. you really helped me for my SCHOOL PROJECT! as well as the VIVA coz you just not give simply any programme. You explain it and make it very easy! Thank you ... and a hifi😊
i need help fixing this import random name = input('Enter your name human') age = input('Enter your age' + name) answer = input('Ok ' + name + ' Lets play a game, think of a number and type ok when ready') if answer == 'ok': def computer_guess(x): low = 1 high = x feedback = '' while feedback != 'c': if low != high: guess = random.randint(low, high) else: guess = low feedback = input(f'Is {guess} too high(h), too low(l). or correct (c) ??') if feedback == 'h': high = guess -1 elif feedback =='l': low = guess + 1 print('Yay i guessed your number, {guess), right!')
Hey there, you had a few indentation problems in line 1 and the last line. After that, you also created a function, but then never called it. So you'd need to add the function name on line 21 or after. Your final print also has an issue where you forgot to add an 'f' at the beginning and you didn't close the accolade. Also, your questions are missing spaces. Here's your code with the said fixes. I didn't add anything else to optimize. Just fixed what your wrote. import random name = input('Enter your name human ') age = input('Enter your age ' + name) answer = input('Ok ' + name + ' Lets play a game, think of a number and type ok when ready ') if answer == 'ok': def computer_guess(x): low = 1 high = x feedback = '' while feedback != 'c': if low != high: guess = random.randint(low, high) else: guess = low feedback = input(f'Is {guess} too high(h), too low(l). or correct (c) ??') if feedback == 'h': high = guess -1 elif feedback =='l': low = guess + 1 computer_guess(50) print(f'Yay i guessed your number, {guess}, right!')
Hey Kylie! I know this was a year ago at this point, and maybe that's the issue as is, but my VS code doesn't recognize the 'import random' command. Do you have to take any additional steps for it to recognize the 'random' package? Thank you!
tried this and it didnt work, watched another video online, and think you need to add a int(input()) in the while loop after Print, no? I wasnt prompted to guess again trying your way
Great Job , Kylie!! bdw I tried making a tic tac toe game but i can't get the board to clear out and restart a new game when i tried to define a function for looping back to the game.
Hi do u remember me . My computer broke so i cant code . Please can u tell me apps that i can u on my phone like python .. Btw thanks for being teaching me how to code
I'm not sure if there are any apps that will let you code on your phone. I'm unfamiliar with coding from a cell phone.. You can try searching on google but I would highly recommend fixing the computer :/
I'm so impressed how a simple script could be related to a principle of machine learning such as the second one.
Some add-ons and the function might be able to check it's performance and improve it.
Awesome. Thank you so much for this video.
Thank you for helping me do my CS HW better than my Professor explains stuff...
I was working through this and was pleased when I got it working so I showed my girlfriend my work and the first thing she did was break it by pressing a different key!. I then had to spend time working out how to do some exception handling which takes me a while given im a complete novice to coding. That's twice she has done it now lol. I'm really enjoying your vid's though and they are helping me learn the basics
Excellent tutorial. You are an awesome teacher. Thank you so much.
Hey Kylie how can I add points when we guess.
Example: A person is playing a guessing game in which they have 3 guesses to figure out the computer's secret number which will be between 1 and 20 inclusive (use randint to generate the number).If they guess the number correctly on the first guess the program should stop making them guess and they should get 10 points.
If they guess the number correctly on the second guess the program should stop making them guess and they should get 5 points If they guess the number correctly on the third guess, they should get 1 point. After an incorrect guess tell the user if their guess was too high or too low. If they fail to get the number correct after 3 guesses they get 0 points. Be sure to tell them what score they got, and show the computer's secret number. Ask the user if they want to continue playing the game. If they choose to play again, start at the beginning. If not, print a farewell message and the user's total score.
Can you please help me to explain how to add points and give chances.
I will be waiting for your reply.
Thank you.
Hi, Thanks for the tutorials as they are very helpful for beginners like me. I wanted to add giving the computer limited guesses. I tried creating a variable called count before the while loop and set it to zero. Then I set the conditions of the while loop to include your conditions in the video plus another "and" statement where count must be less than 4. Then after the if/else statements that you made I put count += 1 so the loop would terminate if it got above four. But I couldn't figure out how to make it print a message like "I didn't guess correctly" because the function would print that same message even if I hit c. I tried indenting, but it didn't work. I don't know if you understand me or not because it hard to explain in a RUclips comment and I'm a total newb. Thanks.
If I understand what youre saying correctly, you want to print out a different statement saying you’ve hit the limit. You would likely have to put in an if statement at the very end outside the loop to see whether the loop terminated as a result of incorrect guesses or because you’ve guessed the correct word
in the first part do we have to make a function?
Thank you! Helped a lot.
Wow, the second one was harder lol but I did it. 🎉
new sub! loved your vid you the way you pull up definitions! you diamond!
Thanks for the good content!
I'm not sure what is the problem but when I add the ".lower" part to the last part of the feedback parameter, the code just reiterates. But when I deleted it it just worked fine.
found the same problem "feedback = input(f"Is {guess} too high (H), too low(L), or correct (C)?? ").lower()" the () at the end are integral or it wont work
I keep getting my output stuck on guess the number between 1 to 10 and like you did at 3:59 and even when the code was completed at 6:22 it does the same thing it doesn't print low or high
check the last line of code. if you are calling the first function then call the second function.
according to this video, 1st function is calling on the last line guess(10), to guess the user secret number by the computer you should call the second function is computer_guess(10)
i think you left out the explanation on "f string", could you specify that if possible?
The first part of running the code is not working. Does anyone have any idea and yes I actually copied the code right but it isn't working it's applying the upper bound of 10 on x . Any suggestions?
No issues once the code got updated it went right through thank you for these videos.
Hello, I seem to have the same problem, howd u do it?
@@francogarcia8401 try closing the whole application and then open to run again or you know copy the right code that you have written and paste it in another window to run again. Hopefully it will work.
What does it mean when the f function doesn't change color in the line to determine the correct number?
Hellou ,is ther any way that if i accidently put letter as and aswear for question guess the number can i print something like "this is not the numnber"?
i don’t get "guess = 0" part. is it needed? why is it there?
Me too
The end of the video. 🤣🤣🤣
Thank you very much sister. you really helped me for my SCHOOL PROJECT! as well as the VIVA coz you just not give simply any programme. You explain it and make it very easy! Thank you ... and a hifi😊
i need help fixing this
import random
name = input('Enter your name human')
age = input('Enter your age' + name)
answer = input('Ok ' + name + ' Lets play a game, think of a number and type ok when ready')
if answer == 'ok':
def computer_guess(x):
low = 1
high = x
feedback = ''
while feedback != 'c':
if low != high:
guess = random.randint(low, high)
else:
guess = low
feedback = input(f'Is {guess} too high(h), too low(l). or correct (c) ??')
if feedback == 'h':
high = guess -1
elif feedback =='l':
low = guess + 1
print('Yay i guessed your number, {guess), right!')
Hey there, you had a few indentation problems in line 1 and the last line.
After that, you also created a function, but then never called it. So you'd need to add the function name on line 21 or after.
Your final print also has an issue where you forgot to add an 'f' at the beginning and you didn't close the accolade.
Also, your questions are missing spaces.
Here's your code with the said fixes. I didn't add anything else to optimize. Just fixed what your wrote.
import random
name = input('Enter your name human ')
age = input('Enter your age ' + name)
answer = input('Ok ' + name + ' Lets play a game, think of a number and type ok when ready ')
if answer == 'ok':
def computer_guess(x):
low = 1
high = x
feedback = ''
while feedback != 'c':
if low != high:
guess = random.randint(low, high)
else:
guess = low
feedback = input(f'Is {guess} too high(h), too low(l). or correct (c) ??')
if feedback == 'h':
high = guess -1
elif feedback =='l':
low = guess + 1
computer_guess(50)
print(f'Yay i guessed your number, {guess}, right!')
Hey Kylie! I know this was a year ago at this point, and maybe that's the issue as is, but my VS code doesn't recognize the 'import random' command. Do you have to take any additional steps for it to recognize the 'random' package? Thank you!
Tbh it should work if you have python installed
You should install random module first and then try it.
tried this and it didnt work, watched another video online, and think you need to add a int(input()) in the while loop after Print, no? I wasnt prompted to guess again trying your way
what other video did you watch
It is working on mine
Guess the number between 2 and 4
Great Video, Tyvm!
Could you try this but using a for loop?
sure, if you only want a certain number of guesses
ez cheat on my project♥
bing chilling
@@kindlycode7947 Bing Chilling T-T
@@PeenieB + 15 social credit
@@kindlycode7947 ding chilling
oh the computer_guess function is so hard to understand
I miss u
gr8
Great Job , Kylie!! bdw I tried making a tic tac toe game but i can't get the board to clear out and restart a new game when i tried to define a function for looping back to the game.
likely you'll need to reset the game board variable and reinitialize it
Hi do u remember me . My computer broke so i cant code . Please can u tell me apps that i can u on my phone like python ..
Btw thanks for being teaching me how to code
I'm not sure if there are any apps that will let you code on your phone. I'm unfamiliar with coding from a cell phone.. You can try searching on google but I would highly recommend fixing the computer :/
@@KylieYYing I think Google collab could work on phones...
You look stunning)
omg you're so cute 😳
Your so beautiful
Creep