Thanks for trying to help me. I couldn't get the indentation right, so I ended up deleting all the tabs in the script (
) and using 1 space as indentation...
EDIT: Would someone mind to review my code? I'm a real beginner so I've to be sure I teach myself good coding habits and a good style 
This is one of my first programs (well I actually don't think you can really call it a program
)
Here's the latest (and the greatest
) source code of my "program":
Code:
import os
import sys
class Car:
"""
This class represents a car. You can add and read info about it's instances.
"""
def __init__(self, car_basic_info = {}):
self.car_basic_info = car_basic_info
search_engine = "DuckDuckGo"
self.search_engine = search_engine
return None
def load_basic_info(self, info_type, info_value):
if info_type == "Brand":
self.car_basic_info["Brand"] = info_value
elif info_type == "Model":
self.car_basic_info["Model"] = info_value
elif info_type == "Color":
self.car_basic_info["Color"] = info_value
elif info_type == "Model Year":
self.car_basic_info["Model Year"] = info_value
else:
print("Are you sure you entered the right thing?")
ynin = input("If you're really sure type 'yes' and press enter to continue: ")
if ynin == "yes":
self.car_basic_info[info_type] = info_value
else:
pass
def list_basic_info(self):
for x in self.car_basic_info.values():
print(x)
def search_info_on_web(self):
try:
self.web_search_text_raw = self.car_basic_info["Brand"] + " " + self.car_basic_info["Model"]
if self.search_engine == "Google":
web_search_text = self.web_search_text_raw.replace(" ", "%20")
os.system("firefox www.google.com/search?q=%s" % web_search_text)
elif self.search_engine == "DuckDuckGo" or "Yahoo" or "Bing":
web_search_text = self.web_search_text_raw.replace(" ", "+")
print("firefox http://www.%s.com/search?q=%s" % (self.search_engine.lower(), web_search_text))
os.system("firefox http://www.%s.com/search?q=%s" % (self.search_engine.lower(), web_search_text))
except KeyError:
print("Not enough information avaible to perform a web search! Please enter brand name and model name")
def set_search_engine(self, search_engine_name):
if search_engine_name == "DuckDuckGo":
print("Search engine set to the DuckDuckGo, the popular alternative search engine. With handy zero-click boxes")
self.search_engine = search_engine_name
elif search_engine_name == "Google":
print("Search engine set to Google, the most popular search engine with best search results")
self.search_engine = search_engine_name
elif search_engine_name == "Yahoo":
print("Search engine set to Yahoo, an widely used alternative to Google")
self.search_engine = search_engine_name
elif search_engine_name == "Bing":
print("Search engine set to Bing, Microsoft's new alternative search engine")
self.search_engine = search_engine_name
else:
print("Error 404, search engine not found! \nSorry but this program does not support that search engine :(")
Thanks in advance,
Superpelican
Bookmarks