GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Modul 4 von 11 · Text

Using variables

David Khieu

Using variables

You're allowed to use as many variable declarations as you need to achieve your goa;, like this:

 

var = 1

account_balance = 1000.0

client_name = 'John Doe'

print(var, account_balance, client_name)

print(var)

You're not allowed to use a variable which doesn't exist (in other words, a variable that was not assigned a value).

This example will cause an error:

var = 1 print(Var)

We've tried to use a variable named Var, which doesn't have any value (note: var and Var are different entities, and have nothing in common as far as Python's concerned).

REMEMBER

You can use the print() function and combine text and variables using the + operator to output strings and variables, e.g.:

var = "3.8.5"

print("Python version: " + var)

Can you guess the output of the snippet above? 

Python version: 3.8.5

 

Anleitung

Um im Kurs weiterzukommen, sende einen Versuch dieses Quiz ab. Du kannst ihn nach der letzten Frage absenden.

Zum gewählten Modul

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck