import Adafruit_DHT
import time
# Sensor type
sensor = Adafruit_DHT.DHT11
# GPIO pin where DATA is connected
gpio_pin = 4
while True:
    humidity, temperature = Adafruit_DHT.read(sensor, gpio_pin)
    if humidity is not None and temperature is not None:
        print("Temperature = 1:.1f1°C".format(temperature))
        print("Humidity = {:.1f}%".format(humidity))
        print(" ------")
    else:
        print("Failed to retrieve data from sensor")
    time.sleep(2)

#VCC to physical pin 1 or 3.3V , data to any gpio pin and ground to 6,9,14


flame sensor:

import RPi.GPIO as gpio 
from time import sleep 

flame = 27
led = 22
gpio.setmode(gpio.BCM)
gpio.setup(flame,gpio.IN)
gpio.setup(led,gpio.OUT)
gpio.output(led,False)
try:
    while True:
        if gpio.input(flame) == 0:
            print("Flame detected")
            gpio.output(led,True)
        else:
            print("No flame detected")
            gpio.output(led,False)
        sleep(0.5)
finally:
    gpio.output(led,False)
gpio.cleanup()

#VCC to pin 1 or 3.3V pin , DO / AOto any gpio , ground to 6 or 9 