Coding Python Homework
Coding Python Homework
"""
HW 1. Using this list a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
Output 2 separate lists with even and odd numbers separated.
HW 2. Take user input to build a list containing marks of 5 subjects (Out of 100).
a) Calculate the average marks.
b) Judge 'over all performance' in each subject with output depending on:
score > 50 -> Needs improvement
score > 70 -> Can do better
score > 80 -> Bravo! Try harder
score > 90 -> Excellent
HW 3. Take the user input value n to stand for the number of inputs. Next, Collect input
numbers from user n number of times and sort into different lists. The final output
being 4 separate lists each representing input values completely divisible by 2,3,5 and
one for exceptions.
HW 5. Create a list of students names if they have the parent permission card
to be included in a field trip. Use n to represent the number of students. Collect
n number of student names and permission status ('Yes' or 'No'). Generate 2 final lists
for the students separating into batches allowed and not allowed.
test_list = [1, 9, 5, 6, 3, 4, 5]
count = len(test_list)
for i in range(0,count-1):
for j in range(i+1,count):
if test_list[i]>test_list[j]:
temp = test_list[i]
test_list[i]=test_list[j]
test_list[j] = temp
print(test_list)
import random
play = 'Y'
if val == "1":
n = random.choice([2,3])
if n == 2:
print("Computer's choice is Paper \n Rock Vs. Paper \n Paper Wins => Computer Wins\
n")
else:
print("Computer's choice is Scissor \n Rock Vs. Scissor \n Scissor Wins => Player Wins\
n")
"""