Spyke

Posts

Confused about logical operators (i.e. "comparison operators", or "boolean operators") in Python

Note: The attached image is a screenshot of page 31 of Dr. Charles Severance's book, Python for Everybody: Exploring Data Using Python 3 (2024-01-01 Revision).


I thought = was a mathematical operator, not a logical operator; why does Python use

>= instead of >==, or <= instead of <==, or != instead of !==?

Thanks in advance for any clarification. I would have posted this in the help forums of FreeCodeCamp, but I wasn't sure if this question was too.......unspecified(?) for that domain.

Cheers!

 


Edit: I think I get it now! Thanks so much to everyone for helping, and @[email protected] and @[email protected] in particular! ^_^

View original on lemmy.blahaj.zone

Confused about multiplying floating-point & integer values

I'm currently doing Dr. Charles Severence's lessons on FreeCodeCamp to try to learn Python3. I'm on lesson exercise 02_03 and confused about multiplying floating-point and integer values.

The goal is to write a Python program multiplying hours worked by pay rate to come up with a pay quantity.

This is the code I wrote:

h = input("Enter hours: ")
r = input("Enter pay rate: ")
p = float(h) * r

I got a traceback error, and the video said the correct way to solve said error was change Line 3 from p = float(h) * r to p = float(h) * float(r).

However, what I'm confused about is why would I need to change r to a floating-point value when it's already a floating-point value (since it'd be a currency value like 5.00 or something once I typed it in per the input() command*?

What am I missing here?

 


*I can't remember: are the individual commands in a python line called "commands"?

 

 


Edit: Wrote plus signs in my post here instead of asterisks. Fixed.

 


EDIT: Thanks to @[email protected] and @[email protected]. I thought that the input() function was a string until the end-user types something in upon being prompted, and then becomes a floating-point value or integer value (or stays a string) according to what was typed.

This is incorrect: the value is a string regardless of what is typed unless it is then converted to another type.

View original on lemmy.blahaj.zone

Recommendations for private tracker for keys?

Follow-Up: It's going great! I've stopped using my Tile tracker, I haven't lost my keys (yet), and I feel like I'm a LOT less trapped by my circumstances regarding them. Many thanks everyone! Many thanks indeed!


 

(See bottom for tl;dr.)

I'm the kind of person who loses their keys easily, so I love the idea of trackers: little devices that you can attach to your wallet, phone, or keyring that connect via bluetooth to an app on your phone to help you find it.

Problem is pretty much all the options I can find are run by companies with shitty privacy policies: Tile, Apple AirTag, Chipolo, and so forth.

  • Tile collects shitloads of data and is partnered with Amazon to boot;
  • Apple Airtags AFAIK only work with Apple devices, and besides it's Apple so no thank you; and
  • Chipolo also collects shitloads of data and shares information with data brokers and data collection companies of all stripes. No thank you.

In any case, I really don't need a location network larger than maybe 200 meters (about 650 feet). If I lose my keys, odds are it's either in my car or in my house, and my house is like 100 square meters (about 1000 square feet). So Bluetooth is really all I need. I don't even need to see it on a map; I just need for it to ding or something.

I'm currently using Tile but I really want to get away from it. Worst case scenario, I'll stop using the Tile, but I really am a forgetful little shit. Lol.

 

tl;dr – Looking for recommendations for ideally short-range Bluetooth trackers for keys, with decent privacy. Max required range = 200 m (650 ft). Also, pie tastes great. Cheers.

 


Edit: Added a single comma (because fuck syntactic ambiguity) and added follow-up. :)

View original on lemmy.blahaj.zone

Could someone help me understand the input() function?

I'm currently learning Python and am learning about very basic functions such as int(), float(), and input().

I have the first two down pat, but I'm struggling to understand the last. The example I'm looking at is found at 12:26 of this video:

nam = input('Who are you? ')
print('Welcome', nam)

Who are you? Chuck
Welcome Chuck

In this case, wouldn't nam be a variable equal to the text on the right side of the = sign?

In which case, if nam is equal to input('Who are you? '), then wouldn't print('Welcome', nam) just result in

Welcome input(Who are you? )?

