Programming

26392 readers
210 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
1101
 
 

I would love any comments/criticism as this is the first project I've written where I actually felt comfortable with what I was doing

Thanks!

1102
 
 

note: i did NOT create the ASCII art. I'm not good enough to do that. I found on various ascii art archives as well as those image to ascii art converters for the continents I couldn't find.

countryguess was a project I made recently because I wanted to make a quiz that could be customised as you see fit. Also, I had no clue how to make GUIs with Python and ASCII art is cool so I decided to roll with it. It turned out pretty cool!

I made the maps by printing the ASCII art map, and then all the spaces that make up each country would be an array. These arrays would fill up the spaces like morocco[0], morocco[1], etc.

Then, when the country is guessed, the country (or an alternate name/abbrviation, such as uk for the united kingdom or ivory coast for cote d'ivoire) is matched with its index in the list of countries in that continent.

A second list contains all the countries that show up on the map (excluding citystates, islands, etc. that aren't big enough to be shown on the map) and has all the countries as either 0 (false) or 1 (true). Whenever the country is guessed, its respective list item turns into 1.

The map printing function checks each list item for whether it is true or false. If it is true, then the list of spaces for that country would be replaced with a list of equal length and equal number of characters but with hashes "#" instead of spaces " ". This means that, when the county is printed, hashes are printed instead of spaces and the country fills up

I've got africa, europe, north america, and oceania completed. I haven't yet made the map for asia because it's HUGE, and south america I haven't done yet as well. Also, central/eastern europe is VERY out of proportion and will be fixed...eventually. (i.e. long romanian panhandle)

other fun features I added include the ability to enable/disable disputed territories (Western Sahara, Kosovo, and Somaliland bc why not) and the U.N. observer states (the Vatican and Kosovo) as well as score saving to a "scores.txt" that shows the date, time, and name of quiz that you complete along with your score.

once I finished all the continents, I'll work on making a world quiz with ALL the countries. other things like capital quizzes and flag quizzes could be added on later, but that's likely very far into the future.

here are some more screenshots:

europe europe

oceania oceania

north america north america

the github link if you want to look at the code or just have a go at the quiz: https://github.com/swarbler/countryguess

1103
 
 
 # Ask user to enter an expression and display output
def main():
    expression = input("Expression: ")

    print(calculate(splitter(expression)))


# Split expression into components and assign to variables as float values
def splitter(expression):
    x, y, z = expression.split()

    return x, y, z

# Calculate expression result
def calculate(x, y, z):
    x, z = float(x), float(z)

    if y == "+":
        return str(round((x + z), 1))
    elif y == "-":
        return str(round((x - z), 1))
    elif y == "*":
        return str(round((x * z), 1))
    else:
        return str(round((x / z), 1))



main()

I am getting traceback errors for any expression (1 + 1) I enter.

1104
1105
1106
1107
 
 

Hi, I made FuncSug to make GUI programming in the browser easier. It's a new language that aims to enable a clearer and easier code structure.

Can you tell me what you think about it?

1108
1109
 
 

Solve mysteries through SQL.

1110
1111
43
submitted 1 year ago* (last edited 1 year ago) by 0101100101@programming.dev to c/programming@programming.dev
 
 

Not sure if off-topic, but what's the best way to go about finding coding gigs at the moment? Need some urgent funds so need to reach out to people somehow.

I think of linkedin as a facebook for businesses leading you open to being spammed by agencies, which I don't really want.

Though I have years of experience of coding across many languages and fields (audio, computer vision, e-commerce backends, etc), and github accounts over the years with some pushes to the core of a few major projects, I haven't really kept the accounts, and past projects have nearly always been back-ends for clients so can't exactly add them to a portfolio.

Languages I'm currently using would be python / php (including symfony and laravel), though happy to switch to javascript/html coding, some c/c++ etc, so I'm not tied to one area I guess.

Is there a decent place to advertise or, is there a better way lately? Thanks

1112
1113
1114
1115
1116
 
 

Don't. Just don't.

Go on a walk. Feed your dog. Maybe read a fucking book. Do literally anything else.

1117
 
 

The word, used by computer scientists to mean ‘no value,’ has created long-running challenges

1118
1119
 
 

Finally the new Rust 1.85.0 update is here, with a new Rust Edition 2024.

1120
 
 

Hello lemmy! I am a underGrad in Delhi, India. This is my portfolio website made with React, Typescript and Tailwind. Please go through it and if possible rate it.

1121
1122
 
 

I'm under Windows, so my primary shell will be Powershell, which eats up the commas for some reason.

1123
1124
1125
 
 

The University of Pennsylvania offers a free series of books called Software Foundations with the following description:

The Software Foundations series is a broad introduction to the mathematical underpinnings of reliable software.

The principal novelty of the series is that every detail is one hundred percent formalized and machine-checked: the entire text of each volume, including the exercises, is literally a "proof script" for the Coq proof assistant.

The series includes Verifiable C, which seems very appealing as a way to avoid some of C's infamous "footguns." I haven't read the series myself, but I might in the future because I like math, logic & programs that do what they're supposed to do.

Are there any materials that would be good as alternatives or complements to this series?

Edit: Adding the Vercors Wiki to the resources in this thread

view more: ‹ prev next ›