#voice-chat-text-1
1 messages · Page 52 of 1
!stream 745015733238497330 30M
✅ @frosty plaza can now stream until <t:1738556322:f>.
!pep8
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
- PEP 8 document
- Our PEP 8 song! :notes:
@edgy holly 👋
sick how did you make this
hi
sup
i used the manim library
https://docs.manim.community/en/stable/
Animating technical concepts is traditionally pretty tedious since it can be difficult to make the animations precise enough to convey them accurately. Manim relies on Python’s simplicity to genera...
Ask them about Tienanmen Square and get back to us.
hi guys
March of the Volunteers ( traditional Chinese: 義勇軍進行曲; pinyin: Yìyǒngjūn Jìnxíngqǔ) is the national anthem of the People's Republic of China (including the Hong Kong Special Administrative Region since July 1, 1997 and the Macau Special Administrative Region since December 20, 1999), written by the noted poet and playwright Tian Han with music ...
i'm joking for anyone who think i'm serious XD
You know how there's a comic strip where a dog is using a computer and says "on the internet, nobody knows you're a dog" - on the internet, nobody knows you're joking.
I'm sure nobody knows that you lack social skills as well (i geuss)
What a poetic way of passive aggressiveness
Maybe in the 90's internet
@solar plinth
Could you share me site that has almost all books(paid) for free to read and download
social credit lol ...
Guys, why do you talk about cats
every time I join
🤷
So a filter?
Not at all
This is your camera. This is your camera on LSD.
All are cars.
You can permute these infinitely.
If you go off a purely static image, then it will only define one or the other as label.
This one I agree with, but this one is literally searching for a matrix in a larger matrix. Object detection in general needs to learn what an object is before it can recognize it and circle it like above.
Case in point traffic detection.
You've got to like, man, align your chakras with the vibrations of the universe, man. Harmony is everywhere, you've just got to open your mind to it.
@subtle latch👋
@inner wyvern
Night.
I'm not going just yet.
Oh, okay.
Very welcome.
What chall workin on?
My suffocating sense of despair. 😁 👍
refining this
Aren't we all
Woah, that's really cool!
Prime numbers are cool, if I can fix it up a bit it'll be a whole new kind of computer vision which more aligns with pre-transformer methods.
@uncut sphinx👋
So they can't all be bangers out the gate, but I demonstrated potential for reading the light inside a monitor with my methods, refresh rate was incorrect and it may not be worth my time to develop. due to the prevalence of screen readers and the fact that they dont need transformers. Which is the problem Im working on reducing the need for.
The Hilbert curve (also known as the Hilbert space-filling curve) is a continuous fractal space-filling curve first described by the German mathematician David Hilbert in 1891, as a variant of the space-filling Peano curves discovered by Giuseppe Peano in 1890.
Because it is space-filling, its Hausdorff dimension is 2 (precisely, its image is th...
@pure wagon👋
What seems to be the problem? 🙂
actually we started a community to learn together
so we want learn all the programming languages in this community. Firstly wE want to start with python course
so can you plz share the notes or resources please broo.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
There's lots of good YouTube videos out there:
This is one course: https://www.youtube.com/watch?v=YYXdXT2l-Gg&list=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU
In this Python Beginner Tutorial, we will start with the basics of how to install and setup Python for Mac and Windows. We will also take a look at the interactive prompt, as well as creating and running our first script. Let's get started.
Mac Install: 1:25
Windows Install: 5:44
Installs Complete: 8:37
Watch the full Python Beginner Series he...
I apologize hehe.
!projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
with any programming languAGES
The MIT OCW 6.0001 is also really good.
@proper ridge I DIDN'T GET YOU BRO ,WHAT DOES IT MEAN
A lot of projects are language agnostic
6.0001 Introduction to Computer Science and Programming in Python is intended for students with little or no programming experience. It aims to provide students with an understanding of the role computation can play in solving problems and to help students, regardless of their major, feel justifiably confident of their ability to write small p...
I don't get what you mean.
If you want to make projects, you can do AI/ML, web development, or game development rather easily with python.
Electrocardiography is the process of producing an electrocardiogram (ECG or EKG), a recording of the heart's electrical activity through repeated cardiac cycles. It is an electrogram of the heart which is a graph of voltage versus time of the electrical activity of the heart using electrodes placed on the skin. These electrodes detect the small...
yeah thats what i want some already any existed projects with you
GitHub?
Just search whatever you like there.
Millions of projects.
i can't get it there
What do you mean?
i have already searched there>
What project do you want that's not on GitHub?
i want a project that should be work on real-time and like an any social media app
I don't know then. Sorry.
Did you look at Kindlings?
!projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
Tons of ideas in there
okay thank you bro
The first 60 prime gaps are:
1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, 14, 4, 6, 2, 10, 2, 6, 6, 4, 6, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 10, 6, 6, 6, 2, 6, 4, 2
The largest known prime number is 2136,279,841 − 1, a number which has 41,024,320 digits when written in the decimal system.
Gotta head to bed. Have a good one @inner wyvern and @frail yoke 👋
here
here
scrimmage
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
That will tell you what you need to know
it says
"You have sent less than 50 messages.
You have been active for fewer than 3 ten-minute blocks."
You have to meet both qualifications and then hit the Verify button
okkk
it's not too difficult! Just hang out in voice when you're feeling chatty and use the text chat to respond and you'll be verified in no time!
Texas city disaster (1947)
https://i.kym-cdn.com/entries/icons/facebook/000/032/613/Screen_Shot_2020-01-28_at_1.41.20_PM.jpg Caption: "A large boulder the size of a small boulder."
okay, looking through random sources, Ficus does indeed produce more oxygen than it consumes
for an average Amazon rainforest inhabitant (plant or otherwise), that is not true, allegedly
@tame leaf
meeeee
:3
... ah that's why the reaction from the bot
what bot
@ocean orbit
he likes love
@stuck bluff ScyllaDB?
Discord's backend is written mostly in Elixir[2] and Python,[3] as well as Rust,[4][5] Go, and C++.[6]```
there's a game I want to make but I have nowhere near the dedication necessary to accomplish that
based on idea of another person from years ago, the only thing I have from that idea is slides of a presentation of the concept
@bitter obsidian 👋
hii
@thin lintel no direct internet connection to the database, almost always
if it's a traditional RDBMS, especially so
presumably this is not a cloud solution
unless you're going cloud native, database really should be isolated
import dotenv
import os
dotenv.load_dotenv(override=True,dotenv_path="./secrets/.env")
class ApiConfig:
API_HOST = os.getenv("API_HOST")
API_PORT = int(os.getenv("API_PORT")) if os.getenv("API_PORT") else None
class ApiInfo:
NAME = "Gliders Development"
DEVICE_ID = "gliders-development"
VERSION = "1.0.0"
DESCRIPTION = "Gliders Development created by @github.com/adnanbinpulok"
STATUS = "debug" # or live
class DatabaseConfig:
HOST = os.getenv("DATABASE_HOST")
PORT = int(os.getenv("DATABASE_PORT")) if os.getenv("DATABASE_PORT") else None
USER = os.getenv("DATABASE_USER")
PASSWORD = os.getenv("DATABASE_PASSWORD")
DATABASE = os.getenv("DATABASE_NAME")
POOL = int(os.getenv("DATABASE_POOL")) if os.getenv("DATABASE_POOL") else None
class StorageConfig:
IMAGE_UPLOAD_SERVER_URL = os.getenv("IMAGE_UPLOAD_SERVER_URL")
IMAGE_UPLOAD_SERVER_KEY = os.getenv("IMAGE_UPLOAD_SERVER_KEY")
TIMEOUT = 60
Guys, so...
I came up with this really neat idea...
It's called a wheel.
It's round, and it helps things move from one place to another place.
I think it'll really take off.
take off
no, that's a rocket you're thinking of
The mention of that creature's name in a positive slant is distasteful.
How do we get good at things?
By doing things a lot, even if we're bad at them.

@knotty fog What did those objects ever do to you?
Not loud.
Present.
If you're doing datetime stuff, are you parsing time?
The other one.
Mm.
Just remember: It's all downhill from here.
@sacred sigil 👋
I have to do my homework now 😭
Very well.
i havent unlocked voice or something
!voice
ya ya
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
I was afk
Lol
what are people working on atm then?
Are these things ok for me ? Im 15 and i work with so much geometry
Some ppl dont even know hot to use cos sin i know how to make them work im a game
Idk
I know how to use them. Don't ask me to make them.
Its gonna be we gonna learn that in second year im first
i mean its maths, like if you understand the motive it kinda is enough
yah but they are kinda usefull
wide range of knowledge is good
rather than super focused
Yea
My language class (you know you have english, hindi, chinese ....) , biology, math prob
Oh
i mean other languages are usefull
Those are great but i dont wana learn now cuz i just wana use my extra time onbthe game. Anyway give me a suggestion plz
.
maths is always pog
Ye
And history
Btw no
history is good but i hate it personally
Same XD
you get a good idea of why things happened and continue to happen like middle east stuff
polotics and the sort
biology is just applied physics
lol
why so focused on making a game?
Better then nothing
how much python do you know?
i dunno, pythong is like super usefull at making tools
pygame i assume?
you made a git?
Cpp is much faster
I upload my games on umm itch.io
I have made one game and one program
The game is 1500 lines
itch doesnt have source code?
And the program 300
No
Git lab?
like git in general is something that will make your future programming better
ya git lab
Idk what is git lab
its like github but different
git is the name of the tool for version managing
git hub is the place most people upload thier git repositorys so its public
The last thing i have learned is how to use json files
@steel gate @gaunt steeple 👋
Yea
yeah can be nice.
pickl is quicker
Idk baut that
its a python thing to save state
like you can pickle a numpy array and it saves it to a file in a nice way that is quicker to read from
Soooo GPT told me to use json lmao
Thats why i leanrt json
it is awfull
Not that bad
it is alright yeah
but its one of many ways to save state
ill be honest guy i wanna get 50 messages in this chat and then i am shooting off to play farming sim
say that again @midnight meadow ?
Nice
Some relaxing stuff
Bye
what is your homework tho
I have to study
for what
And presentayoon
about ?
How old are u?
Lucky
yeah i wont friend you, you sound young and that is not a good look
just need 50 messages in here init
@silent torrent wording.
@fast cape you can just copy the value instead of changing the type I think
ECMAScript
you can just say that instead
?
we're trying to avoid ableist language on this server
since JavaScript™️ is Oracle®️ trademark
tis a public server
its not like im referring to a person though
okay that seems to be wrong, at least in Chrome
I thought there was an option to do that
Let's say you had a certain trait. Whatever trait that was. And let's say I started using a reference to that trait in a derogatory way. Not about any persons, no, I just called things I didn't like the thing that you have. Would that be cool with you?
@sly pond balanced not binary
i mean yeah i dont really care how people think about me it only matters if im not a crappy person
wait lemme rephrase that
wait actually idk how im gonna rephrase that nvm
@silent torrent its also a private server in the sense that they get to choose there own rules there is no freedom of speech in servers where the owners decide rules, you follow them or they can kick u its its simple, you dont need to agree with the rules yourself but do realize the rules exist for a reason
fair
@fast cape index also should have everything you're fetching not only the key you're fetching by
in many cases
MDN
and you're going to have to learn DOM rather than ES
@fast cape if you want C#+Web, Blazor.
without extra data, needs extra traversal
indexes are created for specific queries
I assume everyone knowing what an index is knows it takes space
if you want single row, you can drop that extra data
if you want to query a range, you need to duplicate everything the query wants
otherwise query planner will rightfully decide that cost of looking up each row outweighs everything and will just scan instead
(you already know that, I'd expect, I'm just adding context)
I've seen the query planner be totally wrong repeatedly even when the table stays the same
the more weird thing happens in the query => the less accurate the estimates
postgres still doesn't want to understand that 6-table join
yeah, it's not for repeated queries
(I know; but we have requirements, that's why RDBMS)
it's not constantly running
900 rows in 1.5ms is fine
as for mongo, I don't want to deploy this cursed technology again
especially on near-embedded CPUs
mongo does not support a somewhat wide range of CPUs
for operational characteristics, I'd rather use DocumentDB
!stream 455720889196216331
✅ @fast cape can now stream until <t:1739035565:f>.
I think somewhere here it's said to actually define _id manually instead of letting it auto-fill
https://youtu.be/eEENrNKxCdw
@sly pond it's a bit more difficult to index and query JSON values in postgres
you can just reimplement mongo on top of postgres, see documentdb
and ferretdb, which uses documentdb on the inside and looks like mongo on the outside
This a single JSON being updated every other connection update
6 GB of concurrent keep alive session from 5k devices
@fast cape float rounding is a JSON issue not Mongo issue
for proper big ints you need strings
(in standard JSON)
i see
iirc MongoDB is no longer open-source, just source-available
with their own whatever BSL thing
ohno
I wonder if sqlx understand stored procedures' types
(the crate)
for writing queries outside the database it's quite a great tool
@misty sinew instead of constantly interrupting other users, wait until they stop speaking, please
thanks for mentioning it 😄
im a good guy bro
lol @delicate wren
"idk who you're talking to, since I'm not a bro"
😘 no problem
what u are then
@brisk lark borsch
only a letter off
!tvmute 1304950534012403773 1d trolling and baseless hostility in VC is not welcome
:incoming_envelope: :ok_hand: applied voice mute to @misty sinew until <t:1739123942:f> (1 day).
try changing your resolution
It looks weird
I founding something on chatgpt
using Microsoft.AspNetCore.Mvc;
public class HomeController : Controller
{
public IActionResult Index()
{
// Example: Set the Data Saving Mode to 'true' (enabled)
Response.Cookies.Append("DataSavingMode", "true", new CookieOptions { HttpOnly = true });
return View();
}
}
@{
var dataSavingMode = Context.Request.Cookies["DataSavingMode"];
bool isDataSavingEnabled = dataSavingMode == "true";
}
<h1>Welcome to the Website</h1>
@if (!isDataSavingEnabled)
{
<script src="https://example.com/script.js"></script>
}
else
{
<p>Data Saving Mode is ON. JavaScript is not loaded.</p>
}
@stuck bluff hey there
they sound good
i heard you stop at 20
alright, i don't mind waiting
its just a little inconvenient to write out all of my messages lol
yeah, that's a fair requirement, i understand
so anyway, i'm very new to learning python, i'm taking an intro to python course with my local college
runestone academy makes up 90% of the studying materials we're given
and we have problem sets each week where we're required to write code for specific things
i was looking for some help with understanding my latest problem set, but its a bit hard without access to screenshare
!code
no, how do i type a backtick?
print("Hello there")
oh, hold on
interesting, thank you
In the cell below, write code that iterates over the string myStr and does the following:
Print each character.
Count the number of characters and stores the result the variable cntChars. Do not use any functions to count.
Print the variable myStr and cntChars with an appropriate label as shown below in Expected Output.
Expected Output:
M
I
C
H
I
G
A
N
The number of characters in MICHIGAN is 8
okay, i need to write code for this. i haven't fully finished the required units in runestone academy, which would be a good place to start, but i wanted help in understanding what they're looking for.
the given code so far is just myStr = "MICHIGAN"
🙂↕️
thank you, i can see that you have a deep understanding of python
that's a good way to think about it, it's hard to understand something that exists outside of every day experience
!e py a = 0 print(a) a = a + 1 print(a) a += 1 print(a)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
yeah
yeah
i used a for loop in the last problem set
for _ in range(8), etc
i saw that a bit, you don't need to assign _
i was wondering how that variable just appeared, but i guess you're creating it with the for command
!e py for letter in 'abc': print(letter)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | a
002 | b
003 | c
!e py letter = 'a' print(letter) letter = 'b' print(letter) letter = 'c' print(letter)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | a
002 | b
003 | c
so it's just:
myStr = "MICHIGAN"
cntChars = 0
for char in myStr:
print(char)
cntChars += 1
print("The number of characters in", myStr, "is", cntChars)
oh my bad
so i should use another variable bc _ is typically meant to be not used again?
right
okay
how does it know to go through each character once, lol
and then i should add in another command that will add 1 to a variable each time the loop iterates?
does that look good?
!e py 'abc' + 123
:x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | 'abc' + 123
004 | ~~~~~~^~~~~
005 | TypeError: can only concatenate str (not "int") to str
like i just did?
!e py 'abc' + '123'
:warning: Your 3.12 eval job has completed with return code 0.
[No output]
ah okay
:white_check_mark: Your 3.12 eval job has completed with return code 0.
abc123
hello @vast veldt
!e py age = 17 name = 'Peter' print('Hello, ' + name + '. You are ' + age + ' years old.')
:x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 3, in <module>
003 | print('Hello, ' + name + '. You are ' + age + ' years old.')
004 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
005 | TypeError: can only concatenate str (not "int") to str
!e py age = 17 name = 'Peter' print('Hello, ' + name + '. You are ' + str(age) + ' years old.')
:white_check_mark: Your 3.12 eval job has completed with return code 0.
Hello, Peter. You are 17 years old.
so you're making the intiger into a string in order to concatenate all of the variables as strings?
bc python doesnt like to concatenate different forms, okay
You mean toString()?
!e py age = 17 name = 'Peter' print(f'Hello, {name}. You are {age} years old.')
:white_check_mark: Your 3.12 eval job has completed with return code 0.
Hello, Peter. You are 17 years old.
huh, interesting
Concatenation is property of string, it only implies to string
!e py age = 17 name = 'Peter' print('Hello, {name}. You are {age} years old.')
So one has to convert to string to use concatenation
:white_check_mark: Your 3.12 eval job has completed with return code 0.
Hello, {name}. You are {age} years old.
that is a lot better
i'm required to only use syntax that we've covered in runestone academy, unfortunately
i prefer that a lot, though
no, definitely.
i do enjoy the creative problem solving element of these assignments
correction you forget to use f
Problem 2
In the cell below, write one loop that iterates over the list mixedList and does the following:
- Prints each element and the element type.
- Count the number of elements and store the result in the variable cntList. Do not use any function to count.
- Print cntList preceded by an appropriate label as shown below.
!e
age = 17
name = 'Peter'
print(f'Hello, {name}. You are {age} years old.')
:white_check_mark: Your 3.12 eval job has completed with return code 0.
Hello, Peter. You are 17 years old.
the given code is
mixedList = ["hello", 2, 4, 6.0, 7.5, 234352354, "the end", "", 99]
Array and list are same in python?
Expected Output:
hello
2 < class 'int'>
4 < class 'int'>
6.0 < class 'float'>
7.5 < class 'float'>
234352354 < class 'int'>
the end < class 'str'>
< class 'str'>
99 < class 'int'>
The number of elements in the list is 9
mixedList = ["hello", 2, 4, 6.0, 7.5, 234352354, "the end", "", 99]
cntList = 0
for element in mixedList:
print(element, type(element))
cntList += 1
print("The number of elements in the list is", cntList)
!d array.array
class array.array(typecode[, initializer])```
A new array whose items are restricted by *typecode*, and initialized from the optional *initializer* value, which must be a [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes) or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray) object, a Unicode string, or iterable over elements of the appropriate type.
If given a [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes) or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray) object, the initializer is passed to the new array’s [`frombytes()`](https://docs.python.org/3/library/array.html#array.array.frombytes) method; if given a Unicode string, the initializer is passed to the [`fromunicode()`](https://docs.python.org/3/library/array.html#array.array.fromunicode) method; otherwise, the initializer’s iterator is passed to the [`extend()`](https://docs.python.org/3/library/array.html#array.array.extend) method to add initial items to the array.
Yes, one has to import it
type* my bad
Damn, your awake
I have been learning python alongside javascript and my mind mixing syntax
@long warren How do you learn python?
runestone academy
its a free online tool that was given to me via my local college
Learn from official docs or books
i'm required to use runestone academy lol
use it but don't limit yourself
i will
sorry, on a diff tab looking at the next problem
basically the start of lists and modules
split commands
Well I found my interest in programming, when I got introduced to java and it's OOPs
slice*
Problem 3
Write code that iterates over to the string sentence and does the following:
- Count the number of characters using the variable numChars.
- Count the number of vowels using the variable numVowels. A character is a vowel if it is a member of the tuple vowels.
- Print the variables numChars and numVowels preceded by appropriate labels as shown below.
Do NOT use the a function to solve the problem. You may use the len function on the string to confirm the your answer is correct.
given code:
sentence = "The quick brown rhino jumped over the extremely lazy fox."
vowels = ('a','e','i','o','u')
Expected Output:
The number of characters is 57
The number of vowels is 16
the first part is easy, it's what i've been doing
numChars = 0
for char in sentence:
numChars += 1
print("The number of characters is", numChars)
not allowed to use print, extra difficult mode 😭
need to write a function?
can i just do "for vowel in sentence"?
!e
numChars = 0
for char in sentence:
numChars += 1
print("The number of characters is", numChars)
:x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 2, in <module>
003 | for char in sentence:
004 | ^^^^^^^^
005 | NameError: name 'sentence' is not defined
(it will indeed be 57, I checked)
!e
numChars = 0
for char in numChars:
numChars += 1
print("The number of characters is", numChars)
!e py print('a' in 'abc') print('d' in 'abc')
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | True
002 | False
@stuck bluff you mentioned variable name casing issue already, right?
numChars = 0
numVowels = 0
for char in sentence:
numChars += 1
for vowels in sentence:
numVowels += 1
print("The number of characters is", numChars)
print("The number of vowels is", numVowels)
well this doesn't work lol
!e
sentence = "Hello, World!" # Example string (can be replaced with any input string)
vowels = ('a', 'e', 'i', 'o', 'u')
numChars = 0
numVowels = 0
for char in sentence:
numChars += 1
if char.lower() in vowels: # Case-insensitive check
numVowels += 1
print("Number of characters:", numChars)
print("Number of vowels:", numVowels)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | Number of characters: 13
002 | Number of vowels: 3
so how would i check if each character is a member of the tuple vowels and set that to tick the variable numVowels by 1?
ah, i see
i haven't seen if commands yet
@stuck bluff I have a terrible idea of how to go around that, which I shall not describe
I wonder what's the goal of course?
Why make things tricky which doesn't teach programming but it's increases the step
yes
i can likely use an "in" command
in is keyword
i haven't finished chapter 9 yet, it could be there
command are name or call for executable files
Hmm
ooh, hold on
we're showed how to use if inside of a boolean expression lol
yes
it was just hidden inside of this chapter
!e py if True: print('A')``````py if False: print('B')
:white_check_mark: Your 3.12 eval job has completed with return code 0.
A
!e
sentence = "Dumb Academy!"
vowels = ('a', 'e', 'i', 'o', 'u')
numChars = 0
numVowels = 0
for char in sentence:
numChars += 1
numVowels += vowels.count(char.lower())
print("Number of characters:", numChars)
print("Number of vowels:", numVowels)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | Number of characters: 13
002 | Number of vowels: 4
if condition: # Exactly one if
'Do this.'
elif some_other_condition: # Else if. Zero or more elifs
'Do this instead'
else: # If none of the above. Zero or one else.
'Do this.'```In this order.
your mic turned really fuzzy all of a sudden
could be my computer
still fuzzy for me
@stuck bluff sound works okay
and print is function, so you can't even print
They are very specific with no usage of any kind of function?
hmm, i think its my laptop
now i can't hear anything lol
let me download the app, i'm using the web version 😭
web version ain't good
yeah, i just hate how the app loads at startup and the notifications never go away
Hmm
i know theres settings to get rid of it, but i'm too lazy
@long warren Are you sure that you can't use any kind of function?
As print itself is function!!
should be good
Hmm
I guess this is solution to your problem
You just have to replace the names of variable
@stuck bluff Now it's much better
working great! @stuck bluff
yes
could even be a networking issue
I guess mic quality ain't good
Do you use nvidia broadcast
it would make it much better
Hmm
I see
No problem take your time
@long warren What's the next problem buddy?
i haven't finished problem 3
Is Opal audible to you?
Damn
it's much much better
sounds as if you are next to me
how would i use if and in to check if a character is in the tuple "vowels"?
.
in
I guess you do know how
character in my_tuple``` or something along those lines will give you a `True` or `False`.
Which you can plug into if.
if char.lower() in vowels: # With if
numVowels += 1
for char in sentence:
numChars += 1
numVowels += vowels.count(char.lower()) # Without if
hmm
OH
i got it
sentence = "The quick brown rhino jumped over the extremely lazy fox."
vowels = ('a','e','i','o','u')
# Write your code below.
numChars = 0
numVowels = 0
for char in sentence:
numChars += 1
if char in vowels:
numVowels += 1
print("The number of characters is", numChars)
print("The number of vowels is", numVowels)
i was using "_" instead of "char" for the left side of the if/in command
if and in are examples of what are called keywords.
Problem 4
Write code in the cell below that does the following:
- Create a list called words from the words in the string sentence.
Iterate over words - Add to a list called wordLens which contains the length of the current word.
Count the current word using the variable numWords. Do not use a function. - Print the word and the word length.
- Print numWords as shown in expected output.
- Print the list wordLens.
You need one loop to solve this problem. You may use the len and split functions.
given code:
sentence = "The quick brown rhino jumped over the extremely lazy fox"
# Write your code below.
- same as before
Expected Output:
The 3
quick 5
brown 5
rhino 5
jumped 6
over 4
the 3
extremely 9
lazy 4
fox 3
Number of words is 10
[3, 5, 5, 5, 6, 4, 3, 9, 4, 3]
split command to make a list from the string?
@long warren write a solution code for the problem, and share here
!d str.split
str.split(sep=None, maxsplit=-1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).
If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters as a single delimiter (to split with multiple delimiters, use [`re.split()`](https://docs.python.org/3/library/re.html#re.split)). Splitting an empty string with a specified separator returns `['']`.
For example:
This is probably what they want you to use.
i have the last bit
You can use help() and dir() to know more about str, etc.
sentence = "The quick brown rhino jumped over the extremely lazy fox"
words = sentence.split()
wordLens = [0]
numWords = 0
for char in words:
if char in words:
numWords += 1
print("Number of words is", numWords)
print(wordLens)
i only have the way to count each element of the list
not the way to count each character of each element
Opal ain't here?
hi
It happens
Maybe it could be compatibility issue
how in the world do i count each character of a word thats found in a list?
You can nest loops.
so i broke each word in the str into a list:
sentence = "The quick brown rhino jumped over the extremely lazy fox"
words = sentence.split()
so i use another for loop inside of the first? but how to i refer to each element of the list without going 1 by 1
hmm, i need to print the actual word followed by the word length
I don't believe they intend for you to use the len function to do this.
for word in ...:
for ... in ...:
...```
Hmm
Hmm?
idk how to feed these numbers back into my new list though
sentence = "The quick brown rhino jumped over the extremely lazy fox"
words = sentence.split()
wordLens = [0]
numWords = 0
for char in words:
print(char, len(char))
if char in words:
numWords += 1
print("Number of words is", numWords)
print(wordLens)
oh i got it
It is logically correct but doesn't make sense to me
sentence = "The quick brown rhino jumped over the extremely lazy fox"
words = sentence.split()
wordLens = []
numWords = 0
for char in words:
print(char, len(char))
wordLens += [len(char)]
if char in words:
numWords += 1
print("Number of words is", numWords)
print(wordLens)
i don't know, i just try something until it works 😭
Hmm
how would you write it?
Okay
sentence = "The quick brown rhino jumped over the extremely lazy fox"
words = sentence.split()
wordLens = []
numWords = 0
# Iterate over each word in the list
for word in words:
numWords += 1
wordLens.append(len(word))
print("Number of words is", numWords)
print("Length of each word:", wordLens)
oh you're right
that if statement is uneccesary
removing it didn't change the code
result*
output*
Well if is used in condition
that was a bit more difficult ngl
Problem 5
The string addStr contains list of numbers separated by the plus sign. Write code that uses an accumulation pattern to take the sum of all numbers and assigns it to the variable sumVal. Print the variable sumVal prefixed by an appropriate label.
You may use the split function to split by "+" and int function to cast to an integer.
given code:
addStr = "2+5+10+20+15+37"
# Write your code below.
Expected Output:
The total of all numbers is 89
okay i split at the +
formed a new list from the pieces
yes
they are all numbers
i took out the + with split
i formed a new list
being all strings of numbers
yes
Hmm
I thought you meant using original list while turning it into integer
my bad
idk why its not working
show me code
addStr = "2+5+10+20+15+37"
lst = addStr.split("+")
print(lst)
for num in lst:
num = int(num)
print(lst)
am i missing something obvious?
its still printing a list of strings
I mean did you spot your mistake
addStr = "2+5+10+20+15+37"
lst = addStr.split("+")
print(lst)
sumofall = 0
for num in lst:
sumofall += int(num)
print(lst)
print("sum of all: " + str(sumofall))
ah okay let me try that
num is iterator
@stuck bluff I have a thing to show
slight changes to rendering of the image generation
hmm?
probably the easiest option would be to show on-stream
Okay
addStr = "2+5+10+20+15+37"
lst = addStr.split("+")
sumVal = 0
for num in lst:
sumVal += int(num)
print("The total of all numbers is", sumVal)
got it, thanks
You can't assign iterator within loop, logically you can but you should not in this context
I can finally see it update in more or less real time
it's WASM
WASM?
i don't know what that vocab term means, but it looks great
I wonder how many hours until the funny phase kicks in
Your voice is magical
we got a BIG one for problem 6 lol
Problem 6
The string weekTemps contains a comma-separated list of fahrenheit temperatures. Write code that does the following:
Finds the minimum temperature in fahrenheit and stores the result in minTempF.
Computes the average temperature in fahrenheit and stores the result in avgTempF.
Convert the minimum and average temperature in fahrenheit to celsius and stores the results in minTempC and avgTempC respectively. Do not hard code your answer. This means that your code must compute both the total of all temperatures and the number of temperatures in weekTemps.
Do the following:
Split the string on ',' and store the resultant list in a variable
Iterate over that variable:
Apply a count pattern to count the number of temps.
Apply an accumulation pattern to total the temperature values.
if the current temperature is smaller than minTempF:
Replace the contents of minTempF with the current temperature.
Compute the average temperature and store the result in avgTempF.
Print avgTempF and minTempF as shown in the expected output. Note, you will do some additional work to produce the expected output.
Convert avgTempF to celsius and store the result in avgTempC.
Convert minTempF to celsius and store the result in minTempC.
Print both variables as shown in the expected output.
The average temperature is defined as the total of all temperatures divided by the number of temperatures.
To convert from fahrenheit: temperature in celsius = (temperature in fahrenheit - 32) * 5/9.
You need to use one loop to solve this problem. You may use the split, float, and round functions.
given code:
weekTemps = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
# Write your code below.
Expected Output:
The average temperature is 80.67F 27.04C
The minimum temperature is 75.1F 23.94C
also it's technically leaking memory but that shouldn't matter much
@drowsy sphinx@warped moss👋
the spice code must flow compute
i got some of it
weekTemps = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
lst = weekTemps.split(",")
tempcount = 0
tempsum = 0
for temp in lst:
tempcount += 1
tempsum += float(temp)
print(tempcount)
print(tempsum)
got the sum of temps and the count of temps
basically what i just did
i'm supposed to use one loop function for this, so let's see what i can do
!e py print(5 < 6) print(6 < 6)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | True
002 | False
okay
Greater than >
<= less than or equal to
= greater than or equal to
== equal to
Absolute zero is the lowest limit of the thermodynamic temperature scale; a state at which the enthalpy and entropy of a cooled ideal gas reach their minimum value. The fundamental particles of nature have minimum vibrational motion, retaining only quantum mechanical, zero-point energy-induced particle motion. The theoretical temperature is dete...
Ignore that, actually.
if tempcount == 0?
min can start with infinity?
mintemp = float('inf')
okay
hmm
weekTemps = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
lst = weekTemps.split(",")
tempcount = 0
tempsum = 0
minTempF = 100.0
for temp in lst:
tempcount += 1
tempsum += float(temp)
if float(temp) < float(minTempF):
minTempF = temp
print(tempcount)
print(tempsum)
print(minTempF)
i got a way to print the min temp in the list
@stuck bluff average is printed before minimum, it's going to /0
oh wait the generation stopped I think
I did not brain
Idk what it is but it’s beautiful
it took me some time to realise why the green waved crashed against a barrier there
the holes in the pattern are directly related to that
that area is of low speed, and everything blending into it slows down too
Opal left?
what's the issue?
It needs to fit within a certain line limit
codegolfing?
See the light column ruler in the very right? How do I make it so the code fits in the left of the ruler
option 1: separate the statement into multiple lines
option 2: refactor the code into separate variables/functions/etc.
option 1 is trivially achievable with an autoformatter
!e
a = (
1
+
2
)
b = 3 \
+ \
4
print(a, b)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
3 7
either parentheses or backslash
parentheses is what black puts I think, and backslash is what PyCharm might prefer, I don't remember
weekTemps = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
lst = weekTemps.split(",")
tempcount = 0
tempsum = 0
minTempF = 100.0
avgTempF = 0
for temp in lst:
tempcount += 1
tempsum += float(temp)
if float(temp) < float(minTempF):
minTempF = temp
avgTempF = float(tempsum) / len(lst)
print("The minimum temperature is", minTempF, "F")
print("The average temperature is", avgTempF, "F")
i've gotten the average in fareignheit, although the figure is a very long float
Ty Alisa!
how would i use round to cut that number down to 2 decimal places?
!d round
round(number, ndigits=None)```
Return *number* rounded to *ndigits* precision after the decimal point. If *ndigits* is omitted or is `None`, it returns the nearest integer to its input.
For the built-in types supporting [`round()`](https://docs.python.org/3/library/functions.html#round), values are rounded to the closest multiple of 10 to the power minus *ndigits*; if two multiples are equally close, rounding is done toward the even choice (so, for example, both `round(0.5)` and `round(-0.5)` are `0`, and `round(1.5)` is `2`). Any integer value is valid for *ndigits* (positive, zero, or negative). The return value is an integer if *ndigits* is omitted or `None`. Otherwise, the return value has the same type as *number*.
For a general Python object `number`, `round` delegates to `number.__round__`.
the function mentioned in the problem statement
hmm
use round()
got it
avgTempF = round(float(tempsum) / len(lst), ndigits = 2)
bro is in the next universe
he is high above his imagination
😂
Did it worked?
yeah it worked
Well the best way to use print statement in above program would be like this
i now have the average and the minimum in the form i need
i just need to convert both to celcius
celcious
what the fuck
celsius
"Kelvin, slightly offset"
minTemF = 0
avgTempF = 0
print(f"the minimum tempereature is {minTempf}F")
print(f"the average temperature is {round(avgTempF}F")
f""
do you know how to convert in celcius?
AHHAHAHAHA
does Discord's python highlighting in editor still break when -> is used 
weekTemps = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
lst = weekTemps.split(",")
tempcount = 0
tempsum = 0
minTempF = 100.0
avgTempF = 0
for temp in lst:
tempcount += 1
tempsum += float(temp)
if float(temp) < float(minTempF):
minTempF = temp
avgTempF = round(float(tempsum) / tempcount, ndigits = 2)
avgTempC = round((float(avgTempF) - 32) * 5/9, ndigits=2)
minTempC = round((float(minTempF) - 32) * 5/9, ndigits=2)
print(f"The average temperature is {avgTempF}F {avgTempC}C")
print(f"The minimum temperature is {minTempF}F {minTempC}C")
lets goooo
my bad
seems like they fixed it
i used that conditional print statement bc the required output had no space between the number and the unit
i didn't know how to do that with a print("blah blah blah", number, "blah blah blah") statement
Discord's editor parser/render and message parser/render used to be more different in how they treated Python code blocks
-> therefore used to ruin in-editor syntax colours completely
how does my code look? anything to clean up?
making midTempF = 100 seems kinda lazy but it works
ndigits=2 instead of ndigits = 2, convention for keyword argument styling
ah, i see
tempcount doesn't seem to be used
you don't need to call float, it'll turn into a float automatically when used with /
in last three cases
oh, wait
why are you storing temp as a string?
i should have used tempcount with the average
you should convert it to float exactly once, and use that
I suppose he ain't allowed to use len()
(that's why I'm mentioning tempcount)
Yes
something like
for temp_string in lst:
temp = float(temp_string)
...
i got the correct output, yeah
okay it was less than an hour;
but now that it's in its phase of almost being a fluid simulation, it's painfully slow
there's 10 total
so, in the instructions, it says "You need to use one loop to solve this problem. You may use the split, float, and round functions."
did i break that rule about the one loop
ask checkmate he is good at it
@tawny lily ?
there is only one loop currently
i just meant bc i included some stuff after the loop
I guess implicit loop inside .split and others doesn't count
there is almost no option to do that without things after the loop
weekTemps = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
lst = weekTemps.split(",")
tempcount = 0
tempsum = 0
minTempF = 100.0
avgTempF = 0
for temp in lst:
temp = float(temp)
tempcount += 1
tempsum += temp
if temp < minTempF:
minTempF = temp
avgTempF = round(tempsum / tempcount, ndigits = 2)
avgTempC = round(((avgTempF) - 32) * 5/9, ndigits=2)
minTempC = round(((minTempF) - 32) * 5/9, ndigits=2)
print(f"The average temperature is {avgTempF}F {avgTempC}C")
print(f"The minimum temperature is {minTempF}F {minTempC}C")
are all of the floats cleaned up?
NOOOO it restarted?
i was so invested
okay, problem 7:
Problem 7
The variable rainfallMI is a string of comma-separated values. Each value is the monthly average rainfall in inches for Michigan. Write code that does the following:
Compute the number of months that have more than 3 inches of rainfall. Store the result in the variable numRainyMonths.
Compute the total rainfall for all months. Store the result in the variable totRainfall.
Find the maximum rainfail and store it in maxRain.
Do the following:
Split the string on ',' and store the resultant list in a variable
Iterate over that variable:
Apply an accumulation pattern to total the rainfallstoring the result in totRainfall.
if the rainfall for the month is more than 3 inches:
Apply a count pattern storing the result in numRainyMonths.
If the rainfall is larger than maxRain:
Replace the contents of maxRain with the current rainfall.
Print the variables numRainyMonths, and maxRain with the appropriate label as shown below.
given code:
rainfallMI = "1.65, 1.46, 2.05, 3.03, 3.35, 3.46, 2.83, 3.23, 3.5, 2.52, 2.8, 1.85"
# Write your code below.
Expected Output:
There are 5 months with more than 3 inches of rain
Total rainfall for all months is 31.73
The maximum rainfall is 3.5
what's the issue?
it is not related to programming
Gotta go bye
I just installed ubuntu in my laptop and I was trying to install cisco packet tracer but for some reasons I can't install it, it shows some errors. I tried chatgpt but nothing usefull. I am using Ubuntu 24.04.1 LTS but the cisco website says that It can only run on Ubuntu (20.04, 22.04) LTS operating system, is there any way to install it?
sudo dpkg -i Packet_Tracer822_amd64_signed.deb
Selecting previously unselected package packettracer.
(Reading database ... 149071 files and directories currently installed.)
Preparing to unpack Packet_Tracer822_amd64_signed.deb ...
Unpacking packettracer (8.2.2) ...
dpkg: dependency problems prevent configuration of packettracer:
packettracer depends on dialog; however:
Package dialog is not installed.
packettracer depends on libgl1-mesa-glx; however:
Package libgl1-mesa-glx is not installed.
packettracer depends on libxcb-xinerama0-dev; however:
Package libxcb-xinerama0-dev is not installed.
dpkg: error processing package packettracer (--install):
dependency problems - leaving unconfigured
Processing triggers for shared-mime-info (2.4-4) ...
Errors were encountered while processing:
packettracer
it might require running a --privileged container
I have no idea what that is.
do you know what Docker is?
also you might just need to install what it says to be missing
apt-get update
apt-get install -y dialog libgl1-mesa-glx libxcb-xinerama0-dev
have you tried doing this yet?
lol
were those packages successfully installed?
yes
also have you tried
sudo apt-get install -y ./Packet_Tracer822_amd64_signed.deb
?
yes
can you run this right now and show the output?
ok
hello
@inner wyvern isn't it? it's been doing some crazy stuff
@delicate wren restarted it when it was making spirals 😭
OOH
oh it was a new page
is it a random shape each time?
I have no idea what you're actually installing, idk how to test it myself
ah
I'm not aware of the exact page it's downloaded from
sudo dpkg -i Packet_Tracer822_amd64_signed.deb
dpkg: error: cannot access archive 'Packet_Tracer822_amd64_signed.deb': No such file or directory
I don't know what the heck I was doing with chatgpt
I am confused myseld now
can you send the link the package is downloaded from?
rainfallMI = "1.65, 1.46, 2.05, 3.03, 3.35, 3.46, 2.83, 3.23, 3.5, 2.52, 2.8, 1.85"
# Write your code below.
numRainyMonths = 0
totRainfall = 0
maxRain = 0
lst = rainfallMI.split(',')
for rainfall in lst:
rainfall = float(rainfall)
totRainfall += rainfall
if rainfall > maxRain:
maxRain = rainfall
if rainfall > 3:
numRainyMonths += 1
print("There are", numRainyMonths, "months with more than 3 inches of rain")
print("Total rainfall for all months is", totRainfall)
print("The maximum rainfall is", maxRain)
i did it
hmm
I have no idea if that tool is actually publicly licensed for use
very weird
if I install it in windows, it works perfectly fine
but showing some error while installing in ubuntu
Problem 8
The variable sentence stores a string of words. Write code that does the following:
Compute the number of words that begin and end with the same letter including one-letter words. Store the result in the variable sameLetterCount.
Compute that number of words that contain an "f" or a "k". Store the result in the variable fkCount.
Do the following:
Split the sentence into words storing the result in a variable.
Iterate over the variable:
If the first character of the word is equal to the last letter of the word:
Apply a count pattern using the variable sameLetterCount.
If the word contains an "f" or a "k":
Apply a count pattern using the variable fkCount.
Print the variables sameLetterCount and fkCount as shown below.
You may use the split method, the in operator to test for the existence of an "f" or "k", the or operator to join the logical expressions when testing for the existence of the letters.
given code:
sentence = "students flock to the arb for a variety of outdoor activities such as jogging and picnicking"
# write your code below
Expected Output:
There are 2 words that begin and end with the same letter
There are 4 words that contain f or k
I'll let the generation run for a while
lovely
in should stop in approximately 5 hours
I'll record a new one from start
so it's saved in its entirety
whoah, how in the world do i do this one
yeah, that was quite something @inner wyvern
i have no idea how it works, but i feel glad to have seen it
do you know how i could check a list of strings for words that have matching first and last characters?
sentence = "students flock to the arb for a variety of outdoor activities such as jogging and picnicking"
words = sentence.split()
fkCount = 0
for letters in words:
print(letters)
if "f" or "k" in letters:
fkCount += 1
print(fkCount)
here's what i got now
for some reason my fkCount variable is outputting 16 instead of the required 4
am i using the or command wrong?
i got it by putting the ("f" or "k") in parantheses