Forum Posts

Shravya S
Aug 04, 2022
In Introduction to Python
Homework: None! Today is the last class. Resources: Class slides: https://docs.google.com/presentation/d/1Ny2ad5hPuoNFRriRWdtzLYvXXt-LdFYnFlNnYpfUEoY/edit?usp=sharing Class code: https://replit.com/join/mddurqtsmb-shravyas What we finished of Pokemon Attack in class: https://replit.com/join/njbkmizzsv-shravyas Finished Pokemon Attack: https://replit.com/join/xlmxmuwzpe-shravyas Thank you for attending Intro to Python! You can always email us at shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) or message us on Discord if you have any questions about what we covered in class or anything in the future.
0
0
12
Shravya S
Jul 16, 2022
In Introduction to Python
HOMEWORK: Math expressions: Write and calculate these expressions in Python. e^5 Ceiling function of the square root of 127 Card exercise Create a tuple to represent the four suits of cards (hearts, diamonds, spades, and clubs), and another tuple for 13 possible values (2 - 10, J, Q, K, A). Iterate over all possible cards. Using the random module, deal three random cards. Sets Take input for the elements of a set (space-separated integers). Create the set, and then create another set. Print the intersection/elements in common. RESOURCES: Class slides: https://docs.google.com/presentation/d/1PTxphkoJcpzyN2h4qDsyk-6SG7_OzQCOC8G2w0CFYP8/edit?usp=sharing Battleship code: https://replit.com/join/hlutbjbnyh-shravyas Class example code: https://replit.com/join/uvyjosgvrd-shravyas Coding platform: replit.com Post your answers as a comment! I will post the solution before next class. You can always email us at shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) or message us on Discord if you have any questions about the homework or what we covered in class.
0
1
19
Shravya S
Jun 30, 2022
In Introduction to Python
HOMEWORK: Finish your battleship project code. Here are the requirements for what it should be able to do: Show the proper coordinate grid. Show the number of turns remaining. Accept user input. Check if it is your nested list -- ships. Either print "hit" or "miss". End the program after five turns. Extra features: Don't allow duplicate guesses. For this, you'll need a nested list that appends each of the guesses. Then, check if every new guess is in this guess list (like checking against the ships list). Handle out-of-bounds cases. For example, if the player guesses [6, 8], it should say their coordinates need to be from 0 to 4. End before five turns if the player guesses all of the ships. Multiple approaches -- easiest one is to have a counter for ships found and check if that has reached a certain threshold. RESOURCES: Class slides: https://docs.google.com/presentation/d/1r1J1ArzL7Xyv1ifIxuNHqwSwGNrpt7QUx3QM0W2IXCU/edit?usp=sharing Class code: https://replit.com/@ShravyaS/BattleshipGame#main.py (This code is different from my answer key, so it doesn't include extra features/isn't the most organized. It's what we typed in class!) Post your answers as a comment! Solutions will be up soon. You can always email us at shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) or message us on Discord if you have any questions about the homework or what we covered in class.
0
1
31
Shravya S
Jun 28, 2022
In Introduction to Python
HOMEWORK: RESOURCES: Class slides: https://docs.google.com/presentation/d/1534SMu5WLajXYbIoYIGkOAQ5QEUzWNbWYDskVvz9SGY/edit?usp=sharing Code: https://replit.com/@ShravyaS/IntroToPython-Wk3Day2#main.py Post your answers as a comment! Solutions will be up soon. You can always email us at shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) or message us on Discord if you have any questions about the homework or what we covered in class.
6/26 - Homework Week 3 Day 2 content media
0
2
34
Shravya S
Jun 12, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1kY_YhPN9f8OI-mVB-gzk6ukoakYycvhzds_2g96ofIk/edit?usp=sharing Code from class: https://replit.com/@ShravyaS/IntroToPython-Wk1Day2 Coding platform: replit.com HOMEWORK: Write a program that takes two inputs and stores them in variables feet and inches. Print output of their height in only inches. (12 inches = 1 foot) Using the six comparison operators and three logical operators, write two expressions that are true and two expressions that are false. Post your answers as a comment! Solutions will be posted later (we'll also go over it next class). Feel free to email shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) if you're stuck or have questions! See you :)
0
10
62
Shravya S
Jun 09, 2022
In Introduction to Python
RESOURCES: Class slides: https://docs.google.com/presentation/d/1zIPSvXFg7eEVjguovCNHKpuojvqCq6eA5tjJpfGnSKc/edit?usp=sharing Coding platform: replit.com Discord: https://discord.gg/FKKAcmrr HOMEWORK: Give 3 examples of each data type (2 examples for Booleans). Take user input and tell an interactive story using f-strings and concatenation of variables and print statements. Example of a starting point: username = input(“What is your name?”) print(username + “, you know my name, not my story”) Post your answers as a comment! Solutions will be posted later. Feel free to email shravyassathish@gmail.com (mentor) or kingericwu@gmail.com (TA) if you're stuck or have questions! See you next class :)
0
15
70
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
19
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
19
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
15
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
8
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
26
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
27
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
24
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
33
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
37
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
8
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
18
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
47
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
40
S
Shravya S

Shravya S

Forum Moderator
More actions