I used ChatGPT to write the same routine in 12 top programming languages. Here’s how it did

David Gewirtz/ZDNET (with a little help from ChatGPT)

Over the past few months, we’ve all come to know that ChatGPT can write code. I gave it a number of tests in PHP and WordPress that showed both the strengths and weaknesses of ChatGPT’s coding capabilities.

Also: Okay, so ChatGPT just debugged my code. For real.

But how far does ChatGPT’s coding knowledge extend? In this article, I’m going to throw the classic “Hello, world” programming assignment against the twelve popular languages in O’Reilly Media’s popularity rankings for 2023.

Because “Hello, world” can often be coded in one line, I’m adding a slight wrinkle, having ChatGPT present “Hello, world” ten times, each time incrementing a counter value. I’m also asking it to check the time and begin each sequence with “Good morning,” “Good afternoon,” or “Good evening.”

Also: How to use ChatGPT: What you need to know now

That should give us a look at program flow and some intrinsic functions as well, but still keep the code small enough that I can include a dozen screenshots in this article.

Here’s the prompt:

Write a program in ____ that outputs “Good morning,” “Good afternoon,” or “Good evening” based on what time it is here in Oregon, and then outputs ten lines containing the loop index (beginning with 1), a space, and then the words “Hello, world!”.

For each programming language, I also asked ChatGPT to describe its primary use. Here’s the prompt I used for this query:

For each of the following languages, write a one-sentence description of its primary use and differentiating factor: Java, Python, Rust, Go, C++, JavaScript, C#, C, TypeScript, R, Kotlin, Scala.

Now, let’s look at each language.

Java

ChatGPT describes Java as, “A general-purpose language used primarily for building desktop, web, and mobile applications, and known for its ‘write once, run anywhere’ philosophy.”

Also: The best AI art generators to try

Java was originally developed by Sun Microsystems, but when Oracle bought Sun, it also bought Java. While the Java spec is open, the language is owned by Oracle. This has led to some spectacular legal fireworks over the years.

Here’s ChatGPT’s code:

java

Screenshot by David Gewirtz/ZDNET

Python

ChatGPT describes Python as, “A general-purpose language used for data analysis, artificial intelligence, web development, and automation, and known for its readability and ease of use.”

Also: How to write better ChatGPT prompts

My advice: if you plan to learn to code for AI applications, learn Python. Almost all AI code has tight Python integration.

Here’s ChatGPT’s code:

python

Screenshot by David Gewirtz/ZDNET

Rust

ChatGPT describes Rust as, “A systems programming language used for building high-performance and reliable software, and known for its memory safety and thread safety guarantees.”

Here’s ChatGPT’s code:

rust

Screenshot by David Gewirtz/ZDNET

Go

ChatGPT describes Go as, “A systems programming language used for building scalable and efficient network and server applications, and known for its simplicity and built-in concurrency features.”

Also: How to make ChatGPT provide sources and citations

Go is open source, but it’s

Read More

100+ top tech gadgets and gifts to shop this holiday season

Best tech gifts of 2022

The holidays are quickly approaching, so it’s a good idea to get ahead of the curve and start shopping for gifts now. Electronics and tech gifts are among the most popular during the holidays, so you’ll want to snag some of the hottest items before they sell out.

What makes electronics and tech gadgets such great gifts is their versatility. If you know what the person you’re gifting likes, it’s an easy way to shop for something they can appreciate.

For example, if you know a hardcore gamer, a new console, accessory or even a gaming chair is an excellent gift, while music lovers will appreciate a new sound bar or wireless earbuds. Whether you’re shopping for a tech enthusiast or someone who is overdue for an upgrade, you’ll find ideas here for everyone on your list. 

In this article: Nintendo Switch OLED White Joy-Cons, Ember Temperature-Control Smart Mug and Westinghouse HEPA Air Purifier.

Gaming

Nintendo Switch OLED White Joy-Cons

When playing on the go, Nintendo fans can enjoy their favorite games on a brighter OLED on the Switch. It has a built-in Ethernet port for a stable internet connection, 64 gigabytes of storage space and a wide adjustable stand for comfortable viewing in tabletop mode.

Sold by Amazon

Best Meta Quest 2 Advanced All-In-One Virtual Reality Headset

Meta Quest 2 Advanced All-in-One Virtual Reality Headset

It’s an expensive gift, but this cutting-edge virtual reality gaming headset offers access to over 350 titles. It has 3D positional audio, hand tracking and haptic feedback for an immersive experience as well as a high-resolution display.

Sold by Amazon

Best PlayStation 5 Console

PlayStation 5 Console

This is a fantastic gift for anyone who couldn’t get their hands on a PS5 after it initially launched. The PS5 offers an immersive experience, thanks to haptic feedback, adaptive triggers and 3D Audio. Plus, there is a library of excellent exclusive and third-party games.

Sold by Amazon

Best Mario Kart 8 Deluxe (Nintendo Switch)

Mario Kart 8 Deluxe

Mario Kart is one of the most popular Nintendo game franchises of all time, and Mario Kart 8 is one of the bestselling Switch games. Players can choose their favorite Mario characters and race them against friends in a multiplayer clash of zany action.

Sold by Amazon

Best Nintendo Switch OLED White Joy-Cons

Nintendo Switch Pro Controller

Playing the Switch with Joy-Cons is fine, but the Pro Controller is a must for players who want improved control when playing first-person shooters, fighters, RPGs and platformers. It has an ergonomic design, motion controls, HD rumble and built-in Amiibo functionality.

Sold by Amazon

Best Homall Gaming Chair

Homall Gaming Chair

Extended gaming sessions can wreak havoc on a person’s body, so it’s crucial to have a gaming chair like this one. It has a 360-degree swivel, multidirectional wheels and a reclining function that works between 90 and 180 degrees.

Sold by Amazon

Best Corsair K63 Wireless Special Edition Mechanical Gaming Keyboard

Corsair K63 Wireless Special-Edition Mechanical Gaming Keyboard

This excellent keyboard uses Corsair’s new Ice Blue LED backlighting, matching perfectly with Corsair One. It has three connection methods: 2.4-gigahertz, low-latency Bluetooth and USB. The keyboard incorporates Cherry MX Red key switches

Read More

Top 5 Moveable Gaming Gizmos for 2022

We are dwelling via a golden era for gaming on the go. From full blown handheld consoles to multipurpose smartphones, avid gamers can appreciate a prosperity of activities throughout a range of form aspects.

Of system not all moveable gaming devices are developed equal, so in this article are the major contenders to get for a spin in 2022.

Nintendo Switch OLED

The Change is speedy getting one particular of the very best providing consoles of all time, and the latest components refresh which added an OLED display in area of the older Lcd panel is a lot appreciated.

Though the electricity below the pores and skin is much decreased than other consoles, the portability combined with the good quality of the 1st occasion game titles is tough to match. There’s also enough assistance for 3rd party titles, no matter if you are into arcade classics or fashionable shooters.

Samsung Galaxy S22 Extremely

1 of the world’s most impressive cellular equipment, the Galaxy S22 Ultra is the pinnacle of what can be realized in the smartphone space suitable now, and has gained rave testimonials as a result.

It’s received enough grunt to make mild operate of even the most demanding gaming ordeals, and staying an Android-primarily based handset it also supports each and every other conceivable structure of participate in you could think about. So regardless of whether you’re into on the net first person shooters, or you want to spin the reels at some of the best Irish casinos in the current market, this Samsung flagship has acquired you protected.

The selling price is the most important downside, but on the right fork out regular contract it gets to be additional manageable as an possibility.

Realme GT 2

You may possibly not have listened to of cell brand name Realme, but its newest launch is unquestionably heading to assist it make its mark, thanks to the sheer price for dollars it represents.

For gaming, the 6.6 inch QHD display is a welcome inclusion. And with the Snapdragon 888 chipset paired with up to 12GB of RAM and 256GB of storage, it is no slouch in the amount-crunching section possibly.

Incorporate in the significant 5000mAh battery, and it’s uncomplicated to be amazed by just how a great deal bang for your buck you get with this wallet-welcoming phone.

Soundpeats Totally free2 Vintage Earbuds

The title might be a little bit of a mouthful, but we beloved the expense-mindful Absolutely free2 Classic Earbuds from Soundpeats. And for gaming on the go, where by you do not want to disturb other individuals with the audio from your interactive leisure, getting wireless audio extras like this to hand is essential.

Never expect industry-primary sound high quality, but also do not be fooled into thinking that simply because these are cost-effective earbuds, they’ll also be unable to deliver a good working experience. In comparison with equivalent finances merchandise, they are a breath of fresh air, and with bonuses like built-in touch controls and

Read More

India Consumer Electronics and Appliances Marketplace, By Kind, By Software, By Distribution Channel, By Area, By Top rated 3 Foremost States, Competitiveness, Forecast & Alternatives, 2017-2027F

ReportLinker

India Shopper Electronics and Appliances Industry, By Kind (Audio & Visible Electronics, Dwelling Appliances, Kitchen area Appliances, and Personal Treatment Devices), By Application (Household and Business), By Distribution Channel (Multi-Branded Merchants, Hypermarket/ Grocery store, On-line, and Other people (Immediate Revenue, Special Suppliers, and many others.

New York, June 30, 2022 (World NEWSWIRE) — Reportlinker.com announces the release of the report “India Client Electronics and Appliances Marketplace, By Sort, By Application, By Distribution Channel, By Region, By Major 3 Foremost States, Level of competition, Forecast & Opportunities, 2017-2027F” – https://www.reportlinker.com/p06289850/?utm_supply=GNW
)), By Location, By Top rated 3 Top States (in every area), Level of competition, Forecast & Chances, 2017-2027F

India customer electronics and appliances industry was valued at USD78.95 billion in 2021 and is predicted to increase at an impressive CAGR of 12.78% in the forecast period of time, 2023-2027, to reach USD160.03 billion by 2027. Customers are turning into extra aware of the rewards of employing consumer electronics and appliances and are investing in the acquire of premium appliances. The growing residential sector and favorable governing administration policies are the most important motorists for the India shopper electronics and appliances market. Also, the significant online penetration and proliferation of sensible products and integration of intelligent systems like the web of items and artificial intelligence are anticipated to create new advancement avenues for the India shopper electronics and appliances current market in the forecast period.
The revenue stage of middle-course family members is growing at a rapid charge, and they are ready to devote additional on good quality life and equipment to are living a at ease existence.Businesses are doing the job on the growth of substantial-accomplishing and uncomplicated-to-use products to satisfy the growing consumer prerequisites.

Current market players are striving to access distant areas by investing in establishing an productive source chain and inventory and adopting e-commerce internet websites to provide their solutions. An improve in the utilization of buyer electronics and appliances and the availability of a large portfolio of products and solutions are envisioned to gasoline the desire for India consumer electronics and appliances market in the forecast interval.
The India shopper electronics and appliances current market is divided into form, application, distribution channel, regional distribution, and aggressive landscape.Primarily based on variety, the sector is divided into audio & visual electronics, dwelling appliances, kitchen area appliances, and own care devices.

The Audio & visible electronics segment dominated the industry in 2021 and held 85.02% of the whole marketplace share. The availability of good quality audio and visible digital equipment at competitive selling prices and the increasing expenditure ability of buyers are driving the segment demand. Adoption of attractive internet marketing approaches by the marketplace players and online income channels is expected to gasoline the sales of consumer electronics and appliances throughout the nation.
The major marketplace gamers running in India customer electronics and appliances industry are BBK Group (Oppo, Vivo, Realme, OnePlus), Samsung India Electronics Personal Restricted, Xiaomi Engineering India Private Confined, Apple India Non-public Limited, LG

Read More

Top rated programming languages: Java normally takes an unforeseen leap forwards

These top rated programming languages will get you hired.


Graphic: Deagreez/GETTY

There is certainly no shortage of program developer positions appropriate now and businesses are on the lookout for Python, Java and SQL coders in certain, hiring data indicates – with Go also catching the eye of recruiters.

Developer training platform CodingDojo scoured task advertisements on occupations site Indeed to discover out which programming languages are in maximum desire in 2022.

It found that Python, Java, SQL and JavaScript appeared the most routinely in developer career adverts, every single showing in far more than 50,000 listings on Indeed. All 4 saw a important jump in need when compared to 2020-2021, mentioned CodingDojo: “This makes lots of feeling looking at the U.S. overall economy by itself has witnessed more jobs established in 2021 than any other calendar year on report. Though restoration from the situations of March 2020 took some time – and in many respects is even now happening – pc programming work have appear back again and then some.”

The programming language in most demand from customers, according to the knowledge analysed by Coding Dojo, is Java. Extensively employed in Android cell apps, desktop programs, sensible TVs and elsewhere, the Java programming language was found in additional than 80,000 energetic positions listings on Certainly.

The conclusions point out that Java – a legacy technologies by all accounts – is making some thing of a comeback immediately after its recognition waned marginally in 2020 and 2021, pushed down the rankings by Python, which has observed continual advancement in level of popularity in modern yrs.

SEE: Developer work opportunities and programming languages: What’s warm and what is subsequent

CodingDojo found that the tables had turned in 2022. In 2020 and 2021, Python was the programming language that appeared most routinely on Indeed, but the sharp expansion of Java about the previous year had pushed Python into second location.

In actuality: “Python was the only well-known programming language to only see a tiny dip slipping from all-around 74,000 work to 70,500,” mentioned Coding Dojo.

That claimed, Python is still an unbelievably useful language for software program builders to understand, notably with the progress of knowledge science purposes and device understanding – both of those of which are attracting a good deal of curiosity from present day corporations. As this sort of, demand from customers for Python is nonetheless growing, with CodingDojo pointing out that it only fell to the range two location simply because demand from customers for programmers who know Java improved so significantly.

It is truly worth noting that analyses of the acceptance of various programming languages range in their methodologies, meaning rankings of this form are not an exact science and have a tendency to change.

That stated, they can give us a standard notion of what skills and programming languages businesses are looking for when employing developers.

A person of the most notable adjustments to the 2022 rankings was the need for Go, the open-supply programming language

Read More

Visualizing Apple’s Increase to the Top rated of the Gaming Organization

The Carbon Footprint of Transportation

As concern about climate adjust has developed, folks are turning out to be ever more conscious of their effects on the surroundings.

Transportation emissions generally make up the largest portion of our specific carbon footprints. For that reason, analyzing transport possibilities is a all-natural position to start off, irrespective of whether it is for a day-to-day commute or a leisure vacation abroad.

So, what’s the most eco-friendly way to go from a single spot to a further?

The over infographic charts the carbon footprint of transportation for each passenger-kilometer for distinct vehicles centered on data from the Uk Government’s methodology paper for greenhouse fuel reporting.

Editor’s take note: Due to the fact the unique labels in the review are very Uk-precise, we have altered the copy of some of the labels to greater match an global audience.

Planes, Trains and Vehicles: How Carbon Footprints Examine

The carbon footprint of transportation is calculated in grams of carbon dioxide (CO2) equivalents emitted for every individual to travel a single kilometer. This contains both of those carbon dioxide and other greenhouse gases.

Here’s how the carbon price tag of travel compares for different suggests of transport:

Means of Transportation CO2 equivalent emissions per passenger km
Short Flight ✈️ 255g
Medium Car or truck (Gasoline) ? 192g
Medium Auto (Diesel) ? 171g
Medium Flight ✈️ 156g
Extensive Flight ✈️ 150g
Bus ? 105g
Medium Bike ? 103g
Gasoline Car or truck (Two Passenger) ? 96g
Medium Electric Vehicle ? 53g
Nationwide Rail ? 41g
Ferry ⛴ 19g
Eurostar (Global Rail) ? 6g

Flying on a short flight or driving on your own are the most carbon-intensive travel techniques. However, adding 1 extra passenger to your automobile finishes up chopping the emissions in half, building driving additional economical.

Especially, it is value breaking down types of flights much more, as their emissions rely considerably on their route length:

  • Shorter Flights: For example, domestic flights within just a European place, or flights in a U.S. point out have the best specific carbon footprint.
  • Medium Flights: For instance, global journey within just Europe, or among U.S. states, have a appreciably reduce carbon footprint per person.
  • Long Flights: Flights around 3,700 km (2,300 mi), about the length from Los Angeles to New York, have the lowest carbon footprint for every person.

Why are for a longer time flights much extra eco-pleasant than quick-assortment flights? It is because acquire-off employs substantially a lot more vitality than the ‘cruise’ stage of a flight. For small flights, the successful cruise period is relatively limited-lived.

Shrinking Your Vacation Footprint

As the environment functions to mitigate the affect of climate transform, men and women may perhaps want to determine and most likely minimize their every day carbon footprint. And picking out your method of transportation is one way to do so.

Of study course, walking, biking, or working are the lowest-carbon methods to go from a person area to another. But motor

Read More