Simple Calculator Create A Program That Takes Two Numbers From The User and Prints Their Sum - 030609
Simple Calculator Create A Program That Takes Two Numbers From The User and Prints Their Sum - 030609
Simple Calculator Create a program that takes two numbers from the user and prints
their sum.
3. Even or Odd
Write a Python program that asks the user for a number and tells them whether it’s even or
odd.
4. Age in Dog Years Ask the user for their age and tell them how old they are in dog years
(1 human year = 7 dog years).
Write a program that randomly chooses a number between 1 and 10 and asks the user to guess
the number.
import random
if guess == secret_number:
print("You guessed it right!")
else:
print(f"Wrong! The secret number was {secret_number}.")
6. Multiplication Table
Create a program that asks the user for a number and prints the multiplication table for that
number.
Write a program that prints a triangle of stars (*) based on a number the user inputs. For
example, if the user enters 5, it should print:
**
***
****
*****
rows = int(input("Enter the number of rows for the triangle: "))
for i in range(1, rows + 1):
print("*" * i)
8. Sum of Digits
Ask the user for a number and calculate the sum of its digits.
9. Reverse a String
Write a program that asks the user for a word and prints the word in reverse order.