kying18 / guess-the-number Goto Github PK
View Code? Open in Web Editor NEWGuess the Number tutorial for beginner python youtube video
Guess the Number tutorial for beginner python youtube video
Hi, @kying18 , nice to meet you!
import random
low = 3
high = 3
guess = random.randint(low, high)
print(guess)
this will result as guess = 3, So can you explain that why did you said that "randint" will throw an error if low and high are equal.
I checked it separately but it didn't give me an error.
The second function does not run only te first one does.
In the sample code beginner users will find an issue when running the program.
The error will be something like TypeError: '<' not supported between instances of 'str' and 'int'
To solve this change line 7 from `guess = input(f"Guess a number between 1 and 10 {x}:")
guess = int(input(f"Guess a number between 1 and 10 {x}:"))
Hello
The second function is not executed because it has not been called and it is not necessary to write that function and it has occupied extra memory. It would have been better if you had added some points in the first function, for example, what would happen if the numbers were chosen equally. I will fork this code tomorrow
the program runs normally with user guess, but then it comes to the computer guess it doesn't work....could u tell what might be the mistake.thanks for the help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.