Answer:
k
Explanation:
bc i need points
Answer:
p=35
Explanation:
hoped this helped
Which of the statements below describe how to print a document?
Click on the Print icon at the tip of the screen.
Click on Print in the system tray.
Select Print from the Start menu.
Select Print from the File menu.
(On the picture above is what I have plz let me know if I’m wrong)
Implement the function printTwoLargest that inputs an arbitrary number of positive numbers from the user. The input of numbers stops when the first negative or zero value is entered by the user. The function then prints the two largest values entered by the user. If fewer than two distinct positive numbers are entered a message to that effect is printed instead of printing any numbers. Hint: Duplicates will cause problems. Try to make sure that you find a way to ignore them.
Answer:
The function in Python is as follows:
def printTwoLargest():
chk = 0
list1 = []
num = int(input("Enter: "))
while num > 0:
for i in list1:
if i == num:
chk+=1
break;
if chk == 0:
list1.append(num)
chk = 0
num = int(input("Enter: "))
list1.sort()
if len(list1) >= 2:
print("Largest:", list1[-1])
print("Second:", list1[-2])
else:
print("Length of list must be at least 2")
Explanation:
This defines the function
def printTwoLargest():
This initializes a check variable to 0
chk = 0
This initializes an empty list
list1 = []
This prompts the user for input
num = int(input("Enter: "))
The following loop is repeated until input is 0 or negative
while num > 0:
The following for loop checks for duplicate
for i in list1:
if i == num: If duplicate is found
chk+=1 The check variable is set to 1
break; And the for loop is exited
The input is appended to the list if the check variable is 0 (i.e. no duplicate)
if chk == 0:
list1.append(num)
This sets the check variable back to 0, for another input
chk = 0
This prompts the user for another input
num = int(input("Enter: "))
This sorts the list
list1.sort()
This prints the two largest if valid user input is 2 or more
if len(list1) >= 2:
print("Largest:", list1[-1])
print("Second:", list1[-2])
if otherwise, this prints that the length must be at least 2
else:
print("Length of list must be at least 2")
Put the steps in order to produce the output shown below. Assume the indenting will be correct in the program.
JDoe
1. Line 1
answer = username ('Joann', 'Doe')
2. Line 2
print (answer)
3. Line 3
def username (strFirst, strLast):
4. Line 4
return strFirst[O] + strLast
Answer:
The correct code is:
def username (strFirst, strLast):
return strFirst[O] + strLast
answer = username ('Joann', 'Doe')
print (answer)
Explanation:
The given code illustrates the use of functions.
i.e passing values to a function and retrieving values from it
So, first: We start with the def statement
def username (strFirst, strLast): ----> This defines the function
Then the return statement
return strFirst[O] + strLast --- > This passes value to the main
Next, is the main function of the program which is:
answer = username ('Joann', 'Doe') ---> This passes values to the username function
print (answer) ---> This prints the returned value from the function