The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Basic Python Syntax

Basic Python Syntax

Super Learner
0
Votes
2
Answer

In the following snippet, I tried the same with int x =100 but I got an error but when I tried the same thing without int it worked. Now I know Python got some features but technically speaking don’t you think that my approach was right?
x = 100
if x>100 :
print(“A busy day”)
else:
print(“A calm day”)

2 Answers

365 Team

Hi Archisman!
Thanks for reaching out.
Generally, Python is extremely good at guessing the type of variables you are using. 
Should you wish to be specific, you can use the built-in functions, such as int() or float().
Hope this helps.
Best,
Martin

Hi Archisman,
You have probably resolved the issue by now. However, I was able to get your code to execute by indenting each print statement as follows.
x = 100
if x > 100:
   print(“A busy day”)
else:
   print(“A calm day”)
Python requires the line(s) after the conditional statements must be indented.
I hope this helps.
Anderson

Hi Anderson! Thanks for sharing your solution with the Community! Best, Martin

1 month

Thanks for sharing Anderson.

1 month