likes = 9999 #All ways to print in console in python
print(f"A like if you love learning python with grepper. Likes:{likes}")
#or
print("A like if you love learning python with grepper. Likes:" + likes)
#or
print("A like if you love learning python with grepper. Likes:", likes)
#Normal:#
print("Hiya Grepper!") #Output: Hiya Grepper!#
#As Equation:#
print(1+1) #Output: 2#
#With String Variables:#
x = 'Pog'
print(x + 'Champ') #Output: PogChamp#
#With Integer Variables:#
y = 9999
z = str(y)
print('You have ' + z + ' IQ') #Output: You have 9999 IQ#
#NOTE: Not converting the int variable to a str variable will return an error#
# To print a string...
print("I am a string yay")
# To print an answer to an equation...
print(5+5)
# To print the answer of previously defined variables...
x = 50
n = 30
print(x + n)
# Notes:
# You can't add a string to a number.
x = "foo"
n = 50
print(x + n)
# That will come up with an error.
x = 10
y = 5
print(x) # 10
print("x is ",x) # x is 10
print(x,y) # 10 5
print("sum of", x, "and", y, "is", x+y) # sum of 10 and 5 is 15
mCar = "A"
print(mCar * y) # AAAAA
likes = 9999
print(f"A like if you love learning python with grepper. Likes:{likes}")
#or
print("A like if you love learning python with grepper. Likes:" + likes)
#or
print("A like if you love learning python with grepper. Likes:", likes)
# Printing, the basics of Python...
# Btw this is how you print a statement or anything in the terminal/console.
print("your printing statement")
# Above basically makes use of a built-in function called print which just
# shows your writing in the console. You can print variables also using print.
# Very easy to use. Hope I helped. Thanks!
# By Codexel (yea, i changed my username AGAIN...)
# You can use ' or "
# Print a text string in JavaScript
print('My text')
# Print a variable in JavaScript
my_variable = str('Text')
print(my_variable)
# Print a number in JavaScript
print(123)
'''
print()inside the parentheses put a single colon or double colon
'''
# example like this
print("this how you use print statement")
# or like this
print('other way to print in python')
#please use the print keyword
print()
#pleease enter the value to print
print(1)
# if integers means you can use without single quotes or double quotes or triple quotes
print("nidhsih")
#one of the advantage of python you didn't want to use semi-colon in the end of the statements
# How to print in Python
print("Hello World!")
# How to print multiple words using comma separator
print("Hi", "there")
# How to separate the objects if there is more than one.
print("Chelsea","Liverpool", sep="-vs-")
#Specify what to print at the end. Default is '
'
print("Hello World",end="!")
# or use empty string "" for no new line
print("Hello World",end="")
#('') a string, to indicate it is a string you can use ("") or ('')
print("hello world")
#a integer
print(19)
# a float:
print(4.5)
# a bool:
print (True)
print (False)
# The print() funtion in python:
print("Hello World!") # Prints Hello World to the terminal,
# with a line break afterwards.
print(65+23) # Prints 88 to the terminal, with a line break
print("There is no line break here!", end="")
# Prints There is no line break here to the terminal, but replacing the line
# break with nothing.
# The end parameter is what to put after the text. It's default value is a "
",
# or line break
#printing inputs
print(input("whatever u want to say "))
#or u can use preloaded inputs
input_value=input("whatever u want to say ")
print(input_value)
print("Type you'r string here!")
# String is something that is in 2 of "" this is called string
# Print function runs the function to print text in python
# You type print() first
# Give it "" double quotes
# Type whatver you want to print in that double qoutes
2 + 1
#Addition is done by Python, but doesn't show us the answer
print(2 - 1)
#output - 1 (This will solve and show us the answer, 2,1 and 3 all are integers)
x = 2 * 1
print(x)
#output - 2 (We have printed the varible and got the answer, all are integers)
x = 2
y = 1
print(x / y)
#output - 2.0 (When division is done answer is given as a float)
x = "2"
y = "1"
print(x + y)
#output - 21 (When two strings are added, it concatenate and the answer
# is also a string)
Python:
#Variables
action = 'vote a like'
goodbyeMessage = 'Goodbye!'
#Prints:
print('Welcome to a game!')
print('Do not forget to ', action + ', alright?')
print(str(goodbyeMessage))
JavaScript:
'Variables:'
var a = 'Hello again!'
var b = '!'
'Prints(logs):'
console.log('Hi!')
console.log(a)
console.log('Hello' + b)
print('hello world') #print can write a string a number or a variable
#for example you can 'print' a number
print(1) #if you want to print a number you can print it without '' or ""
#we can print a variable
string = 'hi'
print(string) #if you want to print a variable you can print it without '' or ""
print(" Welcome to the 100 game
")
print("To start the game you have to enter a number between 1 to 10")
print("To end the game you have to reach the number 100")
print("First one reach 100 win
")
print("Good luck
")
nums = 0
# Display numbers
def display_state():
global nums
print("100/",nums)
# Get number the player wants to play
def get_input(player):
valid = False
while not valid: # Repeat until a valid move is entered
message = player + " player please enter the number between 1 and 10: "
move = input(message) # Get move as string
if move.isdigit(): # If move is a number
move = int(move) # can take 1-10 number only
if move in range(1, 11) and nums + move <= 100:
valid = True
return move
# Update numbers after the move
def update_state(nums_taken):
global nums
nums += nums_taken
# Check if he/she is taking the last move and loses
def is_win():
global nums
if nums > 99:
return True
# define the 100 game
def play__100_game():
display_state()
while (True): # Repeat till one of them loses
first = get_input("First")
update_state(first)
display_state() # Display new numbers
if (is_win()):
print("First player won")
break
second = get_input("Second")
update_state(second)
display_state()
if (is_win()):
print("Second player won")
break
play__100_game()
#you first need to have an event to fire a piece of code.
#with that i use the if statement
can_run = True
if can_run:
print("ok i,m printing")
#you can print varibles(strings) too
the_4_words = "ok i,m printing varibles"
if can_run:
print(the_4_words)