python program to choose a ball
Answers
Answer:
Python is a multipurpose language and can be used in almost every field of development. Python can also be used to develop different type of game. Let’s try to develop a simple Catching the ball game using Python and TKinter.
Game is very simple. There is one bar at the bottom of game window which can be moved left or right using the buttons that are in the game window. Red ball will continuously fall from top to bottom and can start from any random x-axis distance. The task is to bring that bar to a suitable location by moving left or right so that the red ball will fall on that bar(catch the ball onto the bar) not on the ground. If player catches the ball onto the bar then score will get increase and that ball will disappear and again a new red ball will start falling from top to bottom starting from random x-axis distance. If player miss the ball from catching it on the bar then you will lose the game and then finally scorecard will appear on the game window.
Explanation:
make brainlist
Program for at least one ball is chosen
Output:
3
Explanation:
mod = 1000000007
# declare function that returns the count of balls
def count(n):
#Returns the count
return (((2**n) - 1) % mod)
#set variable and initialize to 2
num = 2
#call and print the function
print(count(num))
The following are the description of the program.
- Set the variable 'mod' that store the modulus value.
- Declare the function that returns the number of counts and inside the function, we perform some calculation to find the count.
- Finally, we set the variable 'num' and initialize it to 2 and pass that variable in the parameter of the following function then, call and print that function.
Learn More:
https://brainly.in/question/13354827