diff options
Diffstat (limited to 'comp/work/7')
-rwxr-xr-x | comp/work/7/dice.py | 26 | ||||
-rwxr-xr-x | comp/work/7/famous.py | 26 | ||||
-rwxr-xr-x | comp/work/7/friends.py | 7 | ||||
-rwxr-xr-x | comp/work/7/input.py | 18 |
4 files changed, 77 insertions, 0 deletions
diff --git a/comp/work/7/dice.py b/comp/work/7/dice.py new file mode 100755 index 0000000..83ec09c --- /dev/null +++ b/comp/work/7/dice.py @@ -0,0 +1,26 @@ +import random + +dice = [] +for i in range(200): + dice.append(random.randint(1, 6)) + +count = [] +for i in range(6): + count.append(0) +for i in dice: + if i == 1: + count[0] = count[0] + 1 + elif i == 2: + count[1] = count[1] + 1 + elif i == 3: + count[2] = count[2] + 1 + elif i == 4: + count[3] = count[3] + 1 + elif i == 5: + count[4] = count[4] + 1 + else: + count[5] = count[5] + 1 + +for i in range(len(count)): + print("there are", count[i], str(i)+"'s") + diff --git a/comp/work/7/famous.py b/comp/work/7/famous.py new file mode 100755 index 0000000..7da792f --- /dev/null +++ b/comp/work/7/famous.py @@ -0,0 +1,26 @@ +name = ["tux", "wibler", "rms"] +clue1 = ["its a penguin", "it likes art", "what your refering to..."] +clue2 = ["it could have been a furry", "its a dog", "...as linux, is accutally gnu/linux"] + +score = 0 + +for x in range(3): + print(clue1[x]) + guess = input("who do you think it is? ") + if guess == name[x]: + print("you got it!") + score = score + 5 + else: + print(clue2[x]) + guess = input("who do you think it is now? ") + if guess == name[x]: + print("well done, you got it that time!") + score = score + 2 + else: + print("sorry that was wrong") + print("it was,", name[x]) + print("\n\n\n") + +print("you got,", score, "points") + + diff --git a/comp/work/7/friends.py b/comp/work/7/friends.py new file mode 100755 index 0000000..5d23111 --- /dev/null +++ b/comp/work/7/friends.py @@ -0,0 +1,7 @@ +friends = ["john", "ben", "sam", "micky mouse", "donald duck"] + +print(*friends, sep='\n') +friends.reverse() +print("\n\n\n") +print(*friends, sep='\n') + diff --git a/comp/work/7/input.py b/comp/work/7/input.py new file mode 100755 index 0000000..a9e5c8f --- /dev/null +++ b/comp/work/7/input.py @@ -0,0 +1,18 @@ +numbers = [] +for i in range(10): + numbers.append(int(input("number: "))) +total = sum(numbers) +mean = total / len(numbers) + +print("total =",total, "mean =",mean) + +above = 0 +for i in numbers: + if i < mean: + print(i, "is less than average (HA SMOL)") + elif i == mean: + print(i, "is average (BORINGGG)") + else: + print(i, "is more than average (DAMMNNNN)") + above = above + 1 +print(above, "numbers are above average") |