This section contains many Python programming exercises for the beginner series.
They include: numbers, strings, lists, tuple, if statements, functions and more.
1. What is Python?
2. Who made Python?
3. When was Python created?
4. What does this program do?
x = 5 print(x)
1. Create a program that asks the user for x and y, sum the output.
2. How do you calculate the root of x?
3. Are floating point calculations always accurate?
4. Which datatypes exist in Python?
1. Create a program that asks the user for a word and return the capitalized word.
2. Print the first character of a string.
3. Slice the string “Hello World” into “World”
4. Create a program that asks a password and check the result.
5. Which character creates a newline?
6. Given string s, what is s and s ?
7. What does print(s[-1]) do ?
8. What does print(s[:3]) do?
1. Create a shopping list and print it.
2. Do the same as 1, but reverse the list.
3. Ask the user for keyboard input, add it to a list, print the list.
4. Create a list and sort it.
5. Create two lists and combine them into a new list.
1. What is the difference between a list and a tuple?
1. Create a dictionary and request an item.
1. What does the != operator mean?
2. What does the == operator mean?
3. What does the > operator mean?
4. What does the < operator mean?
5. Create a program that asks for an age and if the age is valid.
6. What is the difference between = and ==?
1. Create a function that adds two numbers.
2. Create a function that prints your name.
1. Which types of loops exist?
2. Given a list, print all the element.
3. Print the numbers 1 to 10 using a loop
4. Given the list [“Python”,”Java,”C++”,”Perl”], print all the elements.
5. Given the list [2,3,6,9,13,16] calculate the sum of all the elements.
6. Given the list [2,3,6,9,13,16] calculate the square root for each element.
7. Create a list using a for loop. Add even numbers to the list.
8. Calculate the fibonacci sequence using a for loop.
1. Do you first create objects or first classes?
2. When is a constructor called?
3. Create a class Player with the variables: name, score
4. What is the purpose of self?
5. Is a constructor inside a class optional?
6. Are class variables the same as global variables?
7. Explain inheritance.
8. Create a class that uses inheritance.
9. Is multiple inheritance possible in Python?