Project-2 : Random Integer Number Guessing Game in Python
Project -2

Link to see the code:
Problems that I encountered
What is the difference in between randint(start,end) and randrange(start,end) function.
How to use .split() function to take multiple inputs.
How to take 'n' number of inputs in a single variable.
how to convert a list of digit strings into integer list using for loop.
Understanding how map function works.
Separating the elements of the list and use them individually as a parameter in the randrange(start , element[0]) function
How to store the randomly generated numbers into a list.
How to use isinstance(int , list ) function and what it does.
How to create an empty list.
How to verify if the list has all the elements in it as the string digits using a loop.
Functions that I have used
.split(): It is used take multiple inputs.
map(arg1, arg2) : applies a function to each element of a collection, such as a list or set, and returns the results in a collection of the same type
randint(start , end) : This function is used generate a random number in between those starting and including the end number .
randrange(start , end) : This is similar to the randint but it doesn't include the end number only.
.random_numbers = int(random_numbers) : this syntax changes the string into an actual integer , ex:- "23" --> 23.
range(0,x) : similar to the randrange function it also generates random numbers.
len() : It is used to con=unt the length of the the list according to the elements that are there in the list.
import random : Python has a built-in module that you can use to make random numbers.
What I Learned
.isdigit() function : it is used to verify whether the string is a digit or not.
values = list(map(int, values)) #Strings in alist to integersmap(): this function maps the string into integers and store them in a list that is 'values' as earlier initialised
How to take multiple inputs in a single variable that is a list without using a for, etc ... loop i.e., by using only the split() function , and create a list of strings stored in 'value' named list.
values = str(input()).split() #While taking inputs it is storing thenm in the list format as a strings using .split() functionI learned how to check if the list has all the string as an digit using a shorter syntax.
print([x.isdigit() for x in values])Converting a string into a integer using syntax :
random_number = int(random_number)
i.e., "5" --> 5
What is the use of .isinstance() function : It is used to check whether the input is of that class or not.
if isinstance(player_guess, str): #It checks if that varaiblke has the value that is of the string class.Create a list of randomly generated numbers.
random_numbers=list(range(0,x)) #x is the end till which the random numbers will be generated. and will be stored in a list.Use of 'continue' : It is a keyword that directs the control to the upper nearest loop .
'break' : It is used to get out the control out of the loops
Use of 'and' 'or' : I used them in the trial and error programmes while making this programme , so I learned how to use them. T and T == T , T or F == T ,etc ... conditions.
random.shuffle() : This function shuffles the list(random_numbers) of generated numbers. Syntax:
```python random.shuffle(random_numbers)
Output:
[0, 1, 2]
list of random numbers generated [2, 1, 0]
```
- Creating a empty list --> syntax : list1 = []

![React Beginner [project based learning]](https://cdn.hashnode.com/res/hashnode/image/upload/v1725214935692/ae3dd028-c656-4bf0-8c57-588feeedba13.jpeg)
