Rédigé par des étudiants ayant réussi Disponible immédiatement après paiement Lire en ligne ou en PDF Mauvais document ? Échangez-le gratuitement 4,6 TrustPilot
logo-home
Examen

Python Exam Chapters 1-5 Questions & Answers

Note
-
Vendu
-
Pages
15
Grade
A+
Publié le
15-11-2025
Écrit en
2025/2026

Python Exam Chapters 1-5 Questions & Answers What should the following two expressions evaluate to ? 'spam' + 'spamspam' 'spam' * 3 - ANSWERS-Both expressions evaluate to the string 'spamspamspam'. Why is egg a valid variable name while 100 is invalid ? - ANSWERS-Variable names cannot begin with a number. What three functions can be used to get the integer, floating-point number, or string version of a value ? - ANSWERS-The int(), float(), and str() functions will evaluate to the integer, floating-point number, and string versions of the value passed to them. Why does this expression cause an error ? How can you fix it ? 'I have eaten' + 99 + 'burritos' . - ANSWERS-The expression causes an error because 99 is an integer, and only strings can be concatenated to other strings with the + operator. The correct way is i have eaten ' + str(99) + ' burritos '. What are the two values of the Boolean data type? How do you write them? - ANSWERS-True and False, using capital T and F, with the rest of the word in lowercase. What are the three Boolean operators? - ANSWERS-and, or, and not. Write out the truth tables of each Boolean operator (that is, every possible combination of Boolean values for the operator and what they evaluate to). - ANSWERS-True and True is True. True and False is False.

Montrer plus Lire moins
Établissement
Python
Cours
Python

Aperçu du contenu

Python Exam Chapters 1-5 Questions
& Answers15

What should the following two expressions evaluate to ?

'spam' + 'spamspam'

'spam' * 3 - ANSWERS-Both expressions evaluate to the string 'spamspamspam'.



Why is egg a valid variable name while 100 is invalid ? - ANSWERS-Variable names cannot begin
with a number.



What three functions can be used to get the integer, floating-point number, or string version of
a value ? - ANSWERS-The int(), float(), and str() functions will evaluate to the integer, floating-
point number, and string versions of the value passed to them.



Why does this expression cause an error ? How can you fix it ?

'I have eaten' + 99 + 'burritos' . - ANSWERS-The expression causes an error because 99 is an
integer, and only strings can be concatenated to other strings with the + operator. The correct
way is i have eaten ' + str(99) + ' burritos '.



What are the two values of the Boolean data type? How do you write them? - ANSWERS-True
and False, using capital T and F, with the rest of the word in lowercase.



What are the three Boolean operators? - ANSWERS-and, or, and not.



Write out the truth tables of each Boolean operator (that is, every possible combination of
Boolean values for the operator and what they evaluate to). - ANSWERS-True and True is True.

True and False is False.

, False and True is False.

False and False is False.

True or True is True.

True or False is True.

False or True is True.

False or False is False.

not True is False.

not False is True.



What do the following expressions evaluate to ?

(5 > 4) and (3 == 5)

not (5 >4)

(5 > 4) or (3 == 5)

not ((5 > 4) or (3 == 5))

(True and True) and (True == False)

(not False) or (not True) - ANSWERS-False

False

True

False

False

True



What are the six comparison operators ? - ANSWERS-==, !=, <,>,<=,and >=



What is the difference between the equal to operator and the assignment operator ? -
ANSWERS-== is the equal operator to operator that compares two values and evaluates to a
Boolean, while = is the assignment operator that stores a value in a variable.

École, étude et sujet

Établissement
Python
Cours
Python

Infos sur le Document

Publié le
15 novembre 2025
Nombre de pages
15
Écrit en
2025/2026
Type
Examen
Contient
Questions et réponses

Sujets

€10,70
Accéder à l'intégralité du document:

Mauvais document ? Échangez-le gratuitement Dans les 14 jours suivant votre achat et avant le téléchargement, vous pouvez choisir un autre document. Vous pouvez simplement dépenser le montant à nouveau.
Rédigé par des étudiants ayant réussi
Disponible immédiatement après paiement
Lire en ligne ou en PDF


Document également disponible en groupe

Faites connaissance avec le vendeur

Seller avatar
Les scores de réputation sont basés sur le nombre de documents qu'un vendeur a vendus contre paiement ainsi que sur les avis qu'il a reçu pour ces documents. Il y a trois niveaux: Bronze, Argent et Or. Plus la réputation est bonne, plus vous pouvez faire confiance sur la qualité du travail des vendeurs.
Bensuda Oxford University
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
874
Membre depuis
3 année
Nombre de followers
445
Documents
22594
Dernière vente
1 jours de cela
ECONOMICS,NURSING,BIOLOGY AND ALL REVISION MATERIALS

DEDICATED TO PROVIDE YOU WITH THE BEST LEARNING MATERIALS THAT WILL IMPROVE YOUR GRADES ,WELCOME TO ALIZGRADES AND LETS DO IT TOGETHER!!! GOODLUCK!!!!!!!

3,7

164 revues

5
77
4
25
3
25
2
11
1
26

Documents populaires

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions