1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
saw5 [17]
3 years ago
14

Given the user inputs, complete a program that does the following tasks: Define a set, fruits, containing the user inputs: my_fr

uit1, my_fruit2, and my_fruit3. Add the user inputs, your_fruit1 and your_fruit2, to fruits. Add the user input, their_fruit, to fruits. Add your_fruit1 to fruits. Remove my_fruit1 from fruits. Observe the output of each print statement carefully to understand what was done by each task of the program. Note: For testing purposes, sets are printed using sorted() for comparison, as in the book's examples. Ex: If the input is:
Computers and Technology
1 answer:
bazaltina [42]3 years ago
3 0

The program is an illustration of sets in a python program

<h3>What are sets?</h3>

Sets are variables that hold multiple values in a program

<h3>The main program</h3>

The program written in Python, where comments are used to explain each line is as follows:

my_fruit1 = input()

my_fruit2 = input()

my_fruit3 = input()

your_fruit1 = input()

your_fruit2 = input()

their_fruit = input()

# 1. TODO: Define a set, fruits, containing my_fruit1, my_fruit2, and my_fruit3

fruits = {my_fruit1, my_fruit2, my_fruit3}

print(sorted(fruits))

# 2. TODO: Add your_fruit1 and your_fruit2 to fruits

fruits.add(your_fruit1)

fruits.add(your_fruit2)

print(sorted(fruits))

# 3. TODO: Add their_fruit to fruits

fruits.add(their_fruit)

print(sorted(fruits))

# 4. TODO: Add your_fruit1 to fruits

fruits.add(your_fruit1)

print(sorted(fruits))

# 5. TODO: Remove my_fruit1 from fruits

fruits.remove(my_fruit1)

print(sorted(fruits))

Read more about python programs at:

brainly.com/question/26497128

You might be interested in
A newly opened law firm in Kirkland decides to create a small website that provides a brief introduction of the firm, its missio
Ivan

Answer:

Flat web architecture

Explanation: A flat web architecture is a type of web Structure where to link chain exists, in this type of web architecture,users can access the web site with few number of clicks such as in one, two or three clicks with a maximum of four clicks.

One of the basic importance when dealing with web pages is the number of clicks before the page requested can be reached. The lower the number of clicks the better.

5 0
3 years ago
Can't expand stack segment by 8 bytes to 524288 bytes.
aleksandrvk [35]
Try to clear your cashe its possible on a good computer but on a old its not possible for that hardware
3 0
3 years ago
Read 2 more answers
State the steps for opening Ms word Application ​
Charra [1.4K]

Answer:

Step 1: From the desktop or from your 'Start' menu, open Microsoft Word. Step 2: Click either File or the Office button at the top left. Select Open and browse to the document you wish to open. Double-click on it with your left-hand mouse button to open it.

Explanation:

PLZ MARK AS THE BRAINLIEST

HAVE A GOOD DAY

: )

4 0
3 years ago
PLEASE HELP !!!!!! INTERNET SAFTEY
blondinia [14]
On the football field
4 0
4 years ago
Read 2 more answers
Using the C language, write a function that accepts two parameters: a string of characters and a single character. The function
Sav [38]

Answer:

#include <stdio.h>

void interchangeCase(char phrase[],char c){

  for(int i=0;phrase[i]!='\0';i++){

      if(phrase[i]==c){

          if(phrase[i]>='A' && phrase[i]<='Z')

              phrase[i]+=32;

          else

              phrase[i]-=32;      

      }

  }

}

int main(){

  char c1[]="Eevee";

  interchangeCase(c1,'e');

  printf("%s\n",c1);

  char c2[]="Eevee";

  interchangeCase(c2,'E');

  printf("%s\n",c2);    

}

Explanation:

  • Create a function called interchangeCase that takes the phrase and c as parameters.
  • Run a for loop that runs until the end of phrase and check whether the selected character is found or not using an if statement.
  • If the character is upper-case alphabet, change it to lower-case alphabet and otherwise do the vice versa.
  • Inside the main function, test the program and display the results.
8 0
3 years ago
Other questions:
  • Your game design company has recently asked all employees to use a specific personal information management application (PIM) to
    6·1 answer
  • Dial-up connections can be made over a(n) ____ line or phone line. isdn dsl ipx tcp/ip
    12·1 answer
  • List five types of system information that can be obtained from the windows task manager. how can you use this information to co
    5·1 answer
  • Which phrase describes this image most precisely?
    10·1 answer
  • -How long does a copyright last?
    6·1 answer
  • What is a form of a stationary mouse on which the movement of a finger causes the pointer on the screen to move?
    7·1 answer
  • Need help with photography
    12·1 answer
  • Jemima is reviewing her history report and notices that her headings are not formatted the same throughout the
    7·1 answer
  • Which one way in which using infrared in game console controllers could affect the experience of a person playing the game?
    8·1 answer
  • Which three characteristics help identify a business opportunity? (Choose three)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!