Can you explain why this program doesn’t run without credits=int(input())) What does this one line of code do to make everything else flow together?

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question
100%
Can you explain why this program doesn’t run without credits=int(input())) What does this one line of code do to make everything else flow together?
2 #Brandon Yaemmongkol
February 1, 2022
3 #
4 #Practice 1: purpose
6 print ("Enter the number of college credits: ")
7
8 credits=int(input())
10 if credits>=90 and credits<=100:
11
print("Senior Status")
12 else:
if credits>=60 and credits<90:
print ("Junior Status")
else:
13
14
15
16
17
if credits>=30 and credits<60:
print("Sophomore Status")
else:
18
19
print ("Freshman Status")
20
21 #Practice 2: purpose is to practice using ELIF Hea
22
Transcribed Image Text:2 #Brandon Yaemmongkol February 1, 2022 3 # 4 #Practice 1: purpose 6 print ("Enter the number of college credits: ") 7 8 credits=int(input()) 10 if credits>=90 and credits<=100: 11 print("Senior Status") 12 else: if credits>=60 and credits<90: print ("Junior Status") else: 13 14 15 16 17 if credits>=30 and credits<60: print("Sophomore Status") else: 18 19 print ("Freshman Status") 20 21 #Practice 2: purpose is to practice using ELIF Hea 22
Expert Solution
Step 1

In python, the input() method is used to take the user input. But it will take the input as string. We need to typecaste it.

So for taking different data types input we need to typecast the method as:

 int(input()) 

Float(input())

Etc.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Print statement
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage