top of page

Forum Posts

felixguo41
Mar 06, 2023
In Introduction to Python
Create the appropriate graphs. Label all axes and titles. Let’s say you’re given a choice between two ways to make money. 1: You receive $5 every day. 2: Your amount doubles every day. Model both of these as equations and then graph them. Then, create a legend where the first model is labeled “Add $5” and the second is “Double $”. The x-axis should be the days and the y-axis should be the amount of money made. Plot two Normal distributions (histograms) with one subplot on top of the other. The first represents the heights of a sample of 50 13-year-old girls, with a mean of 59 inches and standard deviation of 3 inches. The second represents the heights of a sample of 50 13-year-old boys, with a mean of 63 inches and standard deviation of 4 inches. Also, adjust the figure size to be 6 inches x 4 inches. Resources: Slides: https://docs.google.com/presentation/d/1STabsCa0odMQcYhnoUv_K2HdW17B8s1Vg4qu058wWK0/edit?usp=sharing Code: https://replit.com/@Shrav816/IntroToPython-Class23#main.py Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
4
29
felixguo41
Feb 20, 2023
In Introduction to Python
Create each of these scenarios using numpy arrays. A teacher wants to know the median of each of her classes’ grades on a recent test. She creates a 5 x 7 array where each row represents a class and each column represents a set of students. Sort the columns. Then, split the array vertically and take the middle column, which is the set of medians. Print this column. Jason and Damian are playing cards with a deck of 24. Each of the two have 12 cards, and each card is random and is from 1 to 10, inclusive. Right before they start playing, Tim also wants to join, so they reshape their deck so that it’s 8 cards for each of them. Lastly, shuffle the cards. Recourses: Slides: https://docs.google.com/presentation/d/1vyaxQOryei1Q4rt4IPgm83v6lwZLlHOnLz7lMSUDWfg/edit#slide=id.g20f261a942f_0_33 Code: https://replit.com/@Shrav816/IntrotoPython-Class21 Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
4
20
felixguo41
Feb 06, 2023
In Introduction to Python
Create a one dimensional array that has the range 1 to 1000 divided into 20 parts. Create an array that has the dimensions 5 rows x 5 columns. Sort each row of the array. Add another column to the array. Recourses: Class slides: https://docs.google.com/presentation/d/1xoS64IpN-Kq3IfZNtTA78q3LUPOLBs_B_eox4UWu6aM/edit#slide=id.g2058d1d15c8_0_7 Class code: https://replit.com/join/hwonleegzr-shrav816 Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
2
30
felixguo41
Jan 23, 2023
In Introduction to Python
Create the parent class Vehicle. Give it attributes make, model, and mileage. It should have an accessor method displayInfo(). It should also have a modifier method addMileage() which adds an integer to the mileage (ex: addMileage(50) will add 50 to the mileage attribute.) Create the subclass Bus. Give it the extra attribute fare. Add the method calculateFare() with the parameter trips. Then, it should print the attribute fare multiplied by trips. (ex: If self.fare = 2.50 and we call calculateFare(4), it should return 10.0). Override the method displayInfo() to also display the bus fare. Instantiate/make an object of the class Bus. Run addMileage(100), then calculateFare(5), and lastly, displayInfo(). Resourses: Class slides: Intro to Python 2022 (17) - Google Slides Class code: Class-17 Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
5
36
felixguo41
Jan 12, 2023
In Introduction to Python
Write a program that takes input of a number in word format like “one” or “four”. Print out the ordinal number for the input (ex: “one” → “first”, “five” → “fifth”) Write a program that inputs a number and generates an error message if it is not a number. It should keep asking for input until it is valid. Print this table using lists and for loops: Create a rock-paper-scissors game that uses functions. Create a .txt file. Write three new lines, then read the entire file. Complete as you see fit. If you haven't completed the homework before the break yet, please focus on that first! Resources: Slides: https://docs.google.com/presentation/d/1jYvYjJm8gtM86UZeI43aR3hF96kwKSVDAWNqoyq-xwI/edit#slide=id.g1d1f0cb7f4f_0_1 Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
1/8 Week 15 Review Homework content media
0
2
23
felixguo41
Dec 12, 2022
In Introduction to Python
Create a dictionary with different prices for various fruits. Let’s say someone asks for a fruit. First, try and check if the fruit exists in your dictionary. If it does, print out its price. Otherwise (if there’s a KeyError), raise an exception saying, “We don’t have that fruit, sorry.” Open a text file and read the first four lines. Resources: Slides: https://docs.google.com/presentation/d/1XQY8GPwaZntgnbWxcvmU23LE8x9vp4eDn_UWrBtcKjw/edit#slide=id.g1b547acc537_0_34 Class code: https://replit.com/@Shrav816/IntroToPython-Class13#main.py Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
3
13
felixguo41
Nov 14, 2022
In Introduction to Python
Create a dictionary that corresponds a letter to a set of numbers for grades (A = 100-90, B = 89-80, etc). Take user input for a letter and then print the appropriate grade range. Write a function to reverse all the characters of a string. (Hint: lists) Write a function that takes in a length in inches and converts it to centimeters. Resources: Class slides: https://docs.google.com/presentation/d/1YE65GPWYQF5Uefdguci73FnjEpDUbN1qJX60acT1UMU/edit#slide=id.g18c35fbbda7_0_142 Class code: https://replit.com/@ShravyaS/IntroToPython-Class10#main.py Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
1
40
felixguo41
Oct 30, 2022
In Introduction to Python
Generate a 4-by-4 nested list with random floats between 10 and 20 inclusive, and print in grid format. Use methods from the random module to generate random ships for your Sonar Detector game. Nested for loops – outer loop for each ship, inner loop for each coordinate Use either random.randint() or random.randrange() or use random.sample() to get ship coordinates. Append each ship to ships nested list. Resources: Class slides: https://docs.google.com/presentation/d/1KN5-PN8u_sUuDpeVgMvbClVLuG3xPmktJl5sKQtfCUA/edit#slide=id.g17a24fb764f_0_116 Class code: https://replit.com/@ShravyaS/IntroToPython-Class8 Completed game: https://replit.com/@ShravyaS/Sonar-Detector#main.py Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
5
51
felixguo41
Oct 17, 2022
In Introduction to Python
Homework: Create a list of numbers and print every multiple of 3. Then, subtract 2 from every element and print every multiple of 3 from the changed list. Use list comprehension to create a list of the square roots of every number from 0 to 10. Hint: square root = exponent of ½, so (9)**(1 / 2) = 3. Create a coordinate plane using nested lists. It should look like this: There is a tab between each element of each row. Resources: Class slides: https://docs.google.com/presentation/d/1KZJiuDgLTRXbCrBTl7MoxMNUduLGNOvJqYCEviVlxMc/edit#slide=id.g13233bed446_0_1244 Class code: https://replit.com/@ShravyaS/IntroToPython-Class6#main.py Contact Info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
10/16 - Homework Week 6 content media
0
4
50
felixguo41
Oct 02, 2022
In Introduction to Python
Homework: Write a while loop with these conditions: Variable num starts at 0 Increments by 3 for a multiple of 2 Increments by 5 for a multiple of 3 Increments by 7 for a multiple of 5 Else, increment by 1 (For numbers like 30, a multiple of 2, 3, and 5, just let it increment thrice.) num ends at 50 Write a for loop that reverses a string. Write a while loop that prints all numbers from 1 to 50 except multiples of 4. Resources: Class slides: https://docs.google.com/presentation/d/12rWL4PsRGKQ8NNUjlfhZL2R8WsSt6vfex4KB7vGWAJI/edit#slide=id.g15d5b893d3d_0_140 Class code: https://replit.com/@ShravyaS/IntrotoPython-Class4#main.py Contact info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
8
93
felixguo41
Sep 18, 2022
In Introduction to Python
Hey guys, here's the homework for week 2. Solutions will be posted later this week. If you have any problems or questions, be sure to let us know. Homework: Write a program that takes two inputs and stores them in the variables feet and inches. Print output of their height in centimeters. (12 inches = 1 foot, 1 inch = 2.54 centimeters) What do these print? (“99” - 8) % 6 int(5.8) + float(9) * 3 4 + int(“447”) str(4) + “447” str(bool(0)) + “ is the opposite of ” + str(bool(25)) Resources Class slides: https://docs.google.com/presentation/d/1ZUl6aCzJc6HFCNRWgVy9EiNh8KM2Kw6zqM4VDY8oscc/edit#slide=id.g155f1b6c9e0_0_568 Class code: https://replit.com/@ShravyaS/IntrotoPython-Class2#main.py Discord: https://discord.gg/28D6hGXP Contact info: shravyassathish@gmail.com (mentor) kingericwu@gmail.com (TA) felixguo41@gmail.com (TA)
0
8
102

felixguo41

More actions
bottom of page