Python fundamental exercises

Run Settings
LanguagePython
Language Version
Run Command
print("Hello World!") print(10-5) print(3*3) print(10.2) print(7+3) #variables programming_language="Python" print(programming_language) #two variables word1="Hello" word2="World!!" print(word1, word2) # Operation With Two Variables variable1=10 variable2=5 variable3=variable1+variable2 print(variable3) variable4=(variable1-variable2)*variable3 print(variable4) # Display Variables in the Console More Easily # use of Python's f-strings text="Python" print(f'This training is designed for learning {text} through practice.') # rounding the numbers to the decimal points: formula = {number:.nf), n = upto what decimal points number=14.6749813 print(f'Number rounded to two decimals: {number:.2f}') print(f'Number rounded to four decimals: {number:.4f}') print(f'Number rounded to no decimals: {number:.0f}') # Determine the Type of a Variable (Text, Number, Boolean...) text = "This is a text" integer_number = 10 floating_number = 1.5 boolean = True print(type(text)) print(type(integer_number)) print(type(floating_number)) print(type(boolean)) # Reverse the Order of Letters in a Text text_to_reverse="This is a course for learning Python through practice!" print(text_to_reverse[::-1]) # Convert All Uppercase Characters to Lowercase Uppercase_to_lowercase = "LEARNING THROUGH PRACTICE IS THE BEST WAY TO LEARN" print(Uppercase_to_lowercase.lower()) text2 = "WHAT ARE THE WORST THINGS PEOPLE OVERSPEND ON IN THE U.S.?" print(text2.lower()) # Convert All Lowercase Characters to Uppercase text1 = "what are the worst things people overspend on in the u.s.?" print(text1.upper()) text3 = "learning by doing is the best way to learn" print(text3.upper()) # Capitalize the firt letter of a sentence text4 = "what are the worst things people overspend on in the u.s.?" print(text4.capitalize())
Editor Settings
Theme
Key bindings
Full width
Lines