Question
having trouble understanding functions and how to implement them here. #Program // Game for user to enter penies, nickles, dimes, and quarters to reach a
having trouble understanding functions and how to implement them here.
#Program // Game for user to enter penies, nickles, dimes, and quarters to reach a dollar
#dollarGame.py
#Welcome comment
print("Welcome to the dollar game!")
print("Try to get an exact dollar amount to win!")
print("Good Luck!")
#Variables
Pennies = 0
Nickles = 0
Dimes = 0
Quarters = 0
HalfDollars = 0
SilverDollars = 0
userTotal = 1.00
#consatnts
pennies = 0.01
nickles = 0.05
dimes = 0.10
quarters = 0.25
halfDollars = 0.50
silverDollars = 1.00
def main():
getAmount()
def getAmount():
userPennies = int(input('Please enter the number of nickles you have:'))
userNickles = int(input('Please enter the number of nickles you have:'))
userDimes = int(input('Please enter the number of dimes you have:'))
userQuarters = int(input('Please enter the number of Quarters you have:'))
userHalfDollars = int(input('Please enter the number of HalfDollars you have:'))
userSilverDollars = int(input('Please enter the number of Silver Dollars you have:'))
def calculations(getAmount):
totalPennies = getAmount(userPennies) * pennies
totalNickles = userNickles * nickles
totalDimes = userDimes * dimes
totalQuaters = userQuarters * quarters
totalHalfDollars = userHalfDollars * halfDollars
totalSilverDollars = userSilverDollars * silverDollars
userTotal = (totalPennies + totalNickles + totalDimes + totalQuaters + totalHalfDollars + totalSilverDollars)
main()
write program that lets the user enter a sting and displays te character that appears most frequently in the string. A space can be the most frequent in the string, but do not include it for the count.
Write program that uses a do or a while loop that has the user enter golf scores, terminated by a zero. After the zero has been entered, display the number of scores entered and their average.
Write program that lets the user enter a string and displays the letter that appears most frequently in the string, ignore spaces, punctuation, and Upper vs Lower case.
Create program that will calculate the factorial of any user entered integer.
Write program to print all natural numbers in reverse (from n to 1). - using loop
Create program to implement BINARY SEARCH ALGORITHM. Ask the user to enter 10 different values Sort the elements using any sorting algorithm in void sort () function
step by step and answer all que
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started