List exercises.pdf

Unit 3.1-Lists.pdf

listEx4.py

#list1EX.py

from random import *

friends = ["Helen","laura", "Bob", "Jill", "John"]
words = ["loves" , "hates", "acts", "calls","punches"]

for i in friends:
  a = choice(friends)
  b = choice(words)
  c = choice(friends) 
  
  print (a,b,c)
#listEX2.py

fruits = ["orange", "banana", "berry", "cherry", "apple", "lemon", "tomato", "peach", "plum", "apricot"]
prices = [5.99, 10.29, 0.50, 20.00, 5.49, 2.99, 8.99, 5.99, 2.99, 5.99]

print("Aamina's Awesome Apples")
print("-------------------------")
for i in range(10):
    print(f"{fruits[i]:14} {prices[i]:8.2f}")
print("-------------------------")

#listEX3.py

kids = []
weeds = []
total = 0

for i in range (8):
  names = input("enter names: ")
  kids.append(names)
  weedsInput = int(input("enter num of weeds: "))
  total += weedsInput
  weeds.append(weedsInput)
  
perWeed = 100/total

for i in range (8):
  print (f" {kids[i]} earned ${perWeed * weeds[i]:.2f}")