Programming question

Description

**Variables and Data Types:**

Don't use plagiarized sources. Get Your Custom Assignment on
Programming question
From as Little as $13/Page

a. Declare a variable `name` and assign your name to it.

b. Create variables for storing an integer, a float, and a string.

2. **Conditional Statements:**

a. Write a program that checks if a given number is even or odd.

b. Create a program that determines whether a student’s grade is ‘A’, ‘B’, ‘C’, ‘D’, or ‘F’ based on their score.

3. **Loops:**

a. Write a loop that prints the numbers from 1 to 10.

b. Using a loop, calculate the sum of all numbers from 1 to 100.

4. **Lists:**

a. Create a list of your favorite colors and print the third color in the list.

b. Write a program to find the largest element in a given list of numbers.

5. **Functions:**

a. Define a function that takes two parameters and returns their sum.

b. Create a function that checks if a given number is prime.

6. **Dictionaries:**

a. Define a dictionary representing a person’s information with keys like “name,” “age,” and “city.”

b. Write a program that counts the frequency of each character in a given string using a dictionary.

7. **File Handling:**

a. Create a text file with a few lines of text. Write a program to read and print the contents of the file.

8. **Exception Handling:**

a. Write a program that asks the user for input and handles a ValueError if the input is not a number.

b. Create a program that opens a file and handles a FileNotFoundError if the file doesn’t exist.