Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 3.[10 Points) Consider now the same setup as in Assignment 2. Write a Python function which takes a list L as its argument on

image text in transcribed
image text in transcribed
Assignment 3.[10 Points) Consider now the same setup as in Assignment 2. Write a Python function which takes a list L as its argument on input and computes the counts divided (normalized) by their greatest common divisor (GCD). In addition, if heads count is larger than tails count or they are equal, it prints "(HT) count is (heads-count, tails-count)". If the tails count is larger, it prints "(T,H) count is (tails-count, heads-count)". The terms heads-count and tails-count are the actual counts, normalized by their GCD and of type integer. The Python math module contains a function, called god(). In order to compute the GCD, for example, of 4 and 6, the syntax is math.ged(4,6). The order of the integers does not matter. Assignment 2.10 Points Consider Python list L, which contains an arbitrary but finite number of characters 'H' and T. The characters 'H' and 'T stand for heads and tails outcomes of a repeated coin toss process. Write a Python function which takes such a list L as its argument on input and computes the heads-to-tails counts. For example, if L-[T H , TUHLH', ,'H'. 'T', 'H'], the function would print to screen exactly the (HT) count is (6.3). listing the heads count first and then the tails counts. Assignment 3.10 Points] Consider now the same setup as in Assignment 2. Write a Python function which takes a list L as its argument on input and computes the counts divided (normalized) by their greatest common divisor (GCD). In addition, if heads count is larger than tails count or they are equal, it prints (H.T) count is (heads-count, tais count)" If the tails count is larger, it prints"(T.H) count is (tails-count, heads-count)". The terms heads-count and tails-count are the actual counts, normalized by their GCD and of type integer. The Python math module contains a function, called ged(). In order to compute the GCD, for example, of land 6. the syntax is math.ged(4,6). The order of the integers does not matter

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

More Books

Students also viewed these Databases questions

Question

sharing of non-material benefits such as time and affection;

Answered: 1 week ago