0% found this document useful (0 votes)
17 views2 pages

Python Exercises

The document contains a series of simple programming exercises designed to teach basic coding concepts. Each exercise includes a brief description and the corresponding Python code, covering tasks such as printing messages, performing arithmetic operations, and working with lists and loops. The exercises aim to engage users in hands-on coding practice.

Uploaded by

miloga4905
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Python Exercises

The document contains a series of simple programming exercises designed to teach basic coding concepts. Each exercise includes a brief description and the corresponding Python code, covering tasks such as printing messages, performing arithmetic operations, and working with lists and loops. The exercises aim to engage users in hands-on coding practice.

Uploaded by

miloga4905
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Hello, World!

• Print "Hello, World!" to the console.


print("Hello, World!")

2. Simple Sum
• Create a program that adds 5 + 3 and prints the result to the console.
result = 5 + 3
print(result)

3. Personal Greeting
• Ask the user for their name and print a greeting message.
name = input("What is your name? ")
print("Hello, " + name + "!")

4. Count to Ten
• Use a loop to print the numbers 1 to 10.
for i in range(1, 11):
print(i)

5. Simple List
• Create a list of 5 fruits and print the list to the console.
fruits = ["apple", "banana", "cherry", "date", "elderberry"]
print(fruits)

6. List Addition
• Add a new fruit to your list of fruits and print the updated list.
fruits.append("fig")
print(fruits)

1
7. Easy Multiplication
• Create a program that multiplies 7 by 6 and prints the result.
result = 7 * 6
print(result)

8. Favorite Color
• Ask the user for their favorite color and print a message saying "X is a nice
color!", replacing X with the user's input.
color = input("What is your favorite color? ")
print(color + " is a nice color!")

9. Simple Division
• Create a program that divides 8 by 4 and prints the result.
result = 8 / 4
print(result)

10. Days of the Week


• Create a list with the days of the week and print each day on a new line using
a loop.
days_of_week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
"Sunday"]
for day in days_of_week:
print(day)

You might also like