Q1:Indentation in Python is for readability only. For each answers give your reason in the comment sections?
Anonymous Quiz
18%
True
82%
False
1.Python Output:
print(): display text or output values
any text in python must be either " double quotes or ' single quotes
print("Double qoutes") #this is correct
print('single quotes') #this is also correct
print(This will cause an error) #SyntaxError: invalid syntax.
Print without a new line:
print("Hello world!", end= " ") #end= "" ...one line
print("hey, this's the same line.")
👉🏾Hello world!, this's the same line
Print Numbers:
print(3 + 5) #8
Casting:
If you want to specify the data type of a variable this can be done with casting
a = str(5) #'5'
b = int(4) #4
c = float(2) #2.0
Get the data type:
you can get the data type of a variable with type()
x = 4
y = "Python"
print(type(x)) # <class 'int'>
print(type(y)) # <class 'str'>
Keep learning💪 don't forget your journey to #MachineLearning
Forwarded from Sanyi
just had my first podcast on the Greatness Show today!
It was an amazing experience talking about how I started programming, , and my journey as a young developer, also talked about my current project a bit.
thanks to Sofia for inviting me, the video will be out soon can’t wait to share it with you all 🤞
@thesanyi
It was an amazing experience talking about how I started programming, , and my journey as a young developer, also talked about my current project a bit.
thanks to Sofia for inviting me, the video will be out soon can’t wait to share it with you all 🤞
@thesanyi
🔥3
Btw, this's a break time😁 the all day it was just..🧑💻and now I'm tried. Take a rest, then back to your businnes🧑💻
SamiTech Code pinned «Hey guys, you should know... 👇 1.Python Output: print(): display text or output values any text in python must be either " double quotes or ' single quotes print("Double qoutes") #this is correct print('single quotes') #this is also correct print(This will…»
""" write a program that accept your name from the user, then display your name
hint use variable, input, user have to insert string """
that's easy try it and don't forget to send your code in the comment sections↩️
Now I've started Python Functions: Topic will be covered;👇
If you're ready let's study together and share idea. No matter you can post what you understand in the group discussion, in addition everyone can ask a question, here we're just friends, students don't think like in the serious place🥰 Go a head and prepare your material open code editor let's do this together 👌
Python Arguments Python *args/**kwargs python Scope Python Decorators Python Lambda Python Recursion Python Generators
If you're ready let's study together and share idea. No matter you can post what you understand in the group discussion, in addition everyone can ask a question, here we're just friends, students don't think like in the serious place🥰
...My progress here👉🏾Python Functions:
#Return Values: function can send data back to the code that called them using the return statements
Question for you don't miss it🚫 what if we code such like this👇
The Pass Statement: function definition can't be empty. if you need to create a function placeholder without any code, use the pass statement
Guess what do you say about pass by your words❓ Hey fam, Lemme see you your answer, thought in the group discussion never stop studying with me 💪
def my_func():
print("Hello this's a functions")
my_func() #calling the functions
my_func() #calling the functions
my_func() #calling the functions what you have to understand👇 def: keyword for defining functions in python my_func(): function_Name. you can just write what you want; dynamic not static😎 finally don't forget to callmy_func( ) otherwise nothing will happen
#Return Values: function can send data back to the code that called them using the return statements
def get_greeting():
return "hello, family this's python programming!"
message = get_greeting()
print(message) what you have to understand👇 return: when we use this, and when we call get_greeting() our value returned.
Question for you don't miss it🚫 what if we code such like this👇
def get_greeting():
return "hello, family this's python programming!"
get_greeting()
The Pass Statement: function definition can't be empty. if you need to create a function placeholder without any code, use the pass statement
def myfunc():
pass Nb: when you run this code nothing will appear but if you clear pass it'll show you IndentationError:
Guess what do you say about pass by your words❓ Hey fam, Lemme see you your answer, thought in the group discussion never stop studying with me 💪
🧑💻Study time you know that we're on the Python functions we tried to see some highlight of it. now we learn together python function Arguments
Hey guys my apologize! I forget to remind you as long as you're coding you must push your code to the github. So if you're not doing that right now go and create account on the github. and add, commit, push your code to it. https://github.com/login
GitHub
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.
❤1
SamiTech Code pinned «...My progress here👉🏾Python Functions: def my_func(): print("Hello this's a functions") my_func() #calling the functions my_func() #calling the functions my_func() #calling…»
Hey guys there were no light about starts from lunch time to about 2pm sorry for that matter🙇♂️ But recently it just came
Hey What I've learned today....🤔.👇 #Python function arguments:
A function can have arguments, which are values you can pass to the function when you call it.
#A function with one argument:
#A function with multiple arguments:
#Parameter vs Argument: 👉🏾A parameter is a variable in the function definition that represents a value that will be passed to the function when it is called. 👉🏾An argument is the actual value that is passed to the function when it is called.
#positional only arguments:
you can specify that a function can have only positional argument
to specify a positional-only argument, add ', / ' after the arguments
#Keyword-only arguments:
# To specify that can have only keyword argument, add* , before arguments
...Oh 👆👆don't let to practice it not only this I'll send for you the others just for now this's enough ...PRACTICE BUILD SKILL😎 If you've any question you're welcome🫡
A function can have arguments, which are values you can pass to the function when you call it.
#A function with one argument:
def greet(name):
return f"Hello, {name}!"
print(greet("Alice")) #greet(argument)
#A function with multiple arguments:
def add(a, b):
return a + b
print(add(4, 8))
#Parameter vs Argument: 👉🏾A parameter is a variable in the function definition that represents a value that will be passed to the function when it is called. 👉🏾An argument is the actual value that is passed to the function when it is called.
def my_function(para1, para2): #here parameter
return para1 + para2
result = my_function(5, 9) # 5 and 9 are arguments
print(result)
#positional only arguments:
you can specify that a function can have only positional argument
to specify a positional-only argument, add '
def my_function(name, /):
print("Hello", name)
# my_function(name = "Alice") # TypeError: my_function() got some positional-only arguments but keyword was given
my_function("Alice") #correct
#Keyword-only arguments:
# To specify that can have only keyword argument, add
def my_func(*, name):
print("Hello", name)
# my_func("John") # TypeError: my_func() take 0 positional arguments bu 1 was given
my_func(name = "John") #correct
...Oh 👆👆don't let to practice it not only this I'll send for you the others just for now this's enough ...PRACTICE BUILD SKILL😎 If you've any question you're welcome🫡
❤1