0% found this document useful (0 votes)
41 views

Coding101SlidesExercisesResourcesCode PDF

The document is a resource page for the Skillshare Coding 101 class. It provides links to slides and exercises for 9 coding lessons, which cover topics like data types, variables, collections, functions, conditionals, loops, objects and more. For each lesson, students can access slides, guided exercises that link to solutions, and further reading materials from a textbook. The exercises encourage applying concepts from the lessons and include challenges to test understanding. The final section discusses continuing learning through related Skillshare classes and provides additional practice exercises.

Uploaded by

Ionut Danaila
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Coding101SlidesExercisesResourcesCode PDF

The document is a resource page for the Skillshare Coding 101 class. It provides links to slides and exercises for 9 coding lessons, which cover topics like data types, variables, collections, functions, conditionals, loops, objects and more. For each lesson, students can access slides, guided exercises that link to solutions, and further reading materials from a textbook. The exercises encourage applying concepts from the lessons and include challenges to test understanding. The final section discusses continuing learning through related Skillshare classes and provides additional practice exercises.

Uploaded by

Ionut Danaila
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Skillshare Coding 101

Hello there! Welcome to the resources page for the Skillshare Coding 101 class. For the exercises below, feel free to refer back to the
lesson if need be. These arenʼt quizzes – the point is to get you more practice with coding.
« Back to the Skillshare Coding 101 Course
« About the Teacher: Alvin
Lesson 3: Data Types, Expressions, and Variables
Slides: Lesson 3 Slides
Guided Exercises (See solutions walkthrough in the Skillshare Coding 101 class)
Exercises Only
Solutions
Exercises (Lesson 3 Solutions):
i. Output 7 in the interpreter using only + , - , * (multiply), / (divide) and the number 3 . You may use parentheses ( , )
to change the order of operations if need be. For example, you could write 3 * 3 to output 9.
ii. Define a variable noise and set it to a string pika .
iii. Define a second variable is_pikachu that is True if noise ʼs value is a string pika .
Further Reading: Composing Programs Textbook 2.1
Lesson 4: Collections
Slides: Lesson 4 Slides
Guided Exercises (See solutions walkthrough in the Skillshare Coding 101 class)
Exercises Only
Solutions
Exercises (Lesson 4 Solutions):
i. Define a list containing a list of colors: purple, red, and blue. Assign this list to a variable colors .
ii. Define a variable has_red that is True if colors contains red.
iii. Define a variable second_color equal to the second color in colors .
iv. Define a dictionary that maps numbers to colors: 1 to purple, 5 to red, and 8 to blue. Use any variable name you like.
v. Challenge: Define a variable is_red that is True if the second color in colors is red.
Further Reading: Composing Programs Textbook 2.3
Lesson 5: Using Functions and Methods
Slides: Lesson 5 Slides
Nifty Tool: Email List Reformatting
Guided Exercises (See solutions walkthrough in the Skillshare Coding 101 class)
Exercises Only
Solutions
Exercises (Lesson 5 Solutions):
i. Split the filename test.txt into a list with two elements: test and txt using the .split method on a string. Assign the
result to a variable called parts .
ii. Extract the filename from test.txt (i.e., test ), and assign to a variable called filename . Hint: Use the previous exercise,
where you split the filename into a list. Then, just access the right item in the list.
iii. Challenge: Output the contents of this webpage ( https://aaalv.in/coding101/pikachu ) in Python. Hint: Use the code from
the lesson to read webpages.
Further Reading:
Composing Programs Textbook 1.1
Composing Programs Textbook 1.2
Lesson 6: Defining Functions
Slides: Lesson 6 Slides
Nifty Tool: Temperature Report
Guided Exercises (See solutions walkthrough in the Skillshare Coding 101 class)
Exercises Only Text, Repl.it
Solutions
Exercises (Lesson 6 Solutions):
i. Define a function called add3 that accepts one argument x and returns x + 3 .
ii. Define a function called add that accepts two arguments, x and y , and returns x + y .
iii. Define a function called concat that accepts two arguments, a and b , and concatenates the two strings with a space in
between a and b.
Further Reading: Composing Programs Textbook 1.3
Lesson 7: If-else Statement, While Loop
Slides: Lesson 7 Slides
Nifty Tool: Umbrella Recommender
Guided Exercises (See solutions walkthrough in the Skillshare Coding 101 class)
Exercises Only Text, Repl.it
Solutions
Exercises (Lesson 7 Solutions):
i. (Lesson 3) Define a variable name as Jill . Define a second variable is_jill that is True if the name is Jill.
ii. (Lesson 6): Write a function identity that accepts one argument, name . Return the name.
iii. Write a function is_jack that accepts on argument, name . Return True if the name is Jack.
iv. Write a while loop that prints all numbers from 2 to 6.
Further Reading: Composing Programs Textbook 1.5
Lesson 8: For Loop
Slides: Lesson 8 Slides
Nifty Tool: Password Checker
Guided Exercises (See solutions walkthrough in the Skillshare Coding 101 class)
Exercises Only Text, Repl.it
Solutions
Exercises (Lesson 8 Solutions):
i. (Lesson 4) Define a list of names containing Alfredo , Basil , and Cheese . The list should be assigned to a variable called
ingredients .

ii. Define a function that check if two strings are equal. Call the function is_equal . The function should be case-insensitive.
Hint: Use .lower on a string to lowercase all letters in the string.
iii. Write a for loop that prints all numbers from 2 to 6.
iv. Challenge: Define a function called has_ingredient that accepts two arguments: a list called ingredients and a string
called candidate . The function should return True if the candidate is in the list of ingredients. The function should be case-
insensitive.
First, define a function that takes two arguments.
Second, write a for loop that iterates over all ingredients.
Third, for each ingredient, check if it matches the candidate, using is_equal .
Fourth, if it matches the candidate, set a variable to True.
Fifth, return the boolean.
Further Reading: Composing Programs Textbook 1.5
Lesson 9: Using Objects
Slides: Lesson 9 Slides
Nifty Tool: Days until Your Birthday
Exercises (Lesson 9 Solutions):
i. Hint: Donʼt forget to import the datetime utilities by adding this to the top of your file from datetime import datetime .
ii. Compute the number of days between New Years and the summer solstice. You can look up the summer solstice date. We will
assume summer solstice is June 20 in our solution.
iii. Compute the number of days between January 1, 2100 and January 1 of your current year.
Further Reading: Composing Programs Textbook 2.4
Lesson 10: Practice
Slides
Nifty Tool: Secret Messages
Resource: Caesar Cipher Mapping
Lesson 11: Conclusion
Want to learn more? These classes are natural next steps:
Try building a Face-Swapping Filter with Computer Vision on Skillshare.
Learn how to work with a database, in SQL 101, on Skillshare.
Further Reading: Composing Programs Textbook for details.
Exercises:
Write a function that counts the number of words in a paragraph of text. You will need to understand the following concepts:
lists, strings, functions
Challenge: Given a list of digits, write a function that outputs the number that list represents. For example, the function may
accept [1, 5, 2] as input and return 152 as output. You will need to understand the following concepts: lists, for, numbers,
functions. (Hint: Use ** to raise a number to a power. For example, 10 ** 2 is 100 .)
Challenge: Write a function that capitalizes the name “John” anytime it appears in a paragraph. You will need to understand
the following concepts: lists, for, strings, functions, methods (Hint: To add an item to a list, use .append )

You might also like