Concatenation
Let's consider the operations you can do with strings.
First, you may write several lines together by concatenating them (using the + operator). If you need to write some number together with a string, you should convert a number to string by using the str() function.
123456# Two strings and one number string_1 = "I would like to learn Python more than " number = 2 string_2 = " hours a day." # Connect parts together print(string_1 + str(number) + string_2)
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Posez-moi des questions sur ce sujet
Résumer ce chapitre
Afficher des exemples du monde réel
Génial!
Completion taux amélioré à 2.7
Concatenation
Glissez pour afficher le menu
Let's consider the operations you can do with strings.
First, you may write several lines together by concatenating them (using the + operator). If you need to write some number together with a string, you should convert a number to string by using the str() function.
123456# Two strings and one number string_1 = "I would like to learn Python more than " number = 2 string_2 = " hours a day." # Connect parts together print(string_1 + str(number) + string_2)
Merci pour vos commentaires !