Challenge: Create a More Complex Function
Python 3.6 has a way to format strings that allows you to use built-in expressions inside string constants. This approach is called f-strings
. Let's look at the examples.
12string = 'world' print(f'Hello, {string}')
Let's look at the syntax. All text you want to print must be enclosed in quotation marks preceded by an f, and any variables you want to print within that text must be enclosed in curly braces. You will also need to use f-strings in the task.
Swipe to start coding
Let's complicate the task. You have to create a function named function()
, and create a variable inside a function as capital
, assign a value like London
; use f-strings
and print()
function to display the following text: London is the capital and largest city of England and the United Kingdom
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 5.56Awesome!
Completion rate improved to 5.56
Challenge: Create a More Complex Function
Python 3.6 has a way to format strings that allows you to use built-in expressions inside string constants. This approach is called f-strings
. Let's look at the examples.
12string = 'world' print(f'Hello, {string}')
Let's look at the syntax. All text you want to print must be enclosed in quotation marks preceded by an f, and any variables you want to print within that text must be enclosed in curly braces. You will also need to use f-strings in the task.
Swipe to start coding
Let's complicate the task. You have to create a function named function()
, and create a variable inside a function as capital
, assign a value like London
; use f-strings
and print()
function to display the following text: London is the capital and largest city of England and the United Kingdom
Рішення
Дякуємо за ваш відгук!
single
Awesome!
Completion rate improved to 5.56
Challenge: Create a More Complex Function
Свайпніть щоб показати меню
Python 3.6 has a way to format strings that allows you to use built-in expressions inside string constants. This approach is called f-strings
. Let's look at the examples.
12string = 'world' print(f'Hello, {string}')
Let's look at the syntax. All text you want to print must be enclosed in quotation marks preceded by an f, and any variables you want to print within that text must be enclosed in curly braces. You will also need to use f-strings in the task.
Swipe to start coding
Let's complicate the task. You have to create a function named function()
, and create a variable inside a function as capital
, assign a value like London
; use f-strings
and print()
function to display the following text: London is the capital and largest city of England and the United Kingdom
Рішення
Дякуємо за ваш відгук!