Answer:
For the first picture, choose the second pair, and for the second one, choose the first pair
Explanation:
Answer:
def remove_duplicates(lst):
no_duplicate = []
dup = []
for x in lst:
if x not in no_duplicate:
no_duplicate.append(x)
else:
dup.append(x)
for y in dup:
if y in no_duplicate:
no_duplicate.remove(y)
return no_duplicate
Explanation:
Create a function called remove_duplicates that takes one parameter, lst
Create two lists one for no duplicate elements and one for duplicate elements
Create for loop that iterates through the lst. If an element is reached for first time, put it to the no_duplicate. If it is reached more than once, put it to the dup.
When the first loop is done, create another for loop that iterates through the dup. If one element in no_duplicate is in the dup, that means it is a duplicate, remove that element from the no_duplicate.
When the second loop is done, return the no_duplicate
Answer:
Answered below.
Explanation:
//Program in Python
login_name = "Admin"
password = "PASS"
display = " "
user_login_name = input ("Enter username: ")
user_password = input("Enter your Password: ")
if user_login_name == login_name and user_password == password:
display = "Correct Login"
elif user_login_name != login_name:
display = "wrong username"
elif user_password != password:
display = "wrong password"
print(display)
def GPAcalc(grade, weighted):
grade = grade.lower()
dictionary = {"a": 4, "b": 3, "c": 2, "d": 1, "f": 0}
if weighted == 1 and grade in dictionary:
return "Your GPA score is: "+str(dictionary[grade] + 1)
elif weighted == 0 and grade in dictionary:
return "Your GPA score is : "+str(dictionary[grade])
else:
return "Invalid"
print(GPAcalc(input("Input a letter grade: "), int(input("Is it weigthed? (1= yes, 0= no)"))))
I modified the code a bit to cut down on the use of if and elif statements. If you need me to change it, I will. Best of luck.