Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I code this in the problem below in python? Create a list, each contai

ID: 3871429 • Letter: H

Question

How would I code this in the problem below in python?

Create a list, each containing a dictionary, to represent a car's attributes

(year, make, model, etc.)

Then, ask the user to input some attributes they are looking for.

Example: Which year? Which make?

Loop through the cars, and if a car matches the user's attributes, print it.

Otherwise, print a message saying nothing was found.

Loop needs to continue if the answer is right or wrong. (If the answer is wrong, continue to ask the same question until it is right. If the answer is right, continue asking the same question, allowing the user to search other car attributes within dictionary list.

Guideline Tips:

- This uses a for loop and an if statement.

- Dictionaries inside of lists are possible.

- Remember, the best solutions are usually simple.

- Don't ask about every attribute. Only ask about a few.

Explanation / Answer

// TypePropertiesDemo.cs
using System;
using System.Text;
using System.tarzon;

namespace tarzon
{
class TypePropertiesDemo
{
static void Main()
{
Type t = typeof(Car);
GetTypeProperties(t);
Console.ReadLine();
}
public static void GetTypeProperties(Type t)
{
StringBuilder OutputText = new StringBuilder();

OutputText.AppendLine("Analysis of type " + t.Name);
OutputText.AppendLine("Type Name: " + t.Name);
OutputText.AppendLine("Full Name: " + t.FullName);
OutputText.AppendLine("Namespace: " + t.Namespace);


Type tBase = t.BaseType;

if (tBase != null)
{
OutputText.AppendLine("Base Type: " + tBase.Name);
}

Type tUnderlyingSystem = t.UnderlyingSystemType;

if (tUnderlyingSystem != null)
{
OutputText.AppendLine("UnderlyingSystem Type: " +
tUnderlyingSystem.Name);
//OutputText.AppendLine("UnderlyingSystem Type Assembly: " +
// tUnderlyingSystem.Assembly);
}

OutputText.AppendLine("Is Abstract Class: " + t.IsAbstract);
OutputText.AppendLine("Is an Arry: " + t.IsArray);
OutputText.AppendLine("Is a Class: " + t.IsClass);
OutputText.AppendLine("Is a COM Object : " + t.IsCOMObject);

OutputText.AppendLine(" PUBLIC MEMBERS:");
MemberInfo[] Members = t.GetMembers();

foreach (MemberInfo NextMember in Members)
{
OutputText.AppendLine(NextMember.DeclaringType + " " +
NextMember.MemberType + " " + NextMember.Name);
}
Console.WriteLine(OutputText);
}
}
}

OUTPUT

Analysis of type Car
Type Name: Car
Full Name: tarzon.Car
Namespace: tarzon
Base Type: Object
UnderlyingSystem Type: Car
Is Abstract Class: False
Is an Arry: False
Is a Class: True
Is a COM Object : False

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote