Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
(a) For each symbol z in the alphabet E = {a, b, c}, let O, be the language over E consisting of all strings that contain an odd number of occurrences of the symbol r; and let E, be the language of strings over E containing an even number of occurrences of the symbol r. (i) Give a deterministic finite automaton whose language of accepted strings is Of- [2 marks] (u) Give a regular expression whose language of matching strings is Or. (2 marks] (ni) Give a deterministic finite automaton whose language of accepted strings is ONE- [4 marks] (b) M = (Q, E, 6, 9, F) is a deterministic finite automaton whose set of states Q has { elements. Suppose that A accepts a string w e E' whose length |wl satisfies (i) Show that w = upvuz for some strings m1, v, u2 ( E' such that lui|

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions