The Dallas 18B20 is probably the most common temperature sensor in the Arduino community. It's cheep, it's small and part of many Arduino startet kits.
Wiring
The left pin is the Ground (GND) pin. The middle is the data line. We connect the data line to digital pin 2 (D2). The right pin can be connected to 3V3 or to 5V. And since this sensor works on the 1-wire bus, we have to connect the data line also to VCC though a 4.7kOhm resistor.
Video
Here is the Video of the process.
Code
Just install a library for the Dallas sensor and open the simple sketch
DallasTemperature library
The simple sketch
If you run the serial monitor, you can see the actual temperature.
The DHT11/DHT22 is a quite popular sensor in the maker scene. It's a temperature and humidity sensor.
Easy-to-use, quite accurate and also affordable. If you're looking for examples of self made weather stations, you'll find that many makers use exactly this sensor. There are many different temperature sensors on the market. But only few, cheap humidity sensors.
Wiring
Code
I didn't develop any code for this. Since, when you search for DHT in the Library Manager and install a fitting library, you can load an example and it will work. (see video).
Video
1-Wire bus
While searching the internet I found several different datasheets to this sensor and many different tutorials to this sensor and how to implement a pullup resistor to this. So I tested different configuration myself. And I found out that the sensor would even work without any resistors. The sensor using the 1-Wire bus. So I would recommend using a resistor. About the correct value I'm unsure. But it seems everything between 1kOhm and 10kOhm will work just fine.