Forum Posts

Shravya S
Apr 05, 2022
In Introduction to Python
RESOURCES: Classwork: Classwork answers: https://replit.com/@ShravyaS/IntroToPython-23#main.py NO HOMEWORK! This week (4/5) is the last class! See you then!
3/29 - Class 23 Resources content media
0
0
11
Shravya S
Mar 30, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1cSvNqmidHLZvFANjvwYt65A563Qu2LI8MPt52yozQHs/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-22 HOMEWORK: Create and design a custom class. You can use anything except the in-class example that I programmed with (car), but make sure you use 3 attributes and 2 methods at least. Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!
0
0
16
Shravya S
Mar 20, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/10LqX5iltZ8boe6rpdhn7wuwLZcNjsQDA9jvhS_fNAGs/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-21 HOMEWORK: Write a program that that takes in several numbers. Store them in a list and use slicing to print out every odd indexed number (indexes 1, 3, 5, …), every index that is a multiple of 3 (indexes 0, 3, 6, …) and every index that is a multiple of 5 (indexes 0, 5, 10, …) Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!
0
1
11
Shravya S
Mar 15, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1Tl0DfU3mn-KnBnjzLnZoHtzr2vujPMQgdehusWt2rXw/edit?usp=sharing HOMEWORK / MINI-PROJECT: Create a program that simulates a standard deck of cards without Jokers. There are 4 suits of cards (Clubs, Diamonds, Hearts, Spades), each with 13 cards: Jack, Queen, King, Ace, and the numbers 2 through 10. This makes for a total of 4*13 = 52 cards. Your program should also keep track of one person's hand as well as a deck of cards, and the sum of the cards in the deck and that person's hand should of course be 52. Allow the user to draw cards into the person's hand, shuffle the deck, print out the cards in deck or in hand, etc. through commands entered through input. (Implement a draw function with a number of cards to draw, a shuffle function, printing for the hand/deck.) Create a card game with the existing code for this project, like Blackjack, Big 2, etc. I recommend having the game be a "pass-around" system, so every player in the card game has their own hand and enters input through the program. Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you on Tuesday!
0
1
5
Shravya S
Feb 28, 2022
In Introduction to Python
Sorry for the late post! RESOURCES: Class slides: https://docs.google.com/presentation/d/1yrk3igZ4omIMSG75CpmHoTUfd76rVysXkWosLrgmK_Q/edit?usp=sharing HOMEWORK / MINI-PROJECT: Write a program that acts as a basic "password manager." The program should store passwords for several different services and be able to set or retrieve passwords. For instance, "get google.com" should return the current password set for "google.com," and "set google.com xyz" would set the password for "google.com" as "xyz." Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you on Tuesday!
0
1
22
Shravya S
Feb 11, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/17bTKwj8HQCmq1EYbqcVSvHgdymNR0GSEsGLoUmmK5Gc/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-18 HOMEWORK / MINI-PROJECT: (Same as Class 16; use DICTIONARIES, not LISTS) Write a program that can accept menu items and menu prices, until the word "done" is entered. Store each item and price in a dictionary. Then, print out everything together as a fancy menu. ex: duck 35 chopsticks 10 done duck . . . . . . $35 chopsticks . . . . . . $10 Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!
0
3
25
Shravya S
Jan 30, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1kmWz86R6X1BuYi3Z952yiPgmlvWuow9KU0RXoCkKK8w/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-16 (This contains the solution to the mini-project and more information about tuples, so if you need help with dictionaries, just email me at shravyassathish@gmail.com :)) HOMEWORK / MINI-PROJECT: Write a program that can accept menu items and menu prices, until the word "done" is entered. Store each item and price in a dictionary. Then, print out everything together as a fancy menu. ex: duck 35 chopsticks 10 done duck . . . . . . $35 chopsticks . . . . . . $10 Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!
0
2
21
Shravya S
Jan 16, 2022
In Introduction to Python
RESOURCES: Class slides: not added yet! Example code: https://replit.com/@ShravyaS/IntroToPython-15 HOMEWORK / MINI-PROJECT: Same as last week! See https://www.lol-101.com/classrooms/introduction-to-python/1-4-class-14-hw-resources. Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!
0
1
30
Shravya S
Jan 08, 2022
In Introduction to Python
Happy late New Year, and welcome back after winter break! :) RESOURCES: Class slides: https://docs.google.com/presentation/d/16-34_-argpSG1VIpp5Xvm-h-cjjuugiq_whAsP6jgG0/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-14 HOMEWORK / MINI-PROJECT: Create a program that simulates a standard deck of cards without Jokers. There are 4 suits of cards (Clubs, Diamonds, Hearts, Spades), each with 13 cards: Jack, Queen, King, Ace, and the numbers 2 through 10. This makes for a total of 4*13 = 52 cards. Your program should also keep track of one person's hand as well as a deck of cards, and the sum of the cards in the deck and that person's hand should of course be 52. Allow the user to draw cards into the person's hand, shuffle the deck, print out the cards in deck or in hand, etc. through commands entered through input. (Implement a draw function with a number of cards to draw, a shuffle function, printing for the hand/deck.) Enhancement ideas: keep track of 4 (or more) players' hands, print out the cards as little ASCII drawings, implement a simple card game with these functions. Write your answer as a comment, and feel free to email the TAs (Shravya and Eric) if you're stuck. See you next class!
0
2
30
Shravya S
Dec 15, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1AXVYWIXesdnNct0KtiCi_ZZn6Kz72HKJbh4VH6BRmHY/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-13 HOMEWORK: Create a list to store several inputs. Then, take in input until the word "STOP" is entered. Store each input apart from "STOP" in the list, and then print out the contents of the list backward. Write your answer as a comment, and we’ll post the solution by the next class. See you then!
0
2
35
Shravya S
Dec 11, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1Nfey5nRu4sirto6_eVUFU3cGLilh9KPrtXxhUOOYtzM/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-12 HOMEWORK: No homework this week!
0
0
6
Shravya S
Dec 01, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1bqum5T0zURUajP4D2nLF0ZXGgpAACazOu-t56SYk0zk/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-11 HOMEWORK: The tribonacci sequence is similar to the fibonacci sequence, but each term is the sum of the three terms before it. Write a recursive function to calculate the n-th tribonacci number, if the first three are 0, 0, 1. ex. 0, 0, 1, 1, 2, 4, 7, … (Code for the Fibonacci sequence is in slides.) Write your answer as a comment, and we’ll post the solution by next class. See you then!
0
3
17
Shravya S
Nov 17, 2021
In Introduction to Python
RESOURCES: I haven't posted in a bit, so I've added resources from the last 2 weeks: Week 8 Slides: https://docs.google.com/presentation/d/1eul03VByEhgR7TDKSvk373H5dxwkN_gDroNlLmq_YOI/edit?usp=sharing Week 9 Slides: https://docs.google.com/presentation/d/1sjEbay9nKKXypizMsMhUlKzzG4M9fnVBbPuC5V5gM2k/edit?usp=sharing Week 10 Slides: https://docs.google.com/presentation/d/1tyDKdw8DQenLrrty3HjntSAm-okXjBDbWo6rWHFGVmc/edit?usp=sharing Example code: Week 8: https://replit.com/@ShravyaS/IntroToPython-8 Week 9: https://replit.com/@ShravyaS/IntroToPython-9 Week 10: https://replit.com/@ShravyaS/IntroToPython-10 MINI PROJECT: For this project, please create a program that plays rock paper scissors with the user. The program should keep prompting the user for their move and keep playing games of rock paper scissors until the user enters "stop". Once "stop" is entered, print out the total number of wins and the total number of losses and the total number of draws. - Use the random module, while loop, use input/print, and use if statements Sample output: https://asciinema.org/a/AgNJ6i68mN3KkEvEvYU06Cc87
1
5
45
Shravya S
Oct 30, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1OzGQZc_DA0LFSBX92oApZWvSX5bW_tTdOiP6mNV2FvM/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-7 HOMEWORK: Write a program that repeatedly takes in input as a number until "STOP" is inputted. Find the average of the numbers. Hint: Have an input inside of the while loop! (Look at the example code for how to do this.) Write your answer as a comment, and we’ll post the solution by next class. See you then! Note: VIP students, please contact us (Eric and me) about office hours. And of course, feel free to ask for help!
0
3
38
Shravya S
Oct 20, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/19wPir2zEfD4v8Qev2pdne4F7gN-7Y6b3yHcSMTJQb6s/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-6 (Notes included in example code.) HOMEWORK: Same as last time! For this project, please build a mad-lib generator. Mad-libs are stories where the user fills out some words, which are inserted into a (sort of) template. For this project, please allow users to choose between (at least) 3 story templates. Think of using .title() and .capitalize() "Enter the number 1 if you want the story about cheeseburgers, the number 2 if you want the story about Romeo and Juliet, and 3 if …" https://madtakes.com/libs/152.html ​(example) Write your answer as a comment, and we’ll post the solution by next class. See you then! Note: VIP students, please contact us (Eric and me) about office hours. And of course, feel free to ask for help!
0
1
43
Shravya S
Oct 16, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/11UieHJcWcYvJy7hVcSUFgwp2mINhqcw71oD3T8qy-5s/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython-5 (Notes included in example code.) HOMEWORK: For this project, please build a mad-lib generator. Mad-libs are stories where the user fills out some words, which are inserted into a (sort of) template. For this project, please allow users to choose between (at least) 3 story templates. Think of using .title() and .capitalize() "Enter the number 1 if you want the story about cheeseburgers, the number 2 if you want the story about Romeo and Juliet, and 3 if …" https://madtakes.com/libs/152.html (example) Write your answer as a comment, and we’ll post the solution by next class. See you then! Note: VIP students, please contact us (Eric and me) about office hours!
0
5
44
Shravya S
Oct 08, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/13o7_ZULP7vmTw1feA3cAUIhqHlLmGaKn7nPJ_pAra_0/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntrotoPython-4 (Notes included in example code.) HOMEWORK: Take in input of the radius r of a circle and the side length x of a square. Compare the areas of the two and say which is larger. If the area of the circle is greater, print out "circle", if the area of the square is greater, print out "square", and if they are equal, print out "equal." Write your answer as a comment, and we’ll post the solution by next class. See you then! Note: VIP students, please contact us (Eric and me) about office hours!
0
2
22
Shravya S
Oct 01, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1iPT_gnG2iSXXjWj2tE6gbsdg4V0Sy8rY08SC5SoB9CA/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntrotoPython-3 (No bullet notes this week.) HOMEWORK: Write code to take in two integers: the first represents feet and the second is inches of someone’s height (like 5 feet 4 inches). Print out what the height is in feet with decimal points, then print out what the height is in meters. Write your answer as a comment, and we’ll post the solution by next class. See you then! Note: VIP students, please contact us (Eric and I) about office hours!
0
4
49
Shravya S
Sep 22, 2021
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1IHtsWNQNQxU-tdgOF-WZ_byWW99wdQXqB9c0G-7W3l4/edit?usp=sharing Example code (with comments): https://replit.com/@ShravyaS/IntroToPython-2 Recap: - Separators: print('hi', 'hello', sep='^') outputs "hi^hello" - Ending characters: print('this is a question', end='?') outputs "this is a question?" - Math in Python: Either use the same datatype, or convert using int(), str(), float(), bool() - Taking input: Input takes a value from the user. You can assign input to a variable with x = input() HOMEWORK: Write a program to take in input of a float and an integer: the float is a price for an item and the integer is how many of that item are ordered. Print out the total cost. (For example, buying 3 apples at $0.49 each means the total cost is $1.47.) Post your answers as a comment, and let us know if you need help! We'll post solutions before next class.
0
5
49
Shravya S
Sep 15, 2021
In Introduction to Python
Hi everyone, hope you had a great first class! RESOURCES: Class slides: https://docs.google.com/presentation/d/1QYxtxPQ2aYn4e7HWUbLPgZIO43LFtU6Tu8G8GVM7BlE/edit?usp=sharing Example code: https://replit.com/@ShravyaS/IntroToPython Coding platform: replit.com Join the Discord (if you can): https://discord.gg/Am6Y3r2y (You can always ask for help under #intro-python) In addition, here's a quick recap: - Python is a programming language that's readable and user-friendly. - In repl.it, the left side is the editor and the right side is the console. Code goes in the editor, output in the console. - Variables are like a box that contain values. - Datatypes are types of values, and they include strings, ints, floats, booleans, and more. - Strings = chain of characters (ex: "Hello!") - Integers = numbers (ex: 9) - Floats = decimals (ex: 2.5) - Boolean = True or False - Variables can be created, reassigned, or printed (with other values, too.) HOMEWORK: 1. Give 3 examples each (different from the slides) of integers, floats, and strings. (9 in total.) 2. Write a program that stores 2 variables: a title (like "Sir" or "Mr.") and a name. What data type is best to use for these two variables? Have the program print out "Hello, {title} {name}" Post your answers as a comment! We'll post solutions before next class.
0
8
84
Shravya S
More actions