Quiz 1
Quiz 1
1000
2000
3000
ANSWER:
print("Hello World!")
print('Welcome to Python!')
print()
print()
print(1000)
print(2000)
print(3000)
#####
QUESTION:
Write a program with the following variables
first_name = "John"
virus_found = False
and display the data types of these variables
ANSWER:
first_name = "John"
virus_found = False
#####
QUESTION:
Write a program with the following variables
first_name = "John"
last_name = "Smith"
ANSWER:
# name details
first_name = "John"
last_name = "Smith"
QUESTION:
Write a program that uses string multiplication and display the following output
frogfrogfrog
catcatcatcatcat
ANSWER:
# display some silly strings
silly1 = "frog" * 3
silly2 = 5 * "cat"
print(silly1)
print(silly2)
#####
QUESTION:
Write a program that asks the user to enter first name and last name,
then display the full name.
The program must work exactly like the following example.
Enter your first name: Frogory
Enter your last name: Green
My name is Frogory Green.
ANSWER:
# ask the user to enter first name and last name
first_name = input("Enter your first name: ")
last_name = input("Enter your last name: ")
#####
QUESTION:
The following program generates compile error.
Fix the error.
ANSWER:
# favorite number
fav_number = 7
#####
QUESTION:
Write a program that asks the user to enter 2 integers and display the sum.
The program must work exactly like the following example.
ANSWER:
# Ask the user to enter 2 integers and display the sum
user_input1 = input("Enter the 1st integer: ")
number1 = int(user_input1)
#####
QUESTION:
Write a program that asks the user to enter 2 decimal numbers and displays the sum.
The program must work exactly like the following example.
ANSWER:
# Ask the user to enter 2 decimal numbers and display the sum
user_input = input("Enter the 1st number: ")
number1 = float(user_input)
#####
QUESTION:
Write a program that displays the following exact output
Welcome to Unimovies!
Thursday July 30 at 7.15pm: "Inside Out"
ANSWER:
print("Welcome to Unimovies!")
print('Thursday July 30 at 7.15pm: "Inside Out"')
#####
#Program 1:
print("dog")
print("cat")
print("kangaroo")
#Program 2:
print("dog", end="*")
print("cat", end="*")
print("kangaroo", end="*")
#Program 3:
print("dog", end="XYZ")
print("cat", end="XYZ")
print("kangaroo", end="XYZ")
#Program 4:
print("dog", end="")
print("cat", end="")
print("kangaroo", end="")
#Program 5:
print("dog", end=", ")
print("cat", end=", ")
print("kangaroo", end=".")
print(2000)
#Program 6:
print("dog", end=", ")
print("cat", end=", ")
print("kangaroo", end=".")
print()
print(2000)