Obviously not (nor does it work in a compiler), which leads me to believe I'm clearly misunderstanding something. But I've rewatched that section of the video several times, and looked it up elsewhere on the web, and I just can't wrap my head around it.

Could someone help me with this?

Thanks.

View original on lemmy.blahaj.zone

Any suggestions for cheap but decent laptops for coding?

I'm currently learning how to code (currently Python, then maybe JavaScript), but I'm not always around my desktop, and learning on my phone is not always an option (also, it can be quite cumbersome at times). Therefore, I'm looking into purchasing a laptop just for learning how to code and stuff.

I don't want to get a Chromebook because I want to be able to wipe the drive and install Linux on it (probably Linux Mint). Maybe it's changed since 2013, but the last time I had a Chromebook, it was a pain in the ass to install even bog-standard Ubuntu on it.

Problem is, I'm also heavily limited by space & budget: no more than 11 in (280 mm) total laptop width and 330 USD base price.

Does anyone have any suggestions?

Please forgive me if this is not the right space for this kind of question. Lemme know if it is and I'll delete it. :)

View original on lemmy.blahaj.zone
main·Blahaj Lemmy MetabyEveryMuffinIsNowEncrypted

Is it bad form for one person to have 2 accounts on a single instance?

I suppose the answer could apply to any instance, but I'm mostly referring to this one.

Mind you, I don't have two accounts, but I'm considering it: one for memes, the other for serious discussion.

But I'm unsure if that's considered bad form by most people, so I thought I'd ask.

Thanks!

 


EDIT: Also, come to think of it, even if it were okay, would it even be possible to have to be logged into two separate accounts on the same instance at the same time with the same browser profile? :/

View original on lemmy.blahaj.zone
main·Blahaj Lemmy MetabyEveryMuffinIsNowEncrypted

"Show Context" isn't working?

Howdy, y'all. :)

So, within the last couple of days or so, I've been having this problem where if I click on the notification bell, then the chain icon next to a shown reply, then click "Show context" above the horizontal rule (see screenshot), it doesn't proceed to load the context. Rather, it just reloads the same page.

The strange thing is this doesn't happen with every notification. Another notification I had was from here on the Blahaj Lemmy instance, and that worked fine. Maybe it's a thing to do with federation protocols? Anyway, I'm no expert. I just thought I'd ask. :)

Cheers.

View original on lemmy.blahaj.zone

How to open a particular POST on a different instance?

Hello.

I'm extremely tired, so it very well could be that this is extremely simple and I'm just not getting it. However, what I would like to know is how to open a post from a community on one instance on another instance.

For example, here's a recent post from ![email protected]. I know that to open that community in the instance lemmy.blahaj.zone, I would merely type into the address bar

lemmy.blahaj.zone/c/[email protected]

However, how would I open that particular post in that community on the latter instance? Is it even possible?

Cheers.

 

P.S.

I did do some searching on both this community as well as the Reddit Lemmy FAQ page but I didn't find anything. However, I could've missed something. If it's something obvious, I apologize in advance.


Edit: Assuming I understand what people are saying, well, evidently, it seems to be a current limitation of the ActivityPub protocol. Perhaps that will change one day. Hopefully soon. ¯\_(ツ)_/¯

View original on lemmy.blahaj.zone

Are there any good Blu-ray ripping software for Linux?

I'm well aware that I can rip most Blu-rays with MakeMKV and then convert to mp4 with Handbrake; however, the former just rips everything raw from the disk so the file size is humongous and the conversion via Handbrake for just a single file is terribly long and puts a lot of strain on my computer.

I've heard that EaseFab LosslessCopy is decent, but they only have a Windows and a Mac version, and I'm unsure how well it'd run under Wine.

I am willing to pay for it, but only as long as it's not a subscription thing. Has to be a one-time payment.

Does anyone know any decent Blu-ray ripping software that fits these conditions and run well on Linux? Specifically, it would be either Pop!_OS or Linux Mint. (I'm still using Windows because I want to figure out some software alternatives before I do so I'm not caught with my pants down, so to speak.)

View original on lemmy.blahaj.zone

You reached the end