Python Basics

"You cannot be great at the start, but you have to start to be great. So, making a beginning is important. In this list of questions, get your feet wet,before beginning a more arduous Python journey"

— All the best

Print

  1. Print your favorite animal's name.
  2. Print a message saying "I love Python programming!".
  3. Print three separate sentences about your favorite hobby, each on a new line.
  4. Print a short story using triple quotes that includes at least two paragraphs.
  5. Write a program that prints the message, "Success is achieved twice, first in your brain then in the real world".
  6. For example, the output should look like this: "Success is achieved twice, first in your brain then in the real world"
  7. Write a program that prints the following four lines using a single print function and only double quotes (" ").
  8. For example, the output should look like this:
    What is this life if, full of care,
    we have no time to stand and stare.
    No time to stand beneath the boughs
    and stare as long as sheep or cows.
  9. Write a program that prints the following direct statement using a single print function and only double quotes (" ").
  10. For example, the output should look like this:
    She said to me,"I want to learn Python."
  11. Print a the following message using a single print function and only triple quotes (''' ''').
  12. Print a the following message using a single print function and only double quotes (""). No loops has to be used.
  13. Write a program that prints a name 5 times vertically, with one name per line. Don't use loops.
  14. For example, if the name is John, the output should look like this:
    John
    John
    John
    John
    John
  15. Write a program that prints a name 5 times horizontally on a single line. Don't use loops.
  16. For example, if the name is John, the output should look like this:
    John John John John John
  17. Write a program that prints the title Elvin's book using a single print statement and single inverted commas (' ').
  18. For example, the output should look like this:
    'Elvin's book'
  19. Print the following pattern using format function within the print function:
  20. Print the following pattern using format function within the print function:
  21. Print a short poem you like, ensuring each line is on a new line.
  22. Print a description of your dream vacation using both single and double quotes.
  23. Print a message that uses emojis or special characters (like ♥️ or 😊) to express an emotion or idea.

  24. Variables

    • Declare a variable to store a number. Print the value of the variable.
    • Declare a variable called helpline_number to store the national emergency number of your country and print the message: "In any emergency, contact [helpline_number]."
    • Declare a variable to store the name of a country and a second variable called helpline_number to store the national emergency number. Print the message: "In any emergency in [country name], contact [helpline_number]."
    • Declare a variable to store a first number and a second variable to store a second number. Declare a third variable to store their sum and print it.
    • Declare a variable to store a first number and a second variable to store a second number. Declare four extra variables to store the sum, difference, product, and division of the two numbers and print them.
    • Assign the value "25" to a variable called age and print the message: "I am 25 years old."
    • Assign the values "25" and "Engineering" to variables age and major, respectively. Print the message: "I am 25 years old and studying Engineering."
    • Declare a variable city with the value "New York" and print the message: "I live in \'New York.\'"
    • Create three variables, city, state, and country, with the values "New York", "NY", and "USA", respectively. Print the message: "I live in New York, NY, USA."
    • Declare two variables, price and discount, with the values "100" and "20", respectively. Then, calculate and print the discounted price (price - discount).
    • Create three variables, num1, num2, and num3, with the values "10", "20", and "30", respectively. Calculate and print the average of the three numbers.
    • Declare a variable x with the value "5". Then, calculate and print the value of x squared (x^2).
    • Assign the value "10" to a variable y. Then, calculate and print the value of y multiplied by 3.
    • Create a variable z with the value "2". Then, calculate and print the value of z cubed (z^3).
    • Create three variables, e, f, and g, with the values "2", "3", and "4", respectively. Then, calculate and print the value of e multiplied by f plus g.
    • Write the Python expression for the following:

      1. ( a + b ) 2 + c

      2. a 2 + b 2

      3. x3 + y3 + x y 3

      4. a2 + b2 a2 - b2

      5. z = ab + bc + ca 3abc

      6. z = ab + bc + ca 3abc

      7. a = 0.05 - 2 y 3 x - y

      8. ( a + b ) n 3 + b

      9. ax + by x 3 + y 3

Find it difficult?

Don’t lose heart, don’t be under confident, just be consistent in your preparation and be sure of everything you’ve studied. You can request a class so that we can help you understant this topic.

Feel Confident?

Your first step in learning any new topic is to be aware of your strengths and weaknesses. Once you know this, your self-preparation can be meaningful and result-oriented. Attempt an quiz to get tested.