#Built-in functions in Python
Explore tagged Tumblr posts
trendingnow3-blog · 2 years ago
Text
Day-6: Python Functions
Day-6: Python Fuctions - Python Boot Camp 2023
Introduction to Python functions Python functions are blocks of reusable code designed to perform specific tasks. They allow you to break down complex programs into smaller, manageable pieces. Functions enhance code reusability and readability, making it easier for developers to maintain and understand their programs. In this article, we will explore various aspects of Python functions, from…
Tumblr media
View On WordPress
0 notes
msharkness · 4 months ago
Text
i've spent 1.5 years studying and achieving a level of C/C++ literacy to go to a class, which is really cool, basis of machine learning and genetic based algorithms and i am a sucker for biology but we're applying those in python. what sucks is that now my brain and hands literally itch to put semicolons and curly brackets and indent the code to my needs and implement methods and functions when python doesn't even use those :( and now i can do more powerful things but the code looks like we've just discovered how to paint caves with our fingers
4 notes · View notes
amalgjose · 9 months ago
Text
Python built-in function round() not working in Databricks notebook
This is common issue that developers face while working on pyspark. This issue will happen if you import all functions pyspark. This issue will happen with several other built-in functions in python. There are several functions that shares the same name between the functions in python builtins and pyspark functions. Always be careful while doing the following import from pyspark.sql.functions…
0 notes
wuggen · 1 year ago
Note
I have heard tell of Julia but I've never used it. On a quick glance I'm seeing (a) 1-based array indexing, (b) significant whitespace, and (c) implicit mutable aliasing, so probably fuck this language, it doesn't deserve the name
what is the hipster's interpreted imperative programming language, like... what's the 'you know, you should really rewrite your python lib in xyz, it's the python and nodejs killer for real.’
Maybe Julia? At the very least, I knew many people in grad school who loudly evangelized for replacing R and Python with Julia.
oh yeah ive heard of that. (also @wuggen i need your opinion have u used julia and is it an honor to have it share ur name or does it do no justice to the julia set)
13 notes · View notes
fandom-is-my-drug · 2 months ago
Text
Tumblr media
I’ve read a lot of fanfics in my time, but it’s been a while since I’ve done a full read through of Uncle Rick’s series, and the only book I don’t have is The Sun and Star (I think) so if I leave anything out let me know.
One of the most interesting things I noticed in Uncle Rick’s stories is the power levels of different demigods. Most demigods in old myths never stepped foot in the Underworld, much less hoped to survive it, beyond a few who had pretty massive amounts of godly help (Hermes with Orpheus, Herakles with Hera, etc.) to get through the journey.
And yet multiple people not only survived the journey, but also did it multiple times, including but not limited to:
Percy (twice, once with pearls and once with Nico)
Grover (with pearls)
Annabeth (with pearls)
Nico (an undisclosed amount of time including with a ghostly half-sister in tow)
Hazel (with help as one of the undead)
Sally (as a kidnapping victim)
A good list of demigods who likely died and came back all on their own while Thanatos was chained
Thalia (while with Nico and Percy)
And while, yes, all of these examples are either because of massive problems on the godly side, or because they are/were accompanied by a Big Three kid (which is BS that Hestia, Hera, and Demeter aren’t included in “they have super crazy powerful kids” despite only Demeter having kids), it doesn’t take away from the fact that it’s happening more often.
“But Nick, like you said, those are major influences that’s helping these guys get out of the Underworld. It’s just relevant to the plot!”
Fair enough, but now here’s the next point: Tartarus.
Basically, Rick’s Greek world essentially functions as such:
Tumblr media
While I don’t think Eris is confirmed to exist in Tartarus (again I haven’t read The Sun and Star), Nyx is, and since Nyx is darkness and Eris is light, it makes sense they exist on the same plane (either beneath Tartarus or coexisting with it) despite both being a concept for all planes except arguably Chaos, which is why I put it on the same level as well.
There are various creation myths, but the overarching plot is: There is Something, that Something creates Others, and this Others become known as Primordials, which make their own Others, such as Titans, Giants, Gods, etc. The creations make essentially layers on Earth, similar to the actual layers of the Earth.
Think of it like this:
Tumblr media Tumblr media
And when new beings are made that take over for the last generation (like Helios and Apollo), then those layers get kinda funky.
So, back to Tartarus. Obviously you have 3 separate “Underworlds”, one for deities (like with Python in Trials of Apollo), one for monsters, and one for mortals. Each of these places is built to recycle beings, similar to the idea of Conservation of Energy and Conservation of Matter. Not only that, but upper level beings can’t (or at least shouldn’t) go below their respective underworld, but lower level beings can’t go up, which is why monsters can go up to the Underworld and Gaea but a human can’t go down into the Underworld or Tartarus without dying.
So this is why demigods surviving Tartarus is crazy work. Sure, there are demigods that can become monsters or gods and survive the trip, but just your average demigod? They’re dead on sight. Between the poison air, the aggressive terrain, no food, no water, monsters being reborn in every direction, etc., survival is slim to none.
Except now we have instances of people surviving the fall and the climb back up, with a questionable amount of sanity intact. Will, Nico (twice), Annabeth, and Percy (you can include Apollo if you like) all survived the fall and came back still kicking, and noticeably not monsters.
So what’s my point?
There’s a common repetition of myth for the Greeks, and that’s the death of the father by their son. Ouranos was killed by Kronos and his siblings. Kronos was killed by Zeus and his siblings. The point is that Rick’s version of the Greeks is approaching the death of Zeus, and the crowning of a new King (if we’re following by patriarchal standards). It’s definitely not going to happen anytime soon, but Big Three kids like Percy and Nico and just your average demigod like the Seven is proof of this. And do you want to know WHY demigods are only going to get more powerful from here?
Because the gods are slowly and indirectly creating their own demise, as had their predecessors. But unlike their predecessors, their downfall will come from not looking in the right direction, instead of thinking they have complete control. Zeus isn’t stupid, and he knows his shit. He’s well aware that he only survived being swallowed because Rhea gave Kronos a rock, because he wasn’t paying attention. Kronos was prideful and believed that he was loved enough that no one would dare defy him, because he wasn’t paying attention the one who saved them. Zeus knows that being ignorant of who is and isn’t against him would be his downfall, so he locks the fuck in. Kronos, while well known for his ability to control time, ruled over the Harvest as well, making him a more Gaea-bound deity. So Zeus chooses the sky. Instead of simply believing in people, he overlooks them, watching them, judging them. He is the God of Justice, after all, so the job title includes the role of “Judge, Jury, and Executioner”.
“But isn’t Olympus a democracy, Nick? Athens was a democracy too, so Zeus wouldn’t be the one in sole power!”
Nope! Well, yes, it is a democracy, but just not a democracy in the way it’s supposed to be. In Athens, they were technically a democracy, but only for those who were rich, powerful, and close to the inner circle of politicians. The building that housed the voting in Athens let people in on a first-come-first-serve basis, so only people who had the time to include themselves and the money to live so close to the place where votes are casted had the power, and on top of that, their politics were wild. One person got a vote, obviously, but it’s like goddamn Survival over there. They made groups and all discussed what went down and who to fucking vote off the island. I’m not joking, they actually did that.
So Zeus consolidated power into a small group of 12, playing it as a “democracy” when in reality those who do not follow him are punished or replaced. Hestia was kicked out for Dionysus, for example, and Apollo was made human, for another. So yeah, it’s a “democracy” in the same way someone gets cohersed into giving consent: it’s not actually real, just driven by fear.
On top of that, they literally have Hephestus TV! They watch their subjects for fun. You cannot tell me Zeus didn’t set up that particularly entertaining baby cam for no reason. He ate Leto! He’s not above being the magical version of the Chaos Council from Sonic Prime.
So in order to create a being capable of overthrowing Zeus, you have to do it slowly, subtly, and have his gaze averted. He has to be focusing on something else. That’s how Luke managed to nearly overthrow him, because he was so focused on 12-year-old Percy Jackson, Son of Poseidon, then someone so minuscule as Luke Castellan, Son of Hermes. He likes to think he’s got it all figured out, thinking that the one who chooses whether Olympus is going to survive or fall must be one of the Big Three’s children. He ignores bigger details and problems in favor of focusing on one small thing. Percy’s birthday was a prophecized stopwatch, and really nothing more.
How would the gods be able to manufacture such a danger to Zeus’s reign when he supervises everything? They don’t manufacture anything at all, at least not on purpose.
“Nick, what the fuck? You’re making no sense.”
HEAR ME OUT.
Our first example of this is our lovely Frank Zhang. Both a demigod and a Legacy, he has power like we haven’t seen unless provided by a shape-shifting god (such as Loki with Alex). Despite being a Son of Mars, who, alongside Ares, have children who’s main god-given skill is “fights good”, he has the ability to shapeshifting and keep up with powerhouses like Percy, Hazel, and Jason. Sure, you could argue that Clarisse can keep up with Percy well enough, but not to the extent of Frank. He has the blood of multiple gods stacked onto one another, helping him have the power to survive the quest to stop Gaea.
Another is Leo Valdez. Poor boy got the attention of a literal Primordal being at a young age, and also managed to kill said Primordal being with his own fire powers, and lived to tell the tale. In the past, that required an elaborate plot to lure the Primordal away from their domain and slice them to pieces, but Leo just did it with a dragon and two other demigods, and incinerated Gaea. Please tell me you understand how absolutely insane that is!
Piper McClean managed to break down Charmspeak into its basic concepts, and understood how it worked well enough to gaslight a Primordal, and before that she had the strongest charmspeak in the room alongside her siblings.
Jason Grace took down a Giant more or less on his own with little to no help from a god, and can take control of wind spirits that don’t even belong to his father’s domain. He’s Hera’s (or Juno, I guess) champion, and she could have chosen Thalia, but she didn’t. She chose Jason. Jason is a full-sibling to Thalia, only divided by pantheons. Having full-siblings is almost entirely unheard of, with only a handful of mortals able to seduce powerful gods not once, but twice, like with Bianca and Nico. That takes INSANE work.
Hazel has the power not only detect precious metals, but also curse them, and channel that power into raising a whole Giant, something that can only happen in Tartarus. She escaped the Underworld after having already died and lost her memories.
Percy is, I’m just going to say it, absolutely insane. He beat The God of WAR in a fight. At 12. He set off a volcano summoning water out of seashells and a stupid idea. He held up the Sky, something that was purposely held up by 4 pillars and later the Titan of Strength for a reason. He survived Tartarus and Polybotes and stole the domain of another goddess. It’s one thing to utilize the abilities bestowed on you by your parent and make them your own, but he stole another bitch’s domain! And used it against her! And probably would have killed her too if Annabeth hadn’t snapped him out of it! You CAN’T tell me that this man isn’t the beginning of the end for the gods.
And my MOST POWERFUL POINT HERE: goddamn Annabeth Chase. Yeah, you know all that batshit insane stuff Percy did? Annabeth was right there next to him. Holding the sky, Tartarus, the Athena Parthenos (which is known to be killing off Athena kids since forever) etc. What’s even more insane is that Athena doesn’t give her kids powers. Athena kids’ abilities are “smart”, and wtf does that mean??? It makes everything Annabeth does all the more impressive and terrifying. The rest of the Seven are powerhouses so strong they can take on Giants, and then you have Annabeth with her knife and spite, and she not only keeps up, but she’s a role model. The other demigods look to her for guidance!
But it gets crazier. You know how I said the gods are creating their own demise hidden in plain sight? Yeah, Annabeth is that “plain sight”. Percy, for all his power and abilities, is the distraction. People like Annabeth are who Zeus really has to look out for. Remember how I said that full-blooded siblings are rare and crazy to even fathom? The Chase Family makes it worse.
How the flying fuck did they manage to bag not one, not two, but three different deities attentions?! What are those Chases on to get so much godly attention?! Not to mention it’s cross pantheon! Frey, Loki, and Athena, we’re drawn in by something, and it’s not your normal godly infatuation.
In a small blurb of a story, Percy and Annabeth meet the Kanes, and while I haven’t read Kane Chronicles (I have the series just haven’t gotten to it yet), they say that cross-pantheon magic is quite literally the strongest way to K.O. your enemies. So the four of them swap items, with Percy getting possessed by a vulture goddess. Why am I bring this up? Because these very points are why the Chases are terrifying.
They’re an active site of cross-pantheon activity, which is why Magnus and Annabeth are so powerful all on their own. Magnus has been watched over for years because of his role in Ragnarok, and was specifically requested by Odin himself to be taken to Valhalla despite being a nature demigod. And not only does Magnus survive there as a nature demigod in an entire afterlife full of war demigods, he thrives. He’s never held a sword in his life, and his main powers are healing and trying to convince plants to grow, and yet he manages to delay Ragnarok for a long, long time.
People like Annabeth, Magnus, and Frank are obvious points in this evolution of power, and they fly under Zeus’s radar almost entirely.
So that’s my Rant. Something that’s been bubbling in my head for a long time really, but I never had a place for it until now. It’s likely that we have such powerful demigods now compared to the old myths because of godly blood mixing in with humans after so long, and then that godly blood, especially when enhanced by other pantheons, starts to draw deities in more and more. So that’s how Zeus gets his ass kicked.
19 notes · View notes
manenfun · 1 year ago
Text
Tumblr media
This is kind of an on going project, but in a discord server I frequent theres a running gag where whenever somone says something really inappropriate, or for lack of a better term "horny" we respond with the painting of Joseph Smith Jr. rebuking the guards in the jailhouse at Liberty, MI (context at the end of the post) So for the first function of my first ever discord bot, known as "Mormo the Demon King" I have it be able to be invoked in order to rebuke anyone who says something of the sort. I am keeping it private for now, but I may reblog this later with a link to the python script I built it in if it is wanted. Plan on adding more to mormo later down the line. ---CONTEXT--- For those who don't know the story, at one point Joseph Smith Jr. was put into prison in Liberty Missouri for several charges that were later dropped, including banking fraud, conspiracy, and treason against the state. During this stay the guards, either naturally or as a way to attempt to bother the prophet started bragging about their involvement in various campaigns of harassment and terrorism against the displaced Mormons. One even mentioning the infamous Haun's Mill where 17 mormon residents of the community were killed, including several children. We dont know exactly what the jail guards said in their conversation but it was enough to allegedly compel Smith to stand up and confer a heavenly rebuke commanding that they either stop talking or die. Reportedly the guards were so astonished that they remained silent until the change of guard the next morning.
59 notes · View notes
nylpad · 1 year ago
Text
CAFFEINE, CODE, AND COUCH CONFESSIONS
Tumblr media Tumblr media Tumblr media
Warnings: coffee addiction
Tim Drake, the resident tech genius of Wayne Manor, had a mission: to teach you the intricacies of coding. Armed with a whiteboard, a stack of textbooks, and a steely determination, he embarked on this noble quest. Little did he know that unraveling the mysteries of Python and JavaScript would be the least challenging part.
Tim sat you down in the cozy corner of the Batcave, the glow of the Batcomputer casting shadows on his face. He explained loops, variables, and functions with the fervor of a preacher. But your brain? It was like a stubborn old laptop running Windows 95—slow, glitchy, and prone to crashing.
"Okay, so if you have a nested loop," Tim said, pointing at the whiteboard, "you'll need to—"
You interrupted. Again. "Wait, wait. What's a nested loop? Is it like a Russian doll situation?"
Tim sighed, rubbing his temples. "No, it's not—"
"But what if the Russian doll is an array?" you asked, eyes wide.
Tim's patience wavered. "It's not—"
"But what if the array contains Batman's utility belt gadgets?" you persisted.
He pinched the bridge of his nose. "That's not—"
Coding fatigue set in. Tim's eyes glazed over as you continued your relentless questioning. He needed a distraction—a break from the syntax and semicolons. So, he proposed a truce: "How about we take a snack break?"
You perked up. "Snacks? Now you're speaking my language."
Soon, the Batcave echoed with the rustling of chip bags and the clinking of coffee mugs. Tim brewed a fresh pot of coffee—the fifth one that day—and you raised an eyebrow.
"Tim, you're going to turn into a jittery metahuman," you warned.
He grinned, sipping from his mug. "Nah, I've built up a tolerance."
The couch beckoned, its cushions inviting. Tim abandoned the whiteboard, and you both sank into its plush embrace. Laptops forgotten, you fired up the gaming console. The Batcave's massive screen displayed the latest multiplayer shooter.
"Ready to kick some virtual butt?" you asked, controller in hand.
Tim hesitated. "Actually, can we watch movies instead?"
You raised an eyebrow. "Movies? Since when do you—"
"—binge-watch romantic comedies?" Tim finished, cheeks flushing. "I may or may not have a soft spot for cheesy love stories."
And so, you traded code for rom-coms, coffee for popcorn. Tim's head found its way to your lap, and you stroked his hair absentmindedly.
"Promise me," you said, "no more coffee. Your heart rate is rivaling the Bat-Signal."
He grumbled but complied. "Fine. But only because you're the best code-cracking partner."
As the credits rolled on the screen, Tim whispered, "Maybe I'll write an algorithm to predict our next movie choice."
You chuckled. "Or we could just flip a coin."
And there, in the dim glow of the Batcave, you realized that maybe—just maybe—love was the most complex code of all.
138 notes · View notes
0x4468c7a6a728 · 3 months ago
Note
What exactly makes Rust so great? (asking as a newbie who's mostly familiar with C and Python)
i'll answer this purely within the scope of my personal use of it and why i like it
for starters you can basically do any type of programming task in it (although some stuff like gamedev is in pretty early stages and i wouldn't really recommend it unless you really like rust lol), so it's really easy to reach for it instead of another programming language in basically any situation
then the reason i'd pick it over languages is that it's just a really nice programming language to use for too many reasons to list really, it has really good compiler errors, it does nice stuff with memory management, it handles a lot of common stuff like strings really well, it has pretty much the best build system i've used packed in, built in unit testing, good support for functional style code, i love the way it does enums, all sorts of stuff
it's got a bit of a learning curve to start with and probably isn't a great first or even second programming language but once you get used to it it's really quite nice to use
(this isn't to say it doesn't have any problems of course, lack of reflection without hacky proc macro stuff for instance, it just has a lot of really nice stuff)
11 notes · View notes
spacetimewithstuartgary · 4 months ago
Text
Tumblr media
New data model paves way for seamless collaboration among US and international astronomy institutions
Software engineers have been hard at work to establish a common language for a global conversation. The topic—revealing the mysteries of the universe. The U.S. National Science Foundation National Radio Astronomy Observatory (NSF NRAO) has been collaborating with U.S. and international astronomy institutions to establish a new open-source, standardized format for processing radio astronomical data, enabling interoperability between scientific institutions worldwide.
When telescopes are observing the universe, they collect vast amounts of data—for hours, months, even years at a time, depending on what they are studying. Combining data from different telescopes is especially useful to astronomers, to see different parts of the sky, or to observe the targets they are studying in more detail, or at different wavelengths. Each instrument has its own strengths, based on its location and capabilities.
"By setting this international standard, NRAO is taking a leadership role in ensuring that our global partners can efficiently utilize and share astronomical data," said Jan-Willem Steeb, the technical lead of the new data processing program at the NSF NRAO. "This foundational work is crucial as we prepare for the immense data volumes anticipated from projects like the Wideband Sensitivity Upgrade to the Atacama Large Millimeter/submillimeter Array and the Square Kilometer Array Observatory in Australia and South Africa."
By addressing these key aspects, the new data model establishes a foundation for seamless data sharing and processing across various radio telescope platforms, both current and future.
International astronomy institutions collaborating with the NSF NRAO on this process include the Square Kilometer Array Observatory (SKAO), the South African Radio Astronomy Observatory (SARAO), the European Southern Observatory (ESO), the National Astronomical Observatory of Japan (NAOJ), and Joint Institute for Very Long Baseline Interferometry European Research Infrastructure Consortium (JIVE).
The new data model was tested with example datasets from approximately 10 different instruments, including existing telescopes like the Australian Square Kilometer Array Pathfinder and simulated data from proposed future instruments like the NSF NRAO's Next Generation Very Large Array. This broader collaboration ensures the model meets diverse needs across the global astronomy community.
Extensive testing completed throughout this process ensures compatibility and functionality across a wide range of instruments. By addressing these aspects, the new data model establishes a more robust, flexible, and future-proof foundation for data sharing and processing in radio astronomy, significantly improving upon historical models.
"The new model is designed to address the limitations of aging models, in use for over 30 years, and created when computing capabilities were vastly different," adds Jeff Kern, who leads software development for the NSF NRAO.
"The new model updates the data architecture to align with current and future computing needs, and is built to handle the massive data volumes expected from next-generation instruments. It will be scalable, which ensures the model can cope with the exponential growth in data from future developments in radio telescopes."
As part of this initiative, the NSF NRAO plans to release additional materials, including guides for various instruments and example datasets from multiple international partners.
"The new data model is completely open-source and integrated into the Python ecosystem, making it easily accessible and usable by the broader scientific community," explains Steeb. "Our project promotes accessibility and ease of use, which we hope will encourage widespread adoption and ongoing development."
10 notes · View notes
ace-disgrace-on-the-case · 10 months ago
Note
#The Cute/Pawesome Self Awareness Identifier/Rectifier 9000 #this program will search through fenFacts.txt to check if Fen thinks it is pawesome and cute and then to rectify the situation if it doesn't. #first step, open the file in read mode and set up an empty array to copy each line fenFactsFile = open('fenFacts.txt' , 'r') newFenFactsStringArray = [] #now let's set up our variables to check if Fen already thought it was Cute/Pawesome and/or if it thought it wasn't. cute = False pawesome = False #now to blitzing through through this data. Python has built in functionality to read through lines in a file using a for loop like "for line in file:" where line is the current line of the file so let's just use that for currentLine in fenFactsFile:      #loop code starts here. Our comparison strings have the "\n" at the end because we're not stripping these. let's check to see if it thinks it is NOT Cute or Pawesome first.      if currentLine == "Is not pawesome.\n":           print("I was wrong and thought I was not pawesome ~w~");           #we don't want to keep a wrong fact in our new array so let's skip over to the next iteration of the loop using continue to skip the rest of the code in the loop           continue
     if currentLine == "Is not cute.\n":           print("I wrong and thought I was not cute.");           #we don't want to keep a wrong fact in our new array so let's skip over to the next iteration of the loop using continue to skip the rest of the code in the loop           continue           #Now the cute check      if currentLine == "Is cute.\n":           cute = True           print("I already knew I was cute!");      #now for the pawesome check      if currentLine == "Is Pawesome.":           pawesome = True           print("I already knew I was pawesome ^w^");       #final part of the for loop is to append to our new Fen facts array
newFenFactsStringArray.append(currentLine) #end of the for loop here
#end of reading, we got our checks done. Time to close the file fenFactsFile.close() #Now let's see if we cute or pawesome are still false if cute == False:      #it does not recognise its own cuteness. We can fix this.      newFenFactsStringArray.append("Is cute.\n") if pawesome == False:      #it does not recognise its own pawesomeness. We can fix this     newFenFactsStringArray.append("Is pawesome.\n")           #Now we have all the Fen Facts we want in newFenFactsStringArray so let's open up fenFacts.txt in write mode and get it fixed up with the cute and pawesome lines but without the is not cute or is not pawesome lines fenFactsFile = open('fenFacts.txt' , 'w') #the next line will replace the text in fenFacts.txt with our newFenFactsStringArray fenFactsFile.writelines(newFenFactsStringArray) #closing it for real this time fenFactsFile.close()
——————
I was wrong and thought I was not pawesome ~w~
I was wrong and thought I was not cute.
14 notes · View notes
utopicwork · 6 months ago
Text
A trick I've developed for getting files out of Pyodide is converting the file into a dataurl in Python, writing that to a text file, then reading that out with the built in Pyodide file reading functionality and using that however, for a media file this usually means assigning a src to that dataurl and for others this could just mean triggering a download
7 notes · View notes
romanticiseadarkcity · 2 months ago
Text
How 20 kilometres of coloured rope transformed this town square
By Julie Power
February 1, 2025 — 2.00amSave
View all comments
It has taken 20 kilometres of brightly coloured rope wound around a rainbow python-shaped pavilion to make Mount Druitt’s 50-year-old Dawson Park feel safer by night and cooler by day.
A new design for Mount Druitt’s Dawson Park has won a major award. CREDIT: SIMON WOOD PHOTOGRAPHY 
Mount Druitt’s town centre was NSW’s first planned town centre, a utopian vision of the 1970s featuring a park, swimming pool, library, offices, shops and school.
Far from delivering “the dream of a pleasantly landscaped area” the park became associated with street crime, alcohol, drug use and antisocial behaviour.
Its redesign is an example of how public art and landscaping, ranging from murals in Sydney’s inner west to laneways near railway stations, is making streets safer and bringing communities together.
Transport for NSW’s Safer Cities laneways program has been so successful that a spokesperson said it is to be extended. Another seven transport hub precincts across NSW will become safer and more vibrant under a similar initiative.
A mural by Jeff McCann in Sydenham has helped reduce graffiti.CREDIT: RHETT WYMAN
To bring people back to Dawson Park in Mount Druitt, and away from its dark and risky edges, the new rope-covered pavilion meanders around trees from an old-growth forest, a new stage and seating areas. The awning provides dappled shade and bright colours that resonate with its multicultural residents.
The project by Chrofi with JMD Design this month won gold in the international Better Futures Awards that recognises design excellence in government projects. Blacktown Council says it marked the beginning of a wave of changes to Mount Druitt.
Locals say crime has been reduced, families feel safer in the square and the local Westfield shopping centre has begun holding events in the park.
Previous attempts to deter unsociable activity in the park and plaza had failed. Despite no-go areas in the square, though, it had one of the busiest social calendars in Sydney.
The biggest part of the brief was to provide shade, but that wasn’t enough.
Zoeller said it had to be functional and provide lighting, security and a stage. “I wanted to create a space that was hopeful and playful. That had colour. That drew people towards it, particularly families.”
Blacktown Council senior architect Matthew Sales said there hadn’t been any significant investment in Mount Druitt for years, if not decades. “This was the first project in the town square since it was built [in 1972].”
Its redesign has coincided with plans to upgrade the pool next door and the library, which is part of a masterplan by Chrofi with JMD Design.
Perfect match in the inner west
The Kookaburra House in Newtown features a mural by David Cragg. CREDIT: RHETT WYMAN
Zoe Pedashenko’s home in Newtown is called the Kookaburra House by her daughter. That’s a reference to a mural of a giant kookaburra painted by artist David Cragg on the large end wall of her terrace.
Called Tributary, the mural was installed free of charge to Pedashenko by Inner West Council as part of its Perfect Match program. It commissions and matches mural artists with businesses, homes and apartment blocks with large walls to decorate.
RELATED ARTICLE
Roads
The change to our traffic lights that could make you happier
What started as a program 10 years ago to reduce graffiti has become so much more, said Inner West Council Mayor Darcy Byrne. “We want to keep it going … and make this a real tourist attraction for the inner west and a source of civic pride.”
Frequently, the murals tell a story about the history of the oldest suburbs in Australia. “It is a contemporary way of bringing that history to life,” he said.
Byrne said, unlike most public art projects, it rarely triggers a complaint. “The investment is modest but the ROI is very big,” he said.
For every mural paid for by the council, a member is inspired to privately commission their own. “We have more street artists than anywhere else in Sydney,” Byrne said.
Artist Fintan Magee remembered being arrested for graffiti just after finishing art school in Brisbane. Moving to Sydney in 2010, it was “incredible” when he was commissioned over a few years to do about 10 murals for Perfect Match.
These works helped launch what has become an international career for Magee. He has just finished a project in Florida in the US and his murals also feature on walls of apartment blocks in France, Denmark, Austria, Switzerland, Germany and Perth.
“I was trying to get my work seen. I was not trying to change the world,” said Magee. “The murals connect the community with the arts and give the public a sense of ownership … and improve mental health.”
Pedashenko said she wanted something bright and cheery, not too graphic or graffiti-like. She worked with Cragg and the council to find something they all liked and wouldn’t attract graffiti. So far, it has only been tagged once, and that was small and easy to wash off, she said.
Laneways projects making streets safer for women
Guildford laneway is now brighter and safer.
Women said they were too scared to use the lane: it was dark and grim, with barren gardens, insufficient lighting and trip hazards. Some had been harassed by men, who followed them and honked their car horns.
The town centre received a $1 million grant to improve the laneway. Now called Her Way Guildford, the passage from the station to the car park was transformed with a colourful mural, installation of CCTV cameras, lighting and phone charging stations, tables and benches, and a performance space.
Not only did women feel safer, the data on a council dashboard showed more people using the space and an uptick in sales in the shops nearby.
RELATED ARTICLE
Development
Redfern ‘murder mall’ reinvented as $500 million Surry Hills Village
Following the success of the $30 million Safer Cities program, another seven transport hub precincts will be overhauled under a similar initiative by Transport.
In the initiative, called ReVITALise – Public Transport Precinct Vibrancy Grant, seven councils have been selected to each receive $1 million to improve areas within 500 metres of a transport hub precinct. This may include better seating, shade or lighting, landscaping, public art or murals, or adding bike racks or mobile phone charging stations.
3 notes · View notes
sak-shi · 8 months ago
Text
Python Libraries to Learn Before Tackling Data Analysis
To tackle data analysis effectively in Python, it's crucial to become familiar with several libraries that streamline the process of data manipulation, exploration, and visualization. Here's a breakdown of the essential libraries:
 1. NumPy
   - Purpose: Numerical computing.
   - Why Learn It: NumPy provides support for large multi-dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays efficiently.
   - Key Features:
     - Fast array processing.
     - Mathematical operations on arrays (e.g., sum, mean, standard deviation).
     - Linear algebra operations.
 2. Pandas
   - Purpose: Data manipulation and analysis.
   - Why Learn It: Pandas offers data structures like DataFrames, making it easier to handle and analyze structured data.
   - Key Features:
     - Reading/writing data from CSV, Excel, SQL databases, and more.
     - Handling missing data.
     - Powerful group-by operations.
     - Data filtering and transformation.
 3. Matplotlib
   - Purpose: Data visualization.
   - Why Learn It: Matplotlib is one of the most widely used plotting libraries in Python, allowing for a wide range of static, animated, and interactive plots.
   - Key Features:
     - Line plots, bar charts, histograms, scatter plots.
     - Customizable charts (labels, colors, legends).
     - Integration with Pandas for quick plotting.
 4. Seaborn
   - Purpose: Statistical data visualization.
   - Why Learn It: Built on top of Matplotlib, Seaborn simplifies the creation of attractive and informative statistical graphics.
   - Key Features:
     - High-level interface for drawing attractive statistical graphics.
     - Easier to use for complex visualizations like heatmaps, pair plots, etc.
     - Visualizations based on categorical data.
 5. SciPy
   - Purpose: Scientific and technical computing.
   - Why Learn It: SciPy builds on NumPy and provides additional functionality for complex mathematical operations and scientific computing.
   - Key Features:
     - Optimized algorithms for numerical integration, optimization, and more.
     - Statistics, signal processing, and linear algebra modules.
 6. Scikit-learn
   - Purpose: Machine learning and statistical modeling.
   - Why Learn It: Scikit-learn provides simple and efficient tools for data mining, analysis, and machine learning.
   - Key Features:
     - Classification, regression, and clustering algorithms.
     - Dimensionality reduction, model selection, and preprocessing utilities.
 7. Statsmodels
   - Purpose: Statistical analysis.
   - Why Learn It: Statsmodels allows users to explore data, estimate statistical models, and perform tests.
   - Key Features:
     - Linear regression, logistic regression, time series analysis.
     - Statistical tests and models for descriptive statistics.
 8. Plotly
   - Purpose: Interactive data visualization.
   - Why Learn It: Plotly allows for the creation of interactive and web-based visualizations, making it ideal for dashboards and presentations.
   - Key Features:
     - Interactive plots like scatter, line, bar, and 3D plots.
     - Easy integration with web frameworks.
     - Dashboards and web applications with Dash.
 9. TensorFlow/PyTorch (Optional)
   - Purpose: Machine learning and deep learning.
   - Why Learn It: If your data analysis involves machine learning, these libraries will help in building, training, and deploying deep learning models.
   - Key Features:
     - Tensor processing and automatic differentiation.
     - Building neural networks.
 10. Dask (Optional)
   - Purpose: Parallel computing for data analysis.
   - Why Learn It: Dask enables scalable data manipulation by parallelizing Pandas operations, making it ideal for big datasets.
   - Key Features:
     - Works with NumPy, Pandas, and Scikit-learn.
     - Handles large data and parallel computations easily.
Focusing on NumPy, Pandas, Matplotlib, and Seaborn will set a strong foundation for basic data analysis.
8 notes · View notes
digitaldetoxworld · 26 days ago
Text
Python Programming Language: A Comprehensive Guide
 Python is one of the maximum widely used and hastily growing programming languages within the world. Known for its simplicity, versatility, and great ecosystem, Python has become the cross-to desire for beginners, professionals, and organizations across industries.
What is Python used for
Tumblr media
🐍 What is Python?
Python is a excessive-stage, interpreted, fashionable-purpose programming language.  The language emphasizes clarity, concise syntax, and code simplicity, making it an excellent device for the whole lot from web development to synthetic intelligence.
Its syntax is designed to be readable and easy, regularly described as being near the English language. This ease of information has led Python to be adopted no longer simplest through programmers but also by way of scientists, mathematicians, and analysts who may not have a formal heritage in software engineering.
📜 Brief History of Python
Late Nineteen Eighties: Guido van Rossum starts work on Python as a hobby task.
1991: Python zero.9.0 is released, presenting classes, functions, and exception managing.
2000: Python 2.Zero is launched, introducing capabilities like list comprehensions and rubbish collection.
2008: Python 3.Zero is launched with considerable upgrades but breaks backward compatibility.
2024: Python three.12 is the modern day strong model, enhancing performance and typing support.
⭐ Key Features of Python
Easy to Learn and Use:
Python's syntax is simple and similar to English, making it a high-quality first programming language.
Interpreted Language:
Python isn't always compiled into device code; it's far done line by using line the usage of an interpreter, which makes debugging less complicated.
Cross-Platform:
Python code runs on Windows, macOS, Linux, and even cell devices and embedded structures.
Dynamic Typing:
Variables don’t require explicit type declarations; types are decided at runtime.
Object-Oriented and Functional:
Python helps each item-orientated programming (OOP) and practical programming paradigms.
Extensive Standard Library:
Python includes a rich set of built-in modules for string operations, report I/O, databases, networking, and more.
Huge Ecosystem of Libraries:
From data technological know-how to net development, Python's atmosphere consists of thousands of programs like NumPy, pandas, TensorFlow, Flask, Django, and many greater.
📌 Basic Python Syntax
Here's an instance of a easy Python program:
python
Copy
Edit
def greet(call):
    print(f"Hello, call!")
greet("Alice")
Output:
Copy
Edit
Hello, Alice!
Key Syntax Elements:
Indentation is used to define blocks (no curly braces  like in different languages).
Variables are declared via task: x = 5
Comments use #:
# This is a remark
Print Function:
print("Hello")
📊 Python Data Types
Python has several built-in data kinds:
Numeric: int, go with the flow, complicated
Text: str
Boolean: bool (True, False)
Sequence: listing, tuple, range
Mapping: dict
Set Types: set, frozenset
Example:
python
Copy
Edit
age = 25             # int
name = "John"        # str
top = 5.Nine         # drift
is_student = True    # bool
colors = ["red", "green", "blue"]  # listing
🔁 Control Structures
Conditional Statements:
python
Copy
Edit
if age > 18:
    print("Adult")
elif age == 18:
    print("Just became an person")
else:
    print("Minor")
Loops:
python
Copy
Edit
for color in hues:
    print(coloration)
while age < 30:
    age += 1
🔧 Functions and Modules
Defining a Function:
python
Copy
Edit
def upload(a, b):
    return a + b
Importing a Module:
python
Copy
Edit
import math
print(math.Sqrt(sixteen))  # Output: four.0
🗂️ Object-Oriented Programming (OOP)
Python supports OOP functions such as lessons, inheritance, and encapsulation.
Python
Copy
Edit
elegance Animal:
    def __init__(self, call):
        self.Call = name
def communicate(self):
        print(f"self.Call makes a valid")
dog = Animal("Dog")
dog.Speak()  # Output: Dog makes a legitimate
🧠 Applications of Python
Python is used in nearly each area of era:
1. Web Development
Frameworks like Django, Flask, and FastAPI make Python fantastic for building scalable web programs.
2. Data Science & Analytics
Libraries like pandas, NumPy, and Matplotlib permit for data manipulation, evaluation, and visualization.
Three. Machine Learning & AI
Python is the dominant language for AI, way to TensorFlow, PyTorch, scikit-research, and Keras.
4. Automation & Scripting
Python is extensively used for automating tasks like file managing, device tracking, and data scraping.
Five. Game Development
Frameworks like Pygame allow builders to build simple 2D games.
6. Desktop Applications
With libraries like Tkinter and PyQt, Python may be used to create cross-platform computing device apps.
7. Cybersecurity
Python is often used to write security equipment, penetration trying out scripts, and make the most development.
📚 Popular Python Libraries
NumPy: Numerical computing
pandas: Data analysis
Matplotlib / Seaborn: Visualization
scikit-study: Machine mastering
BeautifulSoup / Scrapy: Web scraping
Flask / Django: Web frameworks
OpenCV: Image processing
PyTorch / TensorFlow: Deep mastering
SQLAlchemy: Database ORM
💻 Python Tools and IDEs
Popular environments and tools for writing Python code encompass:
PyCharm: Full-featured Python IDE.
VS Code: Lightweight and extensible editor.
Jupyter Notebook: Interactive environment for statistics technological know-how and studies.
IDLE: Python’s default editor.
🔐 Strengths of Python
Easy to study and write
Large community and wealthy documentation
Extensive 0.33-birthday celebration libraries
Strong support for clinical computing and AI
Cross-platform compatibility
⚠️ Limitations of Python
Slower than compiled languages like C/C++
Not perfect for mobile app improvement
High memory usage in massive-scale packages
GIL (Global Interpreter Lock) restricts genuine multithreading in CPython
🧭 Learning Path for Python Beginners
Learn variables, facts types, and control glide.
Practice features and loops.
Understand modules and report coping with.
Explore OOP concepts.
Work on small initiatives (e.G., calculator, to-do app).
Dive into unique areas like statistics technological know-how, automation, or web development.
2 notes · View notes
tanadrin · 1 year ago
Text
GDScript vs C# in Godot
GDScript pros:
the built-in ID is way better at highlighting GDScript syntax and pointing out mistakes as you go. it doesn't do this at all for C#
you can negatively index arrays in GDScript, which is really nice
the engine is actually fully documented for GDScript, which it most certainly isn't for C#.
GDScript cons:
the modulo operator works wrong, i.e., it doesn't work for negative numbers. -1%5 == -1. it took me ages to figure out why i couldn't index this damn string correctly.
i fucking hate gdscript. why do i have to type "var" before each new variable if we're not doing static typing? why do you only have two types of collection, "array" (really "list") and "dictionary"? i could sure use stuff like tuples and sets and so forth. why can't functions return multiple values? you also can't unpack arrays like in python (var1, var2, var3 = array_with_three_values), which is annoying as shit.
you can't overload functions. or define operators for custom classes. all the time you are saving me by not having to type semicolons and curly braces is being wasted writing the most ungainly shit known to man.
fuck this noise. i'm going back to C#. yes, i have to wait for your rickety ass to compile it every time, but the better integration to the engine is not worth having to use your weird fucked-up python wanna be scripting language.
14 notes · View notes
juliebowie · 11 months ago
Text
What is Data Structure in Python? 
Summary: Explore what data structure in Python is, including built-in types like lists, tuples, dictionaries, and sets, as well as advanced structures such as queues and trees. Understanding these can optimize performance and data handling.
Tumblr media
Introduction
Data structures are fundamental in programming, organizing and managing data efficiently for optimal performance. Understanding "What is data structure in Python" is crucial for developers to write effective and efficient code. Python, a versatile language, offers a range of built-in and advanced data structures that cater to various needs. 
This blog aims to explore the different data structures available in Python, their uses, and how to choose the right one for your tasks. By delving into Python’s data structures, you'll enhance your ability to handle data and solve complex problems effectively.
What are Data Structures?
Data structures are organizational frameworks that enable programmers to store, manage, and retrieve data efficiently. They define the way data is arranged in memory and dictate the operations that can be performed on that data. In essence, data structures are the building blocks of programming that allow you to handle data systematically.
Importance and Role in Organizing Data
Data structures play a critical role in organizing and managing data. By selecting the appropriate data structure, you can optimize performance and efficiency in your applications. For example, using lists allows for dynamic sizing and easy element access, while dictionaries offer quick lookups with key-value pairs. 
Data structures also influence the complexity of algorithms, affecting the speed and resource consumption of data processing tasks.
In programming, choosing the right data structure is crucial for solving problems effectively. It directly impacts the efficiency of algorithms, the speed of data retrieval, and the overall performance of your code. Understanding various data structures and their applications helps in writing optimized and scalable programs, making data handling more efficient and effective.
Read: Importance of Python Programming: Real-Time Applications.
Types of Data Structures in Python
Python offers a range of built-in data structures that provide powerful tools for managing and organizing data. These structures are integral to Python programming, each serving unique purposes and offering various functionalities.
Lists
Lists in Python are versatile, ordered collections that can hold items of any data type. Defined using square brackets [], lists support various operations. You can easily add items using the append() method, remove items with remove(), and extract slices with slicing syntax (e.g., list[1:3]). Lists are mutable, allowing changes to their contents after creation.
Tuples
Tuples are similar to lists but immutable. Defined using parentheses (), tuples cannot be altered once created. This immutability makes tuples ideal for storing fixed collections of items, such as coordinates or function arguments. Tuples are often used when data integrity is crucial, and their immutability helps in maintaining consistent data throughout a program.
Dictionaries
Dictionaries store data in key-value pairs, where each key is unique. Defined with curly braces {}, dictionaries provide quick access to values based on their keys. Common operations include retrieving values with the get() method and updating entries using the update() method. Dictionaries are ideal for scenarios requiring fast lookups and efficient data retrieval.
Sets
Sets are unordered collections of unique elements, defined using curly braces {} or the set() function. Sets automatically handle duplicate entries by removing them, which ensures that each element is unique. Key operations include union (combining sets) and intersection (finding common elements). Sets are particularly useful for membership testing and eliminating duplicates from collections.
Each of these data structures has distinct characteristics and use cases, enabling Python developers to select the most appropriate structure based on their needs.
Explore: Pattern Programming in Python: A Beginner’s Guide.
Advanced Data Structures
Tumblr media
In advanced programming, choosing the right data structure can significantly impact the performance and efficiency of an application. This section explores some essential advanced data structures in Python, their definitions, use cases, and implementations.
Queues
A queue is a linear data structure that follows the First In, First Out (FIFO) principle. Elements are added at one end (the rear) and removed from the other end (the front). 
This makes queues ideal for scenarios where you need to manage tasks in the order they arrive, such as task scheduling or handling requests in a server. In Python, you can implement a queue using collections.deque, which provides an efficient way to append and pop elements from both ends.
Stacks
Stacks operate on the Last In, First Out (LIFO) principle. This means the last element added is the first one to be removed. Stacks are useful for managing function calls, undo mechanisms in applications, and parsing expressions. 
In Python, you can implement a stack using a list, with append() and pop() methods to handle elements. Alternatively, collections.deque can also be used for stack operations, offering efficient append and pop operations.
Linked Lists
A linked list is a data structure consisting of nodes, where each node contains a value and a reference (or link) to the next node in the sequence. Linked lists allow for efficient insertions and deletions compared to arrays. 
A singly linked list has nodes with a single reference to the next node. Basic operations include traversing the list, inserting new nodes, and deleting existing ones. While Python does not have a built-in linked list implementation, you can create one using custom classes.
Trees
Trees are hierarchical data structures with a root node and child nodes forming a parent-child relationship. They are useful for representing hierarchical data, such as file systems or organizational structures. 
Common types include binary trees, where each node has up to two children, and binary search trees, where nodes are arranged in a way that facilitates fast lookups, insertions, and deletions.
Graphs
Graphs consist of nodes (or vertices) connected by edges. They are used to represent relationships between entities, such as social networks or transportation systems. Graphs can be represented using an adjacency matrix or an adjacency list. 
The adjacency matrix is a 2D array where each cell indicates the presence or absence of an edge, while the adjacency list maintains a list of edges for each node.
See: Types of Programming Paradigms in Python You Should Know.
Choosing the Right Data Structure
Selecting the appropriate data structure is crucial for optimizing performance and ensuring efficient data management. Each data structure has its strengths and is suited to different scenarios. Here’s how to make the right choice:
Factors to Consider
When choosing a data structure, consider performance, complexity, and specific use cases. Performance involves understanding time and space complexity, which impacts how quickly data can be accessed or modified. For example, lists and tuples offer quick access but differ in mutability. 
Tuples are immutable and thus faster for read-only operations, while lists allow for dynamic changes.
Use Cases for Data Structures:
Lists are versatile and ideal for ordered collections of items where frequent updates are needed.
Tuples are perfect for fixed collections of items, providing an immutable structure for data that doesn’t change.
Dictionaries excel in scenarios requiring quick lookups and key-value pairs, making them ideal for managing and retrieving data efficiently.
Sets are used when you need to ensure uniqueness and perform operations like intersections and unions efficiently.
Queues and stacks are used for scenarios needing FIFO (First In, First Out) and LIFO (Last In, First Out) operations, respectively.
Choosing the right data structure based on these factors helps streamline operations and enhance program efficiency.
Check: R Programming vs. Python: A Comparison for Data Science.
Frequently Asked Questions
What is a data structure in Python?
A data structure in Python is an organizational framework that defines how data is stored, managed, and accessed. Python offers built-in structures like lists, tuples, dictionaries, and sets, each serving different purposes and optimizing performance for various tasks.
Why are data structures important in Python?
Data structures are crucial in Python as they impact how efficiently data is managed and accessed. Choosing the right structure, such as lists for dynamic data or dictionaries for fast lookups, directly affects the performance and efficiency of your code.
What are advanced data structures in Python?
Advanced data structures in Python include queues, stacks, linked lists, trees, and graphs. These structures handle complex data management tasks and improve performance for specific operations, such as managing tasks or representing hierarchical relationships.
Conclusion
Understanding "What is data structure in Python" is essential for effective programming. By mastering Python's data structures, from basic lists and dictionaries to advanced queues and trees, developers can optimize data management, enhance performance, and solve complex problems efficiently. 
Selecting the appropriate data structure based on your needs will lead to more efficient and scalable code.
6 notes · View notes