Skip to content

Forum in maintenance, we will back soon 🙂

Notifications
Clear all

Python condition

11 Posts
3 Users
2 Reactions
44 Views
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

 

I think you worte code wrong here. you said between 80 and 100.

if so, the code should be 

if length < 100 :

print("Long")

if length > 80 :

print("medium")

 

but you did if length > 100:

 

Like I said before, I don't know anything about code and python yet. so I could be wrong. 

 

Thanks.

 
Posted : 07/10/2023 1:02 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

No worries, friend,am here to help anytime.

if the number is not greater than 100, it will check if it is greater than 80. so between 80-100 will be medium, and greater than 100 is long. does this helps?

 
Posted : 07/10/2023 1:33 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 
(@jay-kim) If length is 101 or greater it is LONG or if length is between 81 and 100 (inclusive) it is MEDIUM else it is SHORT. Writing what you expect in natural language will help you understand the code. Does this help?

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/10/2023 11:57 pm
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@admin that's what I meant. I think you wrote the code wrong, didn't you??

x > 100 (long) , x > 80 (medium)

100 is already medium because greater than 80.

 

 
Posted : 07/11/2023 11:57 am
(@jay-kim)
Posts: 35
Trusted Member Customer
Topic starter
 

@ssadvisor if you don't mind, could you write it bigger?

 
Posted : 07/11/2023 11:58 am
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@jay-kim ahh now I got your point, no, the idea is when the code executes it will test the first condition, if it is true, it doesn't move the second. 

this is what  "else if" means. 

 
Posted : 07/12/2023 10:50 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@jay-kim I think the site software is what is making it smaller. For some reason when I write like this

(@jay-kim) the software changes the font. @Hasan, is this something you can modify?

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/12/2023 5:48 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@ssadvisor sometimes it is transformed into a DIV instead of a paragraph. I dont know why. did you paste the text  or write directly into the editor?

 
Posted : 07/13/2023 9:51 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@admin I copy and pasted the name tag and then I wrote it directly.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/13/2023 5:02 pm
Hasan Aboul Hasan
(@admin)
Posts: 1276
Member Admin
 

@ssadvisor mmm, I will run some tests on this

 
Posted : 07/14/2023 6:37 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@admin You can fix this by making "Paste as text" the default.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 07/14/2023 3:08 pm
Share:
[the_ad_group id="312"]