Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Assignment 10: Sets

  1. Set Operations:

    • Create two sets of your favorite fruits.
    • Write a function named print_unique_fruits that takes two sets as parameters and prints the unique fruits present in both sets.
    • Call the function with your sets.
  2. Set Intersection:

    • Create two sets of numbers.
    • Write a function named common_numbers that takes two sets as parameters and returns a new set containing the common numbers.
    • Call the function with your sets and print the results.
  3. Set Difference:

    • Create two sets of animals.
    • Write a function named unique_animals that takes two sets as parameters and returns a new set containing the animals unique to each set.
    • Call the function with your sets and print the results.

Assignment 11: Dictionaries

  1. Dictionary Operations:

    • Create a dictionary of your favorite movies with movie names as keys and release years as values.
    • Write a function named print_movies that takes a dictionary as a parameter and prints each movie along with its release year.
    • Call the function with your dictionary.
  2. Dictionary Manipulation:

    • Create a dictionary of cities and their populations.
    • Write a function named calculate_total_population that takes a dictionary as a parameter and returns the total population.
    • Call the function with your dictionary and print the result.
  3. Dictionary Update:

    • Create a dictionary representing a person's information (name, age, city).
    • Write a function named update_city that takes a dictionary as a parameter and updates the city information.
    • Call the function with your dictionary and print the updated dictionary.

Assignment 12: Strings

  1. String Concatenation:

    • Create two strings containing your first and last names.
    • Write a function named full_name that takes two strings as parameters and returns the full name.
    • Call the function with your strings and print the result.
  2. String Length:

    • Create a string containing a sentence.
    • Write a function named sentence_length that takes a string as a parameter and returns the length of the sentence.
    • Call the function with your string and print the result.
  3. Substring Search:

    • Create a string containing a paragraph.
    • Write a function named search_substring that takes a string and a substring as parameters and checks if the substring is present in the string.
    • Call the function with your string and a few substrings.

Instructions:

  • Encourage students to use meaningful variable names and provide comments explaining their code.
  • Remind students to call the functions with different values to test their implementations.
  • Emphasize the importance of code readability and efficiency.
  • Encourage experimentation with different scenarios to ensure the correctness of the code.
  • Provide feedback on the usage of sets, dictionaries, and strings in their solutions.