Document
Document
The Greeter
Write a program that asks for the user's name tells them hello.
name = input("Enter your name: ")
print("Hello", Ancy)
Output: Enter your name: Ancy
Hello, Ancy
2. What's My Age Again?
Ask for their year of birth and compute their age. Print out their age in the
following format:
year = int(input("Enter your year of birth: "))
yearnow= 2021 - year
print("Your age is", yearnow)
Output: Enter your year of birth:1998
Your age is 23
3. Sum and Mean
Read five numbers in.
Print out their sum and mean.
sum=0
for i in range (5):
sum+= int(input("Enter integer: "))
mean= sum/5
print("Sum:", sum )
print("mean:", mean )
Output: Enter integer: 1
Enter integer: 2
Enter integer: 3
Enter integer: 4
Enter integer: 5
Sum: 15
mean: 3.0
4. Create a string containing a single quote.
print(“Hello ‘Beautiful’”)
Output: Hello ‘Beautiful’
Create a triple quoted string that contains single and double quotes.
print("""hello “Ancy” . Are you from‘Asia’ """)
Output: a