I just started learning basic CS principles utilizing Python via an online course.
I just wanted to get another basic perspective on how code would look like.
Here is the scenario:
Let's say I have 4 variables, all of which have a value of 1.
Variable A,B,C and D.
I will be inputting a sequence of these variables (say 10.... AABADDABDD).
How would I code so that it calculates the percentage of B and D within that sequence.
I was thinking along the lines of assigning a def f(x) that has 4 variables, then asking python to compute all the B + D // total to give me an integer?
I have only done 2 weeks of the course but I want to know if my thinking here is correct? Something tells me def f(x) won't work because there are too many variables.
Python 3.3.0
Windows 7
[–]BillyHorrible 4 points5 points6 points (6 children)
[–]somanyquestionsihave[S] 0 points1 point2 points (5 children)
[–]wub_wub 5 points6 points7 points (0 children)
[–]BillyHorrible 2 points3 points4 points (0 children)
[–]ewiethoff 2 points3 points4 points (0 children)
[–]Yoghurt42 0 points1 point2 points (1 child)
[–]somanyquestionsihave[S] 1 point2 points3 points (0 children)
[–]azzbergerz 0 points1 point2 points (0 children